VAE - Virtual Audio Engine 1
Small Data Driven Audio Engine
|
Sealed of version of vae::core::Engine. More...
#include <vae_pimpl.hpp>
Public Member Functions | |
void _VAE_API_EXPORT | destroy () |
Result _VAE_API_EXPORT | init (const EngineConfig &config={}) |
Initializes the engine and does most of the upfront allocations. More... | |
Result _VAE_API_EXPORT | start () |
Tries to open default device and start audio thread. More... | |
Result _VAE_API_EXPORT | stop () |
Stops processing and waits for audio thead to clean up. More... | |
void _VAE_API_EXPORT | update () |
Update function needs to be called regularly to handle outbound events and other housekeeping. More... | |
Result _VAE_API_EXPORT | fireEvent (BankHandle bankHandle, EventHandle eventHandle, EmitterHandle emitterHandle, Sample gain=1.0, MixerHandle mixerHandle=InvalidMixerHandle, ListenerHandle listenerHandle=AllListeners) |
Main mechanism to start and stop sounds. More... | |
Result _VAE_API_EXPORT | fireGlobalEvent (GlobalEventHandle globalHandle, EmitterHandle emitterHandle, Sample gain=1.0, MixerHandle mixerHandle=InvalidMixerHandle, ListenerHandle listenerHandle=AllListeners) |
Works like fireEvent but with a global Event identifier. More... | |
int _VAE_API_EXPORT | getActiveVoiceCount () |
Get the number of currently playing Voices. More... | |
void _VAE_API_EXPORT | setMasterVolume (Sample volume) |
Set the global output volume before the limiter. More... | |
bool _VAE_API_EXPORT | checkVersion (int major, int minor, int patch) |
Check if the compiled version matches. More... | |
EmitterHandle _VAE_API_EXPORT | createEmitter () |
Creates an emitter and returns the handle. More... | |
EmitterHandle _VAE_API_EXPORT | createAutoEmitter (BankHandle bank, EventHandle event, float maxDist, const LocationDirection &locDir, float spread) |
Emitter which triggers an event once a listener is close enough. More... | |
Result _VAE_API_EXPORT | addEmitter (EmitterHandle h) |
Adds an emitter with a custom handle, can be an internal ID for example. More... | |
Result _VAE_API_EXPORT | removeEmitter (EmitterHandle h) |
Unregister a emiter an kill all its voices. More... | |
Result _VAE_API_EXPORT | setEmitter (EmitterHandle emitter, const LocationDirection &locDir, float spread) |
Set the Emitter position, orientation and spread. More... | |
Result _VAE_API_EXPORT | stopEmitter (EmitterHandle emitter) |
Stop all voices from emitter. More... | |
void _VAE_API_EXPORT | setVolume (EmitterHandle emitter, Sample gain) |
Sets the volume of all active voices with this emitter. More... | |
void _VAE_API_EXPORT | seek (EmitterHandle emitter, Size time) |
Set the current time of all voices with the emitter. More... | |
void _VAE_API_EXPORT | setSpeed (EmitterHandle emitter, float speed) |
Set the playback speed. More... | |
void _VAE_API_EXPORT | setLowpass (EmitterHandle emitter, float cutoff) |
Simple lowpass filter for the voices. More... | |
void _VAE_API_EXPORT | setHighpass (EmitterHandle emitter, float cutoff) |
Simple highpass filter for the voices. More... | |
ListenerHandle _VAE_API_EXPORT | createListener () |
Create a Listener object. More... | |
Result _VAE_API_EXPORT | removeListener (ListenerHandle listener) |
Unregister listener. More... | |
Result _VAE_API_EXPORT | setListener (ListenerHandle listener, const LocationOrientation &locOr) |
Set the position of a listener. More... | |
Result _VAE_API_EXPORT | loadHRTF (const char *path, Size size=0) |
Result _VAE_API_EXPORT | loadBank (const char *path, Size size=0) |
Load bank from filesystem. More... | |
Result _VAE_API_EXPORT | unloadBankFromId (BankHandle bankHandle) |
Unload bank from handle. More... | |
void _VAE_API_EXPORT | unloadAllBanks () |
Unload every bank and data associated with it. More... | |
Static Public Member Functions | |
static EnginePimpl *_VAE_API_EXPORT | create () |
Private Member Functions | |
EnginePimpl () | |
EnginePimpl (const EnginePimpl &) | |
~EnginePimpl () | |
Sealed of version of vae::core::Engine.
There are a few function, which aren't exported due to the fact that they would pull all the dependencies like tklb::AudioBuffer back in.
Definition at line 28 of file vae_pimpl.hpp.
|
private |
|
private |
|
inlineprivate |
Definition at line 31 of file vae_pimpl.hpp.
Result EnginePimpl::addEmitter | ( | EmitterHandle | h | ) |
Adds an emitter with a custom handle, can be an internal ID for example.
migt be desireable to make EmitterHandle the same size as a pointer so this can simply be the pointer of the entity that is associated with it.
h |
Definition at line 124 of file vae_pimpl.cpp.
bool EnginePimpl::checkVersion | ( | int | major, |
int | minor, | ||
int | patch | ||
) |
Check if the compiled version matches.
Definition at line 89 of file vae_pimpl.cpp.
|
static |
EmitterHandle EnginePimpl::createAutoEmitter | ( | BankHandle | bank, |
EventHandle | event, | ||
float | maxDist, | ||
const LocationDirection & | locDir, | ||
float | spread | ||
) |
Emitter which triggers an event once a listener is close enough.
bank | |
event | |
maxDist | |
locDir | |
spread |
Definition at line 107 of file vae_pimpl.cpp.
EmitterHandle EnginePimpl::createEmitter | ( | ) |
Creates an emitter and returns the handle.
Definition at line 102 of file vae_pimpl.cpp.
ListenerHandle EnginePimpl::createListener | ( | ) |
Create a Listener object.
TODO make listener 0 implicit
Definition at line 219 of file vae_pimpl.cpp.
void EnginePimpl::destroy | ( | ) |
Definition at line 10 of file vae_pimpl.cpp.
Result EnginePimpl::fireEvent | ( | BankHandle | bankHandle, |
EventHandle | eventHandle, | ||
EmitterHandle | emitterHandle, | ||
Sample | gain = 1.0 , |
||
MixerHandle | mixerHandle = InvalidMixerHandle , |
||
ListenerHandle | listenerHandle = AllListeners |
||
) |
Main mechanism to start and stop sounds.
bankHandle | bank id where the event is provided |
eventHandle | id of the event |
emitterHandle | handle of the emitter, needed for spatial audio or controlling the voice |
gain | optional volume factor |
mixerHandle | optional id of mixer channel sound will be routed to, this will override the one set in the event |
listenerHandle | For which listener this event will be adible for, default to all |
Definition at line 39 of file vae_pimpl.cpp.
Result EnginePimpl::fireGlobalEvent | ( | GlobalEventHandle | globalHandle, |
EmitterHandle | emitterHandle, | ||
Sample | gain = 1.0 , |
||
MixerHandle | mixerHandle = InvalidMixerHandle , |
||
ListenerHandle | listenerHandle = AllListeners |
||
) |
Works like fireEvent but with a global Event identifier.
globalHandle | The GlobalEventHandle combines both bank and event id |
emitterHandle | optional handle of the emitter, needed for spatial audio |
gain | optional volume factor |
mixerHandle | id of mixer channel sound will be routed to, this will override the one set in the event |
Definition at line 58 of file vae_pimpl.cpp.
int EnginePimpl::getActiveVoiceCount | ( | ) |
Get the number of currently playing Voices.
Definition at line 75 of file vae_pimpl.cpp.
Result EnginePimpl::init | ( | const EngineConfig & | config = {} | ) |
Initializes the engine and does most of the upfront allocations.
Run this before start !
Everything will be allocated according to the provided config. Loading a Bank will still cause an allocation. If there are already banks loaded, they will be reloaded to have the correct samplerate.
config | Optional config to setup the internals. |
Definition at line 15 of file vae_pimpl.cpp.
Load bank from filesystem.
This operation might take a little time but won't lock the audio thread until the bank is inserted. This should be safe to do at any time.
path |
Definition at line 255 of file vae_pimpl.cpp.
Definition at line 244 of file vae_pimpl.cpp.
Result EnginePimpl::removeEmitter | ( | EmitterHandle | h | ) |
Unregister a emiter an kill all its voices.
h |
Definition at line 133 of file vae_pimpl.cpp.
Result EnginePimpl::removeListener | ( | ListenerHandle | listener | ) |
Unregister listener.
listener |
Definition at line 224 of file vae_pimpl.cpp.
void EnginePimpl::seek | ( | EmitterHandle | emitter, |
Size | time | ||
) |
Set the current time of all voices with the emitter.
emitter | |
time | Time in samples |
Definition at line 175 of file vae_pimpl.cpp.
Result EnginePimpl::setEmitter | ( | EmitterHandle | emitter, |
const LocationDirection & | locDir, | ||
float | spread | ||
) |
Set the Emitter position, orientation and spread.
emitter | The emitter |
locDir | The desired location |
spread | The width of the panning (if it's spatial and not HRTF) |
Definition at line 142 of file vae_pimpl.cpp.
void EnginePimpl::setHighpass | ( | EmitterHandle | emitter, |
float | cutoff | ||
) |
Simple highpass filter for the voices.
emitter | |
cutoff | 0-1. 0 doesn't filter, 1 filter the wholespektrum |
Definition at line 208 of file vae_pimpl.cpp.
Result EnginePimpl::setListener | ( | ListenerHandle | listener, |
const LocationOrientation & | locOr | ||
) |
Set the position of a listener.
listener |
Definition at line 233 of file vae_pimpl.cpp.
void EnginePimpl::setLowpass | ( | EmitterHandle | emitter, |
float | cutoff | ||
) |
Simple lowpass filter for the voices.
emitter | |
cutoff | 0-1. 0 doesn't filter, 1 filter the wholespektrum |
Definition at line 197 of file vae_pimpl.cpp.
void EnginePimpl::setMasterVolume | ( | Sample | volume | ) |
Set the global output volume before the limiter.
The engine can't clip, but if the output is too load the signal will be squashed in the limiter.
volume | 1.0 is the default, not interpolated for now |
Definition at line 80 of file vae_pimpl.cpp.
void EnginePimpl::setSpeed | ( | EmitterHandle | emitter, |
float | speed | ||
) |
Set the playback speed.
emitter | |
speed | 1.0 is the default speed, pitch will be affected as well. |
Definition at line 186 of file vae_pimpl.cpp.
void EnginePimpl::setVolume | ( | EmitterHandle | emitter, |
Sample | gain | ||
) |
Sets the volume of all active voices with this emitter.
emitter | |
gain |
Definition at line 164 of file vae_pimpl.cpp.
Result EnginePimpl::start | ( | ) |
Tries to open default device and start audio thread.
Call this after start.
Definition at line 24 of file vae_pimpl.cpp.
Result EnginePimpl::stop | ( | ) |
Stops processing and waits for audio thead to clean up.
Definition at line 29 of file vae_pimpl.cpp.
Result EnginePimpl::stopEmitter | ( | EmitterHandle | emitter | ) |
Stop all voices from emitter.
emitter |
Definition at line 155 of file vae_pimpl.cpp.
void EnginePimpl::unloadAllBanks | ( | ) |
Unload every bank and data associated with it.
Definition at line 275 of file vae_pimpl.cpp.
Result EnginePimpl::unloadBankFromId | ( | BankHandle | bankHandle | ) |
Unload bank from handle.
Locks audio thread and stops all voices from that bank.
bankHandle |
Definition at line 266 of file vae_pimpl.cpp.
void EnginePimpl::update | ( | ) |
Update function needs to be called regularly to handle outbound events and other housekeeping.
If this isn't called regularly events might be lost and chained events not fired. When EngineConfig::updateInAudioThread is true, this doesn't need to be called manually.
Definition at line 34 of file vae_pimpl.cpp.