All Classes Functions Typedefs
Public Member Functions | List of all members
EnjoLib::MFDGoodies::Sound Class Reference

Sound class. More...

#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.

Detailed Description

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.

Warning
To enable the sound, you need to call Connect() from MyMFD::Update() method!

Constructor & Destructor Documentation

Sound::Sound ( const SoundMap soundMap)

Default constructor.

Accepts the SoundMap derived map.
Parameters
soundMap

Member Function Documentation

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.

Parameters
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.

Parameters
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
Parameters
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


The documentation for this class was generated from the following files: