XPMP2
X-Plane multiplayer library 2 - using instancing
XPMP2::SoundSystem Class Referenceabstract

Base class for sound systems, practically empty. More...

#include <Sound.h>

+ Inheritance diagram for XPMP2::SoundSystem:

Public Member Functions

 SoundSystem ()
 Construtor.
 
virtual ~SoundSystem ()
 Destructor.
 
virtual bool LoadSoundFile (const std::string &_sndName, const std::string &_filePath, bool _bLoop, float _coneDir, float _conePitch, float _coneInAngle, float _coneOutAngle, float _coneOutVol)=0
 Loads a sound file so it becomes ready to play.
 
const char * EnumerateSounds (const char *prevName, const char **ppFilePath)
 Enumerate all loaded sounds.
 
virtual uint64_t Play (const std::string &sndName, float vol, const Aircraft &ac)=0
 Play a new sound, returns an id for that sound.
 
virtual void Unpause (uint64_t sndId)=0
 Unpause a sound, which got started in a paused state to avoid crackling.
 
virtual void Stop (uint64_t sndId)=0
 Stop the sound.
 
virtual void SetPosOrientation (uint64_t sndId, const Aircraft &ac, bool bDoOrientation)=0
 Update sound's position and orientation.
 
virtual void SetVolume (uint64_t sndId, float vol)=0
 Set sound's volume.
 
virtual void SetMute (uint64_t sndId, bool bMute)=0
 Mute the sound (temporarily)
 
virtual void Update ()=0
 Any updates to be done at the end of the frame.
 
virtual void SetMasterVolume (float volMaster)=0
 Set Master Volume, effectively a multiplicator to SetVolume()
 
virtual void SetAllMute (bool bMute)=0
 Mute all sounds (temporarily)
 
virtual bool IsValid (uint64_t sndId)
 Is the sound id available?
 

Protected Member Functions

std::pair< uint64_t, SoundChannel * > AddChn (SoundFile *pSnd, float vol, FMOD_CHANNEL *pChn=nullptr)
 Add one more channel, returning the newly created id.
 
SoundChannelGetChn (uint64_t sndId)
 Return the SoundChannel object for a given id, or nullptr if not found.
 
void RemoveChn (uint64_t sndId)
 Remove a channel from out tracking.
 

Protected Attributes

mapSoundPtrTy mapSounds
 Map of all sounds, indexed by a sound name (type)
 
std::map< uint64_t, SoundChannelmapChn
 Keeps track of currently playing sounds, their key serving as id.
 

Detailed Description

Base class for sound systems, practically empty.

Constructor & Destructor Documentation

◆ SoundSystem()

XPMP2::SoundSystem::SoundSystem ( )
inline

Construtor.

◆ ~SoundSystem()

virtual XPMP2::SoundSystem::~SoundSystem ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ AddChn()

std::pair< uint64_t, SoundChannel * > XPMP2::SoundSystem::AddChn ( SoundFile * pSnd,
float vol,
FMOD_CHANNEL * pChn = nullptr )
protected

Add one more channel, returning the newly created id.

◆ EnumerateSounds()

const char * XPMP2::SoundSystem::EnumerateSounds ( const char * prevName,
const char ** ppFilePath )

Enumerate all loaded sounds.

◆ GetChn()

SoundChannel * XPMP2::SoundSystem::GetChn ( uint64_t sndId)
protected

Return the SoundChannel object for a given id, or nullptr if not found.

◆ IsValid()

bool XPMP2::SoundSystem::IsValid ( uint64_t sndId)
virtual

Is the sound id available?

Reimplemented in XPMP2::SoundSystemFMOD.

◆ LoadSoundFile()

virtual bool XPMP2::SoundSystem::LoadSoundFile ( const std::string & _sndName,
const std::string & _filePath,
bool _bLoop,
float _coneDir,
float _conePitch,
float _coneInAngle,
float _coneOutAngle,
float _coneOutVol )
pure virtual

Loads a sound file so it becomes ready to play.

Implemented in XPMP2::SoundSystemFMOD, and XPMP2::SoundSystemXP.

◆ Play()

virtual uint64_t XPMP2::SoundSystem::Play ( const std::string & sndName,
float vol,
const Aircraft & ac )
pure virtual

Play a new sound, returns an id for that sound.

Implemented in XPMP2::SoundSystemFMOD, and XPMP2::SoundSystemXP.

◆ RemoveChn()

void XPMP2::SoundSystem::RemoveChn ( uint64_t sndId)
protected

Remove a channel from out tracking.

◆ SetAllMute()

virtual void XPMP2::SoundSystem::SetAllMute ( bool bMute)
pure virtual

Mute all sounds (temporarily)

Implemented in XPMP2::SoundSystemFMOD, and XPMP2::SoundSystemXP.

◆ SetMasterVolume()

virtual void XPMP2::SoundSystem::SetMasterVolume ( float volMaster)
pure virtual

Set Master Volume, effectively a multiplicator to SetVolume()

Implemented in XPMP2::SoundSystemFMOD, and XPMP2::SoundSystemXP.

◆ SetMute()

virtual void XPMP2::SoundSystem::SetMute ( uint64_t sndId,
bool bMute )
pure virtual

Mute the sound (temporarily)

Implemented in XPMP2::SoundSystemFMOD, and XPMP2::SoundSystemXP.

◆ SetPosOrientation()

virtual void XPMP2::SoundSystem::SetPosOrientation ( uint64_t sndId,
const Aircraft & ac,
bool bDoOrientation )
pure virtual

Update sound's position and orientation.

Implemented in XPMP2::SoundSystemFMOD, and XPMP2::SoundSystemXP.

◆ SetVolume()

virtual void XPMP2::SoundSystem::SetVolume ( uint64_t sndId,
float vol )
pure virtual

Set sound's volume.

Implemented in XPMP2::SoundSystemFMOD, and XPMP2::SoundSystemXP.

◆ Stop()

virtual void XPMP2::SoundSystem::Stop ( uint64_t sndId)
pure virtual

Stop the sound.

Implemented in XPMP2::SoundSystemFMOD, and XPMP2::SoundSystemXP.

◆ Unpause()

virtual void XPMP2::SoundSystem::Unpause ( uint64_t sndId)
pure virtual

Unpause a sound, which got started in a paused state to avoid crackling.

Implemented in XPMP2::SoundSystemFMOD, and XPMP2::SoundSystemXP.

◆ Update()

virtual void XPMP2::SoundSystem::Update ( )
pure virtual

Any updates to be done at the end of the frame.

Implemented in XPMP2::SoundSystemFMOD, and XPMP2::SoundSystemXP.

Member Data Documentation

◆ mapChn

std::map<uint64_t,SoundChannel> XPMP2::SoundSystem::mapChn
protected

Keeps track of currently playing sounds, their key serving as id.

◆ mapSounds

mapSoundPtrTy XPMP2::SoundSystem::mapSounds
protected

Map of all sounds, indexed by a sound name (type)


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