154 float up[3] = {0, 1, 0};
Implements some audio clip types.
Central class of the core audio subsystem.
Definition audiodevice.h:41
void OnFrame()
Called per frame to update spatial positions.
Definition audiodevice.cc:69
ClipInstanceId PlaySpatial(ClipId clip, float volume, Math::vec3 const &position, Math::vec3 const &velocity, float minDistance, float maxDistance, bool loop=false, float clock=0.0f)
Play spatial audio clip that accounts for spatial position when playing. Returns the playing clip ins...
Definition audiodevice.cc:230
void SetClock(AudioEmitterId id, float value)
Set min delay between subsequent instances of an emitted sound (value of 0 disables)
Definition audiodevice.cc:372
void UnloadClip(ClipId const id)
Unload a soundfile.
Definition audiodevice.cc:125
void Stop(ClipId id)
Stop all instances of a clip.
Definition audiodevice.cc:318
Ids::IdAllocator< ClipId, Math::point, Math::vector, float, float, float, float, bool, float > emitterAllocator
Definition audiodevice.h:134
~AudioDevice()
Definition audiodevice.cc:27
Ids::IdAllocator< SoLoud::Wav, uint > wavs
Contains all wavs that are currently loaded.
Definition audiodevice.h:146
ClipId LoadClip(Resources::ResourceName const &name)
Load a soundfile into memory.
Definition audiodevice.cc:85
void SetMinDistance(AudioEmitterId id, float value)
Set the min audible distance of a sound.
Definition audiodevice.cc:363
void DestroyAudioEmitter(AudioEmitterId const id)
Destroy an audio emitter.
Definition audiodevice.cc:191
AudioEmitterId CreateAudioEmitter(Resources::ResourceName const &name)
Load a soundfile into memory.
Definition audiodevice.cc:143
void UpdateVelocity(ClipInstanceId id, Math::vector const &vel)
Update the spatial velocity of a sound instance.
Definition audiodevice.cc:399
void SetSpatialize(AudioEmitterId id, bool value)
Set whether or not to account for spatial position when playing a sound.
Definition audiodevice.cc:327
Util::Dictionary< Resources::ResourceName, ClipId > clipMap
resource -> clipid table
Definition audiodevice.h:149
void SetPosition(AudioEmitterId id, Math::point const &pos)
Set spatial position of a sound in world space.
Definition audiodevice.cc:336
__DeclareSingleton(AudioDevice)
ClipInstanceId Play(ClipId clip, float volume, float pan, bool loop=false, float clock=0.0f)
Play non-spatial audio clip. Returns the playing clip instance.
Definition audiodevice.cc:208
bool IsValid(ClipInstanceId id)
Check if an instance is valid.
Definition audiodevice.cc:473
WavAllocator
Definition audiodevice.h:137
@ REFCOUNT
Definition audiodevice.h:139
@ WAV
Definition audiodevice.h:138
struct Audio::AudioDevice::Listener listener
void SetPan(AudioEmitterId id, float value)
Set 2D pan for non spatialized sounds. (L = -1.0, R = 1.0)
Definition audiodevice.cc:381
void SetVelocity(AudioEmitterId id, Math::vector const &vel)
Set spatial velocity of a sound.
Definition audiodevice.cc:345
void SetMaxDistance(AudioEmitterId id, float value)
Set the max audible distance of a sound.
Definition audiodevice.cc:354
EmitterSlot
Definition audiodevice.h:123
@ SPATIALIZE
Definition audiodevice.h:131
@ CLOCK
Definition audiodevice.h:132
@ CLIPID
Definition audiodevice.h:124
@ POSITION
Definition audiodevice.h:125
@ VELOCITY
Definition audiodevice.h:126
@ PAN
Definition audiodevice.h:130
@ MINDISTANCE
Definition audiodevice.h:128
@ VOLUME
Definition audiodevice.h:127
@ MAXDISTANCE
Definition audiodevice.h:129
__DeclareClass(AudioDevice)
bool Close()
Shutdown the audio engine.
Definition audiodevice.cc:53
void StopInstance(ClipInstanceId id)
Stop an instance of a clip.
Definition audiodevice.cc:309
void SetSpeedOfSound(float value=343.0f)
Set the speed of sound constant. (default assumes 1 unit is 1 meter)
Definition audiodevice.cc:455
void UpdatePosition(ClipInstanceId id, Math::point const &pos)
Update the spatial position of a sound instance in world space.
Definition audiodevice.cc:390
void SetListenerVelocity(Math::vector const &velocity)
Set the listeners velocity.
Definition audiodevice.cc:443
void SetListenerTransform(Math::mat4 const &transform)
Set the listener transform in world space.
Definition audiodevice.cc:408
void ResetListener()
Reset listener.
Definition audiodevice.cc:464
bool Open()
Initialize the audio engine.
Definition audiodevice.cc:36
The common base class of Nebula.
Definition refcounted.h:38
An ID allocator associates an id with a slice in an N number of arrays.
Definition idallocator.h:39
A collection of key/value pairs with quick value retrieval by key at roughly O(log n).
Definition dictionary.h:34
A StringAtom.
Definition stringatom.h:22
#define _declare_counter(counter)
Definition debugcounter.h:31
#define _declare_timer(timer)
Definition debugtimer.h:35
#define ID_32_TYPE(x)
Definition id.h:16
Definition audioclip.h:15
Definition audiodevice.h:31
Definition audiodevice.h:152
float up[3]
Definition audiodevice.h:154
float position[3]
Definition audiodevice.h:155
float forward[3]
Definition audiodevice.h:153
float velocity[3]
Definition audiodevice.h:156
Definition audiodevice.h:38
Definition audioclip.h:17
Definition audioclip.h:18
A 4x4 single point precision float matrix.
Definition mat4.h:49
Represents a 3D point in space.
Definition point.h:22
A 3D vector.
Definition vec3.h:40
A vector is a 3D direction in space.
Definition vector.h:22