Brunot
Loading...
Searching...
No Matches
AudioObject Class Reference

Audio system using FMOD with all declarations needed for basic audio playback. More...

#include <AudioObject.h>

Public Member Functions

 AudioObject ()
 AudioObject (const char *name, bool loopable, AudioType _channelType)
 AudioObject (const AudioObject &other)
auto operator= (const AudioObject &other) -> AudioObject &
 AudioObject (AudioObject &&other) noexcept
auto operator= (AudioObject &&other) noexcept -> AudioObject &
 ~AudioObject ()
auto play () -> void
auto pause (bool pause) -> void
auto stop () -> void
auto setVolume (float vol) -> void
auto setPitch (float pit) -> void
auto getIsPlaying () const -> bool
auto getIsPaused () const -> bool
auto getVolume () const -> float
auto getPitch () const -> float
auto getAudioHandler () -> AudioObject *
auto name () const -> const std::string &
auto loadFile (const std::string &fileName, bool loopable) -> void
auto load (Stream &stream) -> void
auto save (Stream &stream) const -> void

Private Attributes

FMOD::Sound * sound
FMOD::Channel * channel
bool isPlaying
bool isPaused
float volume
float pitch
std::string filePath
bool isLoopable
std::string _name
AudioType channelType

Friends

auto to_json (json &j, const AudioObject &a) ->void
auto from_json (const json &j, AudioObject &a) ->void

Detailed Description

Audio system using FMOD with all declarations needed for basic audio playback.

Constructor & Destructor Documentation

◆ AudioObject() [1/4]

AudioObject::AudioObject ( )

default constructor to make a sound object

Here is the caller graph for this function:

◆ AudioObject() [2/4]

AudioObject::AudioObject ( const char * name,
bool loopable,
AudioType _channelType )

constructor to make a sound object with a path to the sound file

Parameters
path= path to the sound file
loopable= if the sound should loop or not (rough method for now)
channelType= what channel group the sound should play on, if none it will play on the master channel group and log a warning
Here is the call graph for this function:

◆ AudioObject() [3/4]

AudioObject::AudioObject ( const AudioObject & other)
Here is the call graph for this function:

◆ AudioObject() [4/4]

AudioObject::AudioObject ( AudioObject && other)
noexcept
Todo
implement move constructor properly
Here is the call graph for this function:

◆ ~AudioObject()

AudioObject::~AudioObject ( )

destructor to clean up the sound object

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ getAudioHandler()

auto AudioObject::getAudioHandler ( ) ->AudioObject *

Returns the audio handler

Returns
AudioObject* = pointer to the audio handler
Here is the call graph for this function:

◆ getIsPaused()

auto AudioObject::getIsPaused ( ) const->bool

Returns if the sound is paused

Returns
bool = true if the sound is paused, false otherwise
Here is the call graph for this function:

◆ getIsPlaying()

auto AudioObject::getIsPlaying ( ) const->bool

Returns if the sound is playing

Returns
bool = true if the sound is playing, false otherwise
Here is the caller graph for this function:

◆ getPitch()

auto AudioObject::getPitch ( ) const->float

Returns the pitch of the sound

\ return float = pitch of the sound (0.5f - 2.0f)

Here is the call graph for this function:

◆ getVolume()

auto AudioObject::getVolume ( ) const->float

Returns the volume of the sound

Returns
float = volume of the sound (0.0f - 1.0f)
Here is the call graph for this function:

◆ load()

auto AudioObject::load ( Stream & stream) ->void

◆ loadFile()

auto AudioObject::loadFile ( const std::string & fileName,
bool loopable )->void

loads file basically a constructor

Parameters
fileNameits in the constructor
loopableits in the constructor
Here is the call graph for this function:
Here is the caller graph for this function:

◆ name()

auto AudioObject::name ( ) const->conststd::string &

Returns the name of the audio

Returns
std::string audio
Here is the caller graph for this function:

◆ operator=() [1/2]

auto AudioObject::operator= ( AudioObject && other) ->AudioObject &
noexcept
Todo
implement move assignment properly
Here is the call graph for this function:

◆ operator=() [2/2]

auto AudioObject::operator= ( const AudioObject & other) ->AudioObject &
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pause()

auto AudioObject::pause ( bool pause) ->void

Pauses the sound

Parameters
pause= bool to pause or unpause the sound
Here is the call graph for this function:
Here is the caller graph for this function:

◆ play()

auto AudioObject::play ( ) ->void

Plays the sound

Here is the call graph for this function:

◆ save()

auto AudioObject::save ( Stream & stream) const->void

◆ setPitch()

auto AudioObject::setPitch ( float pit) ->void

Sets the pitch of the sound

Parameters
pitch= value to set the pitch to where 0.5 represents half pitch (one octave down), 1.0 represents unmodified pitch and 2.0 represents double pitch (one octave up).
Here is the call graph for this function:

◆ setVolume()

auto AudioObject::setVolume ( float vol) ->void

Sets the volume of the sound

Parameters
vol= value to set the volume to (0.0f - 1.0f)
Here is the call graph for this function:

◆ stop()

auto AudioObject::stop ( ) ->void

Stops the sound

Here is the call graph for this function:

◆ from_json

auto from_json ( const json & j,
AudioObject & a )->void
friend

◆ to_json

auto to_json ( json & j,
const AudioObject & a )->void
friend

Member Data Documentation

◆ _name

std::string AudioObject::_name
private

◆ channel

FMOD::Channel* AudioObject::channel
private

◆ channelType

AudioType AudioObject::channelType
private

◆ filePath

std::string AudioObject::filePath
private

◆ isLoopable

bool AudioObject::isLoopable
private

◆ isPaused

bool AudioObject::isPaused
private

◆ isPlaying

bool AudioObject::isPlaying
private

◆ pitch

float AudioObject::pitch
private

◆ sound

FMOD::Sound* AudioObject::sound
private

◆ volume

float AudioObject::volume
private

The documentation for this class was generated from the following files: