OpenEnroth 73e68f7
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
AudioPlayer Class Reference

#include <AudioPlayer.h>

Public Member Functions

 AudioPlayer ()=default
 
virtual ~AudioPlayer ()
 
void Initialize ()
 
void UpdateVolumeFromConfig ()
 
Blob LoadSound (std::string_view pSoundName)
 
void SetMasterVolume (int level)
 
void SetVoiceVolume (int level)
 
void SetMusicVolume (int level)
 
void MusicPlayTrack (MusicId eTrack)
 
void MusicStart ()
 
void MusicStop ()
 
void MusicPause ()
 
void MusicResume ()
 
void UpdateSounds ()
 
void pauseAllSounds ()
 
void pauseLooping ()
 
void resumeSounds ()
 
void stopSounds ()
 
void stopVoiceSounds ()
 
void stopWalkingSounds ()
 
void soundDrain ()
 
bool isWalkingSoundPlays ()
 
float getSoundLength (SoundId eSoundID)
 
void playSound (SoundId eSoundID, SoundPlaybackMode mode, Pid pid=Pid())
 
bool loadSoundDataSource (SoundInfo *si)
 
void playSpellSound (SpellId spell, bool is_impact, SoundPlaybackMode mode, Pid pid=Pid())
 
void playUISound (SoundId id)
 
void playExclusiveSound (SoundId id)
 
void playNonResetableSound (SoundId id)
 
void playWalkSound (SoundId id)
 
void playHouseSound (SoundId id, bool isSpeech)
 

Protected Attributes

bool bPlayerReady = false
 
MusicId currentMusicTrack = MUSIC_INVALID
 
float uMasterVolume = 0
 
float uMusicVolume = 0
 
float uVoiceVolume = 0
 
PAudioTrack pCurrentMusicTrack
 
AudioSamplePool _voiceSoundPool = AudioSamplePool(false)
 
AudioSamplePool _regularSoundPool = AudioSamplePool(false)
 
AudioSamplePool _loopingSoundPool = AudioSamplePool(true)
 
PAudioSample _currentWalkingSample
 
SndReader _sndReader
 

Constructor & Destructor Documentation

◆ AudioPlayer()

AudioPlayer::AudioPlayer ( )
default

◆ ~AudioPlayer()

AudioPlayer::~AudioPlayer ( )
virtualdefault

Member Function Documentation

◆ getSoundLength()

float AudioPlayer::getSoundLength ( SoundId  eSoundID)

Returns length of sound in seconds.

Parameters
eSoundIDID of sound.

◆ Initialize()

void AudioPlayer::Initialize ( )

◆ isWalkingSoundPlays()

bool AudioPlayer::isWalkingSoundPlays ( )

◆ LoadSound()

Blob AudioPlayer::LoadSound ( std::string_view  pSoundName)

◆ loadSoundDataSource()

bool AudioPlayer::loadSoundDataSource ( SoundInfo si)

Checks that data source has been populated and if not loads it into SoundInfo. Returns true on success

Parameters
siSoundInfo to be loaded

◆ MusicPause()

void AudioPlayer::MusicPause ( )

◆ MusicPlayTrack()

void AudioPlayer::MusicPlayTrack ( MusicId  eTrack)

◆ MusicResume()

void AudioPlayer::MusicResume ( )

◆ MusicStart()

void AudioPlayer::MusicStart ( )

◆ MusicStop()

void AudioPlayer::MusicStop ( )

◆ pauseAllSounds()

void AudioPlayer::pauseAllSounds ( )

◆ pauseLooping()

void AudioPlayer::pauseLooping ( )

◆ playExclusiveSound()

void AudioPlayer::playExclusiveSound ( SoundId  id)
inline

Play sound in exclusive mode. It means that if sound with the same ID has not finished playing it's playing be stopped and then restarted from beginning.

Parameters
idID of sound.

◆ playHouseSound()

void AudioPlayer::playHouseSound ( SoundId  id,
bool  isSpeech 
)
inline

Play sound of houses. To avoid multiple sounds when entering/leaving repeatedly sounds needs to be stopped.

Parameters
idID of sound.
isSpeechtrue if this is house greet/goodbye speech. false if this is entering/cloosing UI sound.

◆ playNonResetableSound()

void AudioPlayer::playNonResetableSound ( SoundId  id)
inline

Play sound in non-resetable mode. It means that if sound with the same ID has not finished playing, this call is effectively ignored. New playing of such sound can only start when previous one has finished playing.

Parameters
idID of sound.

◆ playSound()

void AudioPlayer::playSound ( SoundId  eSoundID,
SoundPlaybackMode  mode,
Pid  pid = Pid() 
)

Play sound.

Parameters
eSoundIDID of sound.
modePlayback mode.
pidPid of sound source.

◆ playSpellSound()

void AudioPlayer::playSpellSound ( SpellId  spell,
bool  is_impact,
SoundPlaybackMode  mode,
Pid  pid = Pid() 
)

Play sound of spell casting or spell sprite impact.

Parameters
spellSpell ID of spell. Indexes into SpellSoundIds.
is_impactIndicates sound of spell impact, if true sound ID will be SpellSoundIds[spell] + 1.
modePlayback mode.
pidPid of sound originator. See playSound description.

◆ playUISound()

void AudioPlayer::playUISound ( SoundId  id)
inline

Play generic UI sound. Generic sounds are played in non-exclusive mode - it meand that each call to this function will play sound even if sound with the same ID has not finished playing.

Parameters
idID of sound.

◆ playWalkSound()

void AudioPlayer::playWalkSound ( SoundId  id)
inline

Play sound of party walking. Semantics generally is the same as for exclusive sounds but with additional tracking to stop walking sound when needed.

Parameters
idID of sound.

◆ resumeSounds()

void AudioPlayer::resumeSounds ( )

◆ SetMasterVolume()

void AudioPlayer::SetMasterVolume ( int  level)

◆ SetMusicVolume()

void AudioPlayer::SetMusicVolume ( int  level)

◆ SetVoiceVolume()

void AudioPlayer::SetVoiceVolume ( int  level)

◆ soundDrain()

void AudioPlayer::soundDrain ( )

◆ stopSounds()

void AudioPlayer::stopSounds ( )

◆ stopVoiceSounds()

void AudioPlayer::stopVoiceSounds ( )

◆ stopWalkingSounds()

void AudioPlayer::stopWalkingSounds ( )

◆ UpdateSounds()

void AudioPlayer::UpdateSounds ( )

◆ UpdateVolumeFromConfig()

void AudioPlayer::UpdateVolumeFromConfig ( )

Member Data Documentation

◆ _currentWalkingSample

PAudioSample AudioPlayer::_currentWalkingSample
protected

◆ _loopingSoundPool

AudioSamplePool AudioPlayer::_loopingSoundPool = AudioSamplePool(true)
protected

◆ _regularSoundPool

AudioSamplePool AudioPlayer::_regularSoundPool = AudioSamplePool(false)
protected

◆ _sndReader

SndReader AudioPlayer::_sndReader
protected

◆ _voiceSoundPool

AudioSamplePool AudioPlayer::_voiceSoundPool = AudioSamplePool(false)
protected

◆ bPlayerReady

bool AudioPlayer::bPlayerReady = false
protected

◆ currentMusicTrack

MusicId AudioPlayer::currentMusicTrack = MUSIC_INVALID
protected

◆ pCurrentMusicTrack

PAudioTrack AudioPlayer::pCurrentMusicTrack
protected

◆ uMasterVolume

float AudioPlayer::uMasterVolume = 0
protected

◆ uMusicVolume

float AudioPlayer::uMusicVolume = 0
protected

◆ uVoiceVolume

float AudioPlayer::uVoiceVolume = 0
protected

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