 |
Cytopia
0.3
A city building simulation game
|
Go to the documentation of this file. 1 #ifndef AUDIOMIXER_HXX_
2 #define AUDIOMIXER_HXX_
5 #include <unordered_set>
12 #include "../util/Meta.hxx"
13 #include "../util/Singleton.hxx"
20 #include "AL/efx-presets.h"
22 template <
typename Key,
typename Value>
using Mapping = std::unordered_map<Key, Value>;
23 template <
typename Type,
size_t N>
using Array = std::array<Type, N>;
25 template <
typename Type>
using Vector = std::vector<Type>;
26 template <
typename Type>
using Set = std::unordered_set<Type>;
27 template <
typename Type>
using List = std::list<Type>;
76 void play(
const AudioTrigger &trigger,
int effect = AL_EFFECT_NULL);
92 void play(
const AudioTrigger &trigger,
const Coordinate3D &position,
int effect = AL_EFFECT_NULL);
SoundtrackUPtr & getTrack(const AudioTrigger &trigger)
Constant::value returns the value.
void stopAll()
Stops all soundtracks.
static std::function< void(int)> onTrackFinishedFunc
void setMusicVolume(float volume)
sets the music volume
void playSoundtrack(SoundtrackUPtr &soundtrack)
Plays the Soundtrack.
a 3-dimensional coordinate
std::unique_ptr< Soundtrack > SoundtrackUPtr
void onTrackFinished(int channelID)
Called whenever a Channel has finished playing.
static void onTrackFinishedFuncPtr(int channelID)
Vector< SoundtrackUPtr > m_Soundtracks
All the available soundtracks.
std::vector< Type > Vector
void setMuted(bool isMuted)
toggles the mute option for sounds
void setSoundEffectVolume(float volume)
sets the sound effects volume
void playSoundtrackWithEffect(SoundtrackUPtr &soundtrack, int ALEffect)
Plays the Soundtrack with a certain effect applied.
std::unordered_map< Key, Value > Mapping
POSITION_INDEX
position of listener
void prune()
Updates soundtracks that are no longer playing.
Abstract Singleton implementation.
List< SoundtrackUPtr * > m_Playing
All the currently playing Soundtracks.
ORIENTATION_INDEX
orientation of listener
ALCcontext * alContext
OpenAL Soft setup, context of where audio is played.
void play(const SoundtrackID &id, int effect=AL_EFFECT_NULL)
Plays a Soundtrack given its ID and optionally applies an effect.
const char * get_al_error_msg(ALenum error)
Get a descriptive error message from an error code.
Array< Vector< SoundtrackID >, AudioTrigger::_size()> m_Triggers
A Mapping between triggers and SoundtrackID.
std::array< Type, N > Array
std::unordered_set< Type > Set
ALCdevice * gAudioDevice
OpenAL Soft setup, audio device to be used.
AudioMixer & operator=(const AudioMixer &)=delete
Mapping< SoundtrackID, SoundtrackUPtr * > m_GetSound
A Mapping between SoundtrackID and Soundtrack.