|
Saga
Saga Game Engine
|
This contains a collection of methods that interfaces with the FMOD studio API to play audio. More...
Namespaces | |
| namespace | anonymous_namespace{audioEngine.cpp} |
Classes | |
| struct | EventAttributes |
| A collection of vectors that specify an object in 3D space. This allows the AudioEngine to determine where listeners as well as AudioEventInstance are situated in space. More... | |
| struct | ParameterValue |
| Value of a parameter in FMOD. Whenever a parameter is retrieved from an event (or globally), it will be in this form. More... | |
Functions | |
| bool | init () |
| Initialize the Audio Engine. Must be called before any other audio operation. | |
| void | update () |
| Update the Audio Engine. Needs to be run every frame for accurate result. | |
| bool | release () |
| Release the Audio Engine. Must be called after init, and no audio operation should work after this call. | |
| void | loadBank (const std::string &bankFileName, FMOD_STUDIO_LOAD_BANK_FLAGS flags=FMOD_STUDIO_LOAD_BANK_NORMAL) |
| Load a bank of audio. By default, sample data will not be loaded. It is important that both the bank files and bank's strings file are loaded before events can be played. | |
| void | unloadBank (const std::string &bankName) |
| Unload bank. | |
| void | loadEvent (const std::string &eventName, bool loadSampleData=false) |
| Load an event from a loaded bank. | |
| void | loadSampleData (const std::string &eventName) |
| Load an event's sample data, allowing for event instances to be spawned and play instantaneously. For every call to load, you must call unload after. Loads and unloads are reference-counted, so the event's data won't completely unload until every load is followed by an unload. | |
| void | unloadSampleData (const std::string &eventName) |
| Unload an event's sample data. | |
| AudioEventInstance | playEvent (const std::string &eventName) |
| Play an event. If this event is not loaded, loadEvent will be called. | |
| AudioEventInstance | createInstance (const std::string &eventName) |
| Create an instance of a sound event. If this event has not been loaded, loadEvent will be called. | |
| void | playEvent (AudioEventInstance event) |
| Play an event. | |
| void | stopEvent (AudioEventInstance event, bool immediate=false) |
| Stop an event that's playing. | |
| void | releaseEvent (AudioEventInstance event) |
| Release an event instance. After this, the event instance is unusable. | |
| void | releaseAllEventInstances (const std::string &eventName) |
| Release all event instances associated with this event. | |
| void | unloadEvent (const std::string &eventName, bool unloadSampleData=false) |
| Unload an event. This effectively removes the ability to create instances of the event until it is loaded again. | |
| void | setParameter (AudioEventInstance instance, const std::string ¶meterName, float value) |
| Set a parameter on an event instance. | |
| ParameterValue | getParameter (AudioEventInstance instance, const std::string ¶meterName) |
| Get the value of an event. | |
| void | setLabeledParameter (AudioEventInstance instance, const std::string ¶meterName, std::string label) |
| Set a parameter on an event instance to a labeled value. | |
| std::string | getLabeledParameter (AudioEventInstance instance, const std::string ¶meterName) |
| Get the label-value of a parameter. | |
| void | setGlobalParameter (const std::string ¶meterName, float value) |
| Set a global parameter. | |
| ParameterValue | getGlobalParameter (const std::string ¶meterName) |
| Get the value of a global parameter. | |
| void | setGlobalLabeledParameter (const std::string ¶meterName, std::string label) |
| Set the value of a global parameter by label. | |
| std::string | getGlobalLabeledParameter (const std::string ¶meterName) |
| Get the label value of a global parameter. | |
| void | setListenerData (const EventAttributes &attributes) |
| Set the 3D position of the listener. | |
| void | set3DAttributes (AudioEventInstance instance, const EventAttributes &attributes) |
| Set the 3D attributes of an audio event instance. | |
| FMOD_VECTOR | vectorToFmod (const glm::vec3 &vPosition) |
| Convert a glm vector to an fmod vector. | |
Variables | |
| AudioImplementation | implementation = AudioImplementation() |
| Data used for operating the AudioEngine. | |
| const int | maxChannels = 32 |
| Maximum channels we will use for FMOD. Usually you don't need that many (probably 4-5 would be ok). | |
This contains a collection of methods that interfaces with the FMOD studio API to play audio.
| AudioEventInstance Saga::AudioEngine::createInstance | ( | const std::string & | eventName | ) |
Create an instance of a sound event. If this event has not been loaded, loadEvent will be called.
| eventName | name of the event, typically in the form "event:/Folder/Name". |

| std::string Saga::AudioEngine::getGlobalLabeledParameter | ( | const std::string & | parameterName | ) |
Get the label value of a global parameter.
| parameterName | the name of the parameter. |

| ParameterValue Saga::AudioEngine::getGlobalParameter | ( | const std::string & | parameterName | ) |
Get the value of a global parameter.
| parameterName | the name of the parameter. |
| std::string Saga::AudioEngine::getLabeledParameter | ( | AudioEventInstance | instance, |
| const std::string & | parameterName | ||
| ) |
Get the label-value of a parameter.
| instance | the event instance. |
| parameterName | the name of the parameter. |

| ParameterValue Saga::AudioEngine::getParameter | ( | AudioEventInstance | instance, |
| const std::string & | parameterName | ||
| ) |
Get the value of an event.
| instance | the event instance. |
| parameterName | the name of the parameter. |
| bool Saga::AudioEngine::init | ( | ) |
Initialize the Audio Engine. Must be called before any other audio operation.
| void Saga::AudioEngine::loadBank | ( | const std::string & | bankFileName, |
| FMOD_STUDIO_LOAD_BANK_FLAGS | flags = FMOD_STUDIO_LOAD_BANK_NORMAL |
||
| ) |
Load a bank of audio. By default, sample data will not be loaded. It is important that both the bank files and bank's strings file are loaded before events can be played.
| bankFileName | the filepath of the bank. This should be relative to your project source. |
| flags | flag for how the bank should load. |
| void Saga::AudioEngine::loadEvent | ( | const std::string & | eventName, |
| bool | loadSampleData = false |
||
| ) |
Load an event from a loaded bank.
| eventName | name of the event, typically in the form "event:/Folder/Name". |
| loadSampleData | whether or not to also load sample data. |

| void Saga::AudioEngine::loadSampleData | ( | const std::string & | eventName | ) |
Load an event's sample data, allowing for event instances to be spawned and play instantaneously. For every call to load, you must call unload after. Loads and unloads are reference-counted, so the event's data won't completely unload until every load is followed by an unload.
| eventName | name of the event, typically in the form "event:/Folder/Name". |

| void Saga::AudioEngine::playEvent | ( | AudioEventInstance | event | ) |
Play an event.
| event | the event instance. |
| AudioEventInstance Saga::AudioEngine::playEvent | ( | const std::string & | eventName | ) |
Play an event. If this event is not loaded, loadEvent will be called.
| eventName | name of the event, typically in the form "event:/Folder/Name". |

| bool Saga::AudioEngine::release | ( | ) |
Release the Audio Engine. Must be called after init, and no audio operation should work after this call.
| void Saga::AudioEngine::releaseAllEventInstances | ( | const std::string & | eventName | ) |
Release all event instances associated with this event.
| eventName | name of the event, typically in the form "event:/Folder/Name". |
| void Saga::AudioEngine::releaseEvent | ( | AudioEventInstance | event | ) |
Release an event instance. After this, the event instance is unusable.
| event | the event instance. |
| void Saga::AudioEngine::set3DAttributes | ( | AudioEventInstance | instance, |
| const EventAttributes & | attributes | ||
| ) |
Set the 3D attributes of an audio event instance.
| instance | the event instance. |
| attributes | the 3D attributes of the listener. |

| void Saga::AudioEngine::setGlobalLabeledParameter | ( | const std::string & | parameterName, |
| std::string | label | ||
| ) |
Set the value of a global parameter by label.
| parameterName | the name of the parameter. |
| label | the label value to set the parameter to. |
| void Saga::AudioEngine::setGlobalParameter | ( | const std::string & | parameterName, |
| float | value | ||
| ) |
Set a global parameter.
| parameterName | the name of the parameter. |
| value | the value to set the parameter to. |
| void Saga::AudioEngine::setLabeledParameter | ( | AudioEventInstance | instance, |
| const std::string & | parameterName, | ||
| std::string | label | ||
| ) |
Set a parameter on an event instance to a labeled value.
| instance | the event instance. |
| parameterName | the name of the parameter. |
| label | the label of the value to set the parameter to. |
| void Saga::AudioEngine::setListenerData | ( | const EventAttributes & | attributes | ) |
Set the 3D position of the listener.
| attributes | the 3D attributes of the listener. |

| void Saga::AudioEngine::setParameter | ( | AudioEventInstance | instance, |
| const std::string & | parameterName, | ||
| float | value | ||
| ) |
Set a parameter on an event instance.
| instance | the event instance. |
| parameterName | the name of the parameter. |
| value | the value to set it to. |
| void Saga::AudioEngine::stopEvent | ( | AudioEventInstance | event, |
| bool | immediate = false |
||
| ) |
Stop an event that's playing.
| event | the event instance. |
| immediate | whether or not the event stops immediately, or with a falloff. |
| void Saga::AudioEngine::unloadBank | ( | const std::string & | bankName | ) |
Unload bank.
| bankName | the filepath of the bank. This should be relative to your project's source. |
| void Saga::AudioEngine::unloadEvent | ( | const std::string & | eventName, |
| bool | unloadSampleData = false |
||
| ) |
Unload an event. This effectively removes the ability to create instances of the event until it is loaded again.
| eventName | name of the event, typically in the form "event:/Folder/Name". |
| unloadSampleData | whether or not to unload any sample data. |
| void Saga::AudioEngine::unloadSampleData | ( | const std::string & | eventName | ) |
Unload an event's sample data.
| eventName | name of the event, typically in the form "event:/Folder/Name". |
| void Saga::AudioEngine::update | ( | ) |
Update the Audio Engine. Needs to be run every frame for accurate result.
| FMOD_VECTOR Saga::AudioEngine::vectorToFmod | ( | const glm::vec3 & | vPosition | ) |
Convert a glm vector to an fmod vector.
| vPosition | the vector. |
| AudioImplementation Saga::AudioEngine::implementation = AudioImplementation() |
Data used for operating the AudioEngine.
| const int Saga::AudioEngine::maxChannels = 32 |
Maximum channels we will use for FMOD. Usually you don't need that many (probably 4-5 would be ok).