#include <Sound.hpp>
Public Member Functions | |
Sound (const SoundMap &soundMap) | |
Default constructor. | |
virtual | ~Sound () |
Destructor. | |
void | Reinit () |
void | PlaySound (const int sample) |
Plays sound sample. | |
void | PlaySoundOnce (const int sample) |
void | ResetSoundOnce (const int sample) |
void | ResetSoundsOnce () |
void | SetUseSound (const bool use) |
Sets sound to using or not using. | |
void | SwitchUseSound () |
Switches between using and not using sound. | |
void | Connect (const char *uniqueName) |
Connect the MFD to OrbitrSound system. |
Sound class.
A handy C++ wrapper over Dan's MFD sound library. The sound is played by passing SoundSampleIDEnum to PlaySound(). The sound samples for this class should be defined in SoundMap.
Sound::Sound | ( | const SoundMap & | soundMap | ) |
Default constructor.
Accepts the SoundMap derived map.
soundMap |
void Sound::Connect | ( | const char * | uniqueName | ) |
Connect the MFD to OrbitrSound system.
To actually enable the sound, this method must be called from MyMFD::Update().
It's internals are executed only once.
uniqueName | - a unique ID of your MFD. Can be anything that you think is unique enough |
void Sound::PlaySound | ( | const int | sample | ) |
Plays sound sample.
Plays a given sound only if the object hasn't been instructed not to play the sound
by calling SetUseSound() with false argument.
sample | - sound sample defined in enum and mapped to file in SoundMap |
void Sound::SetUseSound | ( | const bool | use | ) |
Sets sound to using or not using.
Sets sound to using or not using
use | - true to use, false not to use |
void Sound::SwitchUseSound | ( | ) |
Switches between using and not using sound.
A convenience method created, so that you don't need to store the choice externally