Saga
Saga Game Engine
Loading...
Searching...
No Matches
audioEngine.cpp File Reference
#include "audioEngine.h"
#include "Engine/_Core/logger.h"
#include <cstdarg>
#include <iostream>
Include dependency graph for audioEngine.cpp:

Namespaces

namespace  Saga
 
namespace  Saga::AudioEngine
 This contains a collection of methods that interfaces with the FMOD studio API to play audio.
 
namespace  Saga::AudioEngine::anonymous_namespace{audioEngine.cpp}
 

Functions

void Saga::AudioEngine::anonymous_namespace{audioEngine.cpp}::ensureFMOD_OK (FMOD_RESULT result, const char *failMessage,...)
 
bool Saga::AudioEngine::anonymous_namespace{audioEngine.cpp}::ensureFMOD_INITIALIZED (const std::string &operation)
 
bool Saga::AudioEngine::init ()
 Initialize the Audio Engine. Must be called before any other audio operation.
 
void Saga::AudioEngine::update ()
 Update the Audio Engine. Needs to be run every frame for accurate result.
 
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::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 Saga::AudioEngine::unloadBank (const std::string &bankName)
 Unload bank.
 
void Saga::AudioEngine::loadEvent (const std::string &eventName, bool loadSampleData=false)
 Load an event from a loaded bank.
 
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.
 
void Saga::AudioEngine::unloadSampleData (const std::string &eventName)
 Unload an event's sample data.
 
AudioEventInstance Saga::AudioEngine::playEvent (const std::string &eventName)
 Play an event. If this event is not loaded, loadEvent will be called.
 
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.
 
void Saga::AudioEngine::playEvent (AudioEventInstance event)
 Play an event.
 
void Saga::AudioEngine::stopEvent (AudioEventInstance event, bool immediate=false)
 Stop an event that's playing.
 
void Saga::AudioEngine::releaseEvent (AudioEventInstance event)
 Release an event instance. After this, the event instance is unusable.
 
void Saga::AudioEngine::releaseAllEventInstances (const std::string &eventName)
 Release all event instances associated with this event.
 
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.
 
void Saga::AudioEngine::setParameter (AudioEventInstance instance, const std::string &parameterName, float value)
 Set a parameter on an event instance.
 
ParameterValue Saga::AudioEngine::getParameter (AudioEventInstance instance, const std::string &parameterName)
 Get the value of an event.
 
void Saga::AudioEngine::setLabeledParameter (AudioEventInstance instance, const std::string &parameterName, std::string label)
 Set a parameter on an event instance to a labeled value.
 
std::string Saga::AudioEngine::getLabeledParameter (AudioEventInstance instance, const std::string &parameterName)
 Get the label-value of a parameter.
 
void Saga::AudioEngine::setGlobalParameter (const std::string &parameterName, float value)
 Set a global parameter.
 
ParameterValue Saga::AudioEngine::getGlobalParameter (const std::string &parameterName)
 Get the value of a global parameter.
 
void Saga::AudioEngine::setGlobalLabeledParameter (const std::string &parameterName, std::string label)
 Set the value of a global parameter by label.
 
std::string Saga::AudioEngine::getGlobalLabeledParameter (const std::string &parameterName)
 Get the label value of a global parameter.
 
void Saga::AudioEngine::setListenerData (const EventAttributes &attributes)
 Set the 3D position of the listener.
 
void Saga::AudioEngine::set3DAttributes (AudioEventInstance instance, const EventAttributes &attributes)
 Set the 3D attributes of an audio event instance.
 
FMOD_VECTOR Saga::AudioEngine::vectorToFmod (const glm::vec3 &vPosition)
 Convert a glm vector to an fmod vector.
 

Variables

AudioImplementation Saga::AudioEngine::implementation = AudioImplementation()
 Data used for operating the AudioEngine.