Harmonic Flow Framework (libhffwk)
Cross platform C++ 2D Game Engine Framework
Public Types | Public Member Functions | List of all members
HFCore::SoundPlayer Class Referenceabstract

Interface for playing Sound's and Music streams. More...

#include <SoundPlayer.h>

Public Types

typedef std::vector< SoundPlayerListener * > SoundPlayerListenerVector
 typedef for Vector holding SoundPlayerListener pointers.
 

Public Member Functions

 SoundPlayer ()
 Constructor.
 
virtual ~SoundPlayer ()
 Destructor.
 
virtual HF_AudioDeviceID openAudioDevice (const int8_hf *device, HF_AudioRate rate, HF_AudioFormat format, HF_AudioChannels channels, HF_AudioBufferSize bufferSize)=0
 Use this function to open a specific audio device. More...
 
virtual void closeAudioDevice (HF_AudioDeviceID dev)=0
 Use this function to shut down audio processing and close the audio device. More...
 
virtual void setAudioDeviceCallbackEnabled (HF_AudioDeviceID dev, bool enabled)=0
 Use this function to enable or disable audio playback on a specified device. More...
 
virtual void lockAudioDevice (HF_AudioDeviceID dev)=0
 Use this function to lock out the audio callback function for a specified device. More...
 
virtual void unlockAudioDevice (HF_AudioDeviceID dev)=0
 Use this function to unlock the audio callback function for a specified device. More...
 
virtual void addListener (SoundPlayerListener *listener)=0
 Add a new listener class to receive SoundPlayerListener callbacks. More...
 
virtual void removeListener (SoundPlayerListener *listener)=0
 Remove a listener class from receiving further SoundPlayerListener callbacks. More...
 
virtual int32_hf getNumAudioDrivers ()=0
 Use this function to return the number of built in audio drivers. More...
 
virtual std::string getAudioDriverName (int32_hf index)=0
 Use this function to get the name of a built in audio driver. More...
 
virtual std::string getCurrentAudioDriverName ()=0
 Use this function to return the name of the current audio driver. More...
 
virtual int32_hf getNumAudioDevices ()=0
 Use this function to return the number of built in audio devices. More...
 
virtual std::string getAudioDeviceName (int32_hf index)=0
 Use this function to get the name of a specific audio device. More...
 
virtual HF_AudioStatus getAudioDeviceStatus (HF_AudioDeviceID dev)=0
 Use this function to get the current audio state of an audio device. More...
 
virtual HF_MusicType getMusicType (const std::string &fileName)=0
 Get the HF_MusicType enum value for given fileName. More...
 
virtual bool loadSound (Sound *sound)=0
 Load a Sound. More...
 
virtual SoundloadSound (const std::string &fileName)=0
 Load a Sound. More...
 
virtual void unloadSound (Sound *sound)=0
 Unload a Sound. More...
 
virtual void playSound (Sound *sound, bool loop)=0
 Play a Sound. More...
 
virtual void fadeInSound (Sound *sound, uint32_hf durationMS, bool loop)=0
 Fade in Sound for durationMS. More...
 
virtual void fadeOutSound (Sound *sound, uint32_hf durationMS)=0
 Fade out Sound for durationMS. More...
 
virtual void stopSound (Sound *sound)=0
 Stop Sound. More...
 
virtual void pauseSound (Sound *sound)=0
 Pause Sound. More...
 
virtual void resumeSound (Sound *sound)=0
 Resume Sound. More...
 
virtual bool isSoundPlaying (Sound *sound)=0
 Determines whether Sound currently is playing. More...
 
virtual bool isSoundPaused (Sound *sound)=0
 Determines whether Sound currently is paused. More...
 
virtual bool isSoundStopped (Sound *sound)=0
 Determines whether Sound currently is stopped. More...
 
virtual bool isSoundFading (Sound *sound)=0
 Determines whether Sound currently is fading in or out. More...
 
virtual bool loadMusic (int32_hf musicID, const UString &musicFileName)=0
 Load a music stream. More...
 
virtual void unloadMusic (int32_hf musicID)=0
 Unload a music stream. More...
 
virtual void playMusic (int32_hf musicID, bool loop)=0
 Play music stream. More...
 
virtual void playMusic (int32_hf musicID, const UString &musicFileName, bool loop)=0
 Load and play music stream. More...
 
virtual void fadeInMusic (int32_hf musicID, uint32_hf durationMS, bool loop)=0
 Fade in music stream for durationMS. More...
 
virtual void fadeInMusic (int32_hf musicID, const UString &musicFileName, uint32_hf durationMS, bool loop)=0
 Load and fade in music stream for durationMS. More...
 
virtual void fadeOutMusic (int32_hf musicID, uint32_hf durationMS)=0
 Fade out music stream for durationMS. More...
 
virtual void stopMusic (int32_hf musicID)=0
 Stop music stream. More...
 
virtual void pauseMusic (int32_hf musicID)=0
 Pause music stream. More...
 
virtual void resumeMusic (int32_hf musicID)=0
 Resume music stream. More...
 
virtual bool isMusicPlaying (int32_hf musicID)=0
 Determines whether music stream currently is playing. More...
 
virtual bool isMusicPaused (int32_hf musicID)=0
 Determines whether music stream currently is paused. More...
 
virtual bool isMusicStopped (int32_hf musicID)=0
 Determines whether music stream currently is stopped. More...
 
virtual bool isMusicFading (int32_hf musicID)=0
 Determines whether music stream currently is fading in or out. More...
 
virtual void setSoundVolume (fp32_hf volume)=0
 Set volume for all Sound's in the range 0.0f - 1.0f. More...
 
virtual fp32_hf getSoundVolume ()=0
 Get Sound volume. More...
 
virtual void setSoundVolume (Sound *sound, fp32_hf volume)=0
 Set volume for given Sound in the range 0.0f - 1.0f. More...
 
virtual fp32_hf getSoundVolume (Sound *sound)=0
 Get Sound volume. More...
 
virtual void setMusicVolume (fp32_hf volume)=0
 Set music stream volume in the range 0.0f - 1.0f. More...
 
virtual fp32_hf getMusicVolume ()=0
 Get music stream volume. More...
 
virtual void setMusicVolume (int32_hf musicID, fp32_hf volume)=0
 Set music stream volume in the range 0.0f - 1.0f. More...
 
virtual fp32_hf getMusicVolume (int32_hf musicID)=0
 Get music stream volume. More...
 
virtual bool toggleMute ()=0
 Toggle all audio mute. More...
 
virtual bool isMuted ()=0
 Determines if audio currently is muted. More...
 
virtual fp32_hf getLastMusicVolume ()=0
 Get the last known music volume. More...
 
virtual fp32_hf getLastSoundVolume ()=0
 Get the last known Sound volume. More...
 
virtual void setPlayList (int32_hf musicID, StringUtil::WStringVector &vPlayListFilesFullPath, StringUtil::WStringVector &vPlayListFiles)=0
 Set vector of files for playlist. More...
 
virtual bool isPlayListInitiated ()=0
 Determines if playlist is initiated. Playlist is initiated if setPlayList() succeeds. More...
 
virtual bool isPlaylistStopped ()=0
 Determines if playlist has status stopped. More...
 
virtual bool isPlaylistPlaying ()=0
 Determines if playlist has status playing. More...
 
virtual void clearPlayList ()=0
 Clear the playlist.
 
virtual std::wstring & getCurrentFileName ()=0
 Get playlist full path of current file name. More...
 
virtual std::wstring & getCurrentSongName ()=0
 Get playlist song name or file name only. More...
 
virtual void playListPlay ()=0
 Play current file in playlist.
 
virtual void playListStop ()=0
 Stop playlist.
 
virtual void playListPause ()=0
 Pause playlist.
 
virtual void playListNext ()=0
 Play next file in the playlist.
 
virtual void playListPrev ()=0
 Play previous file in the playlist.
 
virtual void update ()=0
 Called by the framework once for every iteration of the game loop, immediately before rendering takes place.
 

Detailed Description

Interface for playing Sound's and Music streams.

During engine initialization phase default audio device is automatically opened using openAudioDevice(). This means that you generally don't need to call openAudioDevice() as it's done for you during engine init. Use openAudioDevice() only if you need to open several audio devices for output!

closeAudioDevice() is automatically called during engine clean-up for the default device opened during engine init phase.

Use Environment::getAudioDeviceID() to retrieve audio device id of the default device opened during engine init phase!

See SoundPlayerListener for methods available as callbacks for registered listeners.

Example code:

// Set global Sound volume:
HFCORE_SOUND->setSoundVolume(0.8f);
// Set global music stream volume:
HFCORE_SOUND->setMusicVolume(1.0f);
// load 'stream1.ogg' and use music channel id 0:
HFCORE_SOUND->loadMusic(0, "data/music/stream1.ogg");
// fade in the stream for a duration of 800 milliseconds and make sure it loops:
HFCORE_SOUND->fadeInMusic(0, 800, true);
// sound sfx are usually loaded from resource file:
HFCore::Sound *snd = HFCORE_RESMGR->getSound("SFX_LASER_001");
// .. or load it via HFCore::SoundPlayer:
HFCore::Sound *snd = HFCORE_SOUND->loadSound("data/sfx/laser_001.ogg");
// play sound sfx:
HFCORE_SOUND->playSound(snd);
// .. etc.

Definition at line 82 of file SoundPlayer.h.

Member Function Documentation

◆ addListener()

virtual void HFCore::SoundPlayer::addListener ( SoundPlayerListener listener)
pure virtual

Add a new listener class to receive SoundPlayerListener callbacks.

Parameters
listenerClass to add as listener.
See also
removeListener()

◆ closeAudioDevice()

virtual void HFCore::SoundPlayer::closeAudioDevice ( HF_AudioDeviceID  dev)
pure virtual

Use this function to shut down audio processing and close the audio device.

closeAudioDevice() is automatically called during engine clean-up for the default device opened during engine init phase.

Parameters
devAudio device to close.
See also
openAudioDevice()

◆ fadeInMusic() [1/2]

virtual void HFCore::SoundPlayer::fadeInMusic ( int32_hf  musicID,
uint32_hf  durationMS,
bool  loop 
)
pure virtual

Fade in music stream for durationMS.

Parameters
musicIDID of music stream.
durationMSFade duration in milliseconds.
looptrue to loop, else false.

◆ fadeInMusic() [2/2]

virtual void HFCore::SoundPlayer::fadeInMusic ( int32_hf  musicID,
const UString musicFileName,
uint32_hf  durationMS,
bool  loop 
)
pure virtual

Load and fade in music stream for durationMS.

Parameters
musicIDID of music stream.
musicFileNameFile name to load.
durationMSFade duration in milliseconds.
looptrue to loop, else false.

◆ fadeInSound()

virtual void HFCore::SoundPlayer::fadeInSound ( Sound sound,
uint32_hf  durationMS,
bool  loop 
)
pure virtual

Fade in Sound for durationMS.

Parameters
soundSound to play.
durationMSFade duration in milliseconds.
looptrue to loop, else false.

◆ fadeOutMusic()

virtual void HFCore::SoundPlayer::fadeOutMusic ( int32_hf  musicID,
uint32_hf  durationMS 
)
pure virtual

Fade out music stream for durationMS.

Parameters
musicIDID of music stream.
durationMSFade duration in milliseconds.

◆ fadeOutSound()

virtual void HFCore::SoundPlayer::fadeOutSound ( Sound sound,
uint32_hf  durationMS 
)
pure virtual

Fade out Sound for durationMS.

Parameters
soundSound to play.
durationMSFade duration in milliseconds.

◆ getAudioDeviceName()

virtual std::string HFCore::SoundPlayer::getAudioDeviceName ( int32_hf  index)
pure virtual

Use this function to get the name of a specific audio device.

Parameters
indexThe index of the audio driver; the value ranges from 0 to getNumAudioDevices() - 1
Returns
The name of a specific audio device.
See also
getNumAudioDevices()

◆ getAudioDeviceStatus()

virtual HF_AudioStatus HFCore::SoundPlayer::getAudioDeviceStatus ( HF_AudioDeviceID  dev)
pure virtual

Use this function to get the current audio state of an audio device.

Parameters
devAudio device to check audio state for.
Returns
The current audio state of given audio device.

◆ getAudioDriverName()

virtual std::string HFCore::SoundPlayer::getAudioDriverName ( int32_hf  index)
pure virtual

Use this function to get the name of a built in audio driver.

Parameters
indexThe index of the audio driver; the value ranges from 0 to getNumAudioDrivers() - 1
Returns
Returns the name of the audio driver at the requested index, or NULL if an invalid index was specified.
See also
getNumAudioDrivers()
getCurrentAudioDriverName()

◆ getCurrentAudioDriverName()

virtual std::string HFCore::SoundPlayer::getCurrentAudioDriverName ( )
pure virtual

Use this function to return the name of the current audio driver.

Returns
The name of the current audio driver.
See also
getNumAudioDrivers()
getAudioDriverName()

◆ getCurrentFileName()

virtual std::wstring& HFCore::SoundPlayer::getCurrentFileName ( )
pure virtual

Get playlist full path of current file name.

Returns
Full path of current file name.

◆ getCurrentSongName()

virtual std::wstring& HFCore::SoundPlayer::getCurrentSongName ( )
pure virtual

Get playlist song name or file name only.

Returns
Song name of file name only.

◆ getLastMusicVolume()

virtual fp32_hf HFCore::SoundPlayer::getLastMusicVolume ( )
pure virtual

Get the last known music volume.

Returns
The last known music volume.
See also
getLastSoundVolume()

◆ getLastSoundVolume()

virtual fp32_hf HFCore::SoundPlayer::getLastSoundVolume ( )
pure virtual

Get the last known Sound volume.

Returns
The last known Sound volume.
See also
getLastMusicVolume()

◆ getMusicType()

virtual HF_MusicType HFCore::SoundPlayer::getMusicType ( const std::string &  fileName)
pure virtual

Get the HF_MusicType enum value for given fileName.

Parameters
fileNameFile name to check music type for.
Returns
The HF_MusicType enum value for given fileName.

◆ getMusicVolume() [1/2]

virtual fp32_hf HFCore::SoundPlayer::getMusicVolume ( )
pure virtual

Get music stream volume.

Returns
Music stream volume.
See also
setMusicVolume()

◆ getMusicVolume() [2/2]

virtual fp32_hf HFCore::SoundPlayer::getMusicVolume ( int32_hf  musicID)
pure virtual

Get music stream volume.

Parameters
musicIDID of the music stream.
Returns
Music stream volume.
See also
setMusicVolume()

◆ getNumAudioDevices()

virtual int32_hf HFCore::SoundPlayer::getNumAudioDevices ( )
pure virtual

Use this function to return the number of built in audio devices.

Returns
The number of built in audio devices.
See also
getAudioDeviceName()

◆ getNumAudioDrivers()

virtual int32_hf HFCore::SoundPlayer::getNumAudioDrivers ( )
pure virtual

Use this function to return the number of built in audio drivers.

Returns
The number of built in audio drivers.
See also
getAudioDriverName()
getCurrentAudioDriverName()

◆ getSoundVolume() [1/2]

virtual fp32_hf HFCore::SoundPlayer::getSoundVolume ( )
pure virtual

Get Sound volume.

Returns
Sound volume.
See also
setSoundVolume()

◆ getSoundVolume() [2/2]

virtual fp32_hf HFCore::SoundPlayer::getSoundVolume ( Sound sound)
pure virtual

Get Sound volume.

Parameters
soundSound to get volume for.
Returns
Sound volume.
See also
setSoundVolume()

◆ isMusicFading()

virtual bool HFCore::SoundPlayer::isMusicFading ( int32_hf  musicID)
pure virtual

Determines whether music stream currently is fading in or out.

Parameters
musicIDID of music stream.
Returns
true if fading in / out, else false.

◆ isMusicPaused()

virtual bool HFCore::SoundPlayer::isMusicPaused ( int32_hf  musicID)
pure virtual

Determines whether music stream currently is paused.

Parameters
musicIDID of music stream.
Returns
true if paused, else false.

◆ isMusicPlaying()

virtual bool HFCore::SoundPlayer::isMusicPlaying ( int32_hf  musicID)
pure virtual

Determines whether music stream currently is playing.

Parameters
musicIDID of music stream.
Returns
true if playing, else false.

◆ isMusicStopped()

virtual bool HFCore::SoundPlayer::isMusicStopped ( int32_hf  musicID)
pure virtual

Determines whether music stream currently is stopped.

Parameters
musicIDID of music stream.
Returns
true if stopped, else false.

◆ isMuted()

virtual bool HFCore::SoundPlayer::isMuted ( )
pure virtual

Determines if audio currently is muted.

Returns
true if currently muted, else false.
See also
toggleMute()

◆ isPlayListInitiated()

virtual bool HFCore::SoundPlayer::isPlayListInitiated ( )
pure virtual

Determines if playlist is initiated. Playlist is initiated if setPlayList() succeeds.

Returns
true if initiated, else false.

◆ isPlaylistPlaying()

virtual bool HFCore::SoundPlayer::isPlaylistPlaying ( )
pure virtual

Determines if playlist has status playing.

Returns
true if playing, else false.

◆ isPlaylistStopped()

virtual bool HFCore::SoundPlayer::isPlaylistStopped ( )
pure virtual

Determines if playlist has status stopped.

Returns
true if stopped, else false.

◆ isSoundFading()

virtual bool HFCore::SoundPlayer::isSoundFading ( Sound sound)
pure virtual

Determines whether Sound currently is fading in or out.

Parameters
soundSound to query status for.
Returns
true if fading in / out, else false.

◆ isSoundPaused()

virtual bool HFCore::SoundPlayer::isSoundPaused ( Sound sound)
pure virtual

Determines whether Sound currently is paused.

Parameters
soundSound to query status for.
Returns
true if paused, else false.

◆ isSoundPlaying()

virtual bool HFCore::SoundPlayer::isSoundPlaying ( Sound sound)
pure virtual

Determines whether Sound currently is playing.

Parameters
soundSound to query status for.
Returns
true if playing, else false.

◆ isSoundStopped()

virtual bool HFCore::SoundPlayer::isSoundStopped ( Sound sound)
pure virtual

Determines whether Sound currently is stopped.

Parameters
soundSound to query status for.
Returns
true if stopped, else false.

◆ loadMusic()

virtual bool HFCore::SoundPlayer::loadMusic ( int32_hf  musicID,
const UString musicFileName 
)
pure virtual

Load a music stream.

Parameters
musicIDID to use for loaded music stream.
musicFileNameFile name to load.
Returns
true if success, else false.
See also
unloadMusic()

◆ loadSound() [1/2]

virtual bool HFCore::SoundPlayer::loadSound ( Sound sound)
pure virtual

Load a Sound.

Parameters
soundSound to load.
Returns
true if success, else false.
See also
unloadSound()

◆ loadSound() [2/2]

virtual Sound* HFCore::SoundPlayer::loadSound ( const std::string &  fileName)
pure virtual

Load a Sound.

Parameters
fileNameFile name to load.
Returns
The Sound if success, else NULL.
See also
unloadSound()

◆ lockAudioDevice()

virtual void HFCore::SoundPlayer::lockAudioDevice ( HF_AudioDeviceID  dev)
pure virtual

Use this function to lock out the audio callback function for a specified device.

The lock manipulated by these functions protects the audio callback function specified in openAudioDevice(). During a lockAudioDevice() / unlockAudioDevice() pair, you can be guaranteed that the callback function for that device is not running, even if the device is not paused. While a device is locked, any other unpaused, unlocked devices may still run their callbacks.

You should not hold the lock longer than absolutely necessary. If you hold it too long, you'll experience dropouts in your audio playback. Ideally, your application locks the device, sets a few variables and unlocks again. Do not do heavy work while holding the lock for a device.

It is safe to lock the audio device multiple times, as long as you unlock it an equivalent number of times. The callback will not run until the device has been unlocked completely in this way. If your application fails to unlock the device appropriately, your callback will never run, you might hear repeating bursts of audio, and closeAudioDevice() will probably deadlock.

Internally, the audio device lock is a mutex; if you lock from two threads at once, not only will you block the audio callback, you'll block the other thread.

Parameters
devHF_AudioDeviceID to lock.
See also
unlockAudioDevice()

◆ openAudioDevice()

virtual HF_AudioDeviceID HFCore::SoundPlayer::openAudioDevice ( const int8_hf device,
HF_AudioRate  rate,
HF_AudioFormat  format,
HF_AudioChannels  channels,
HF_AudioBufferSize  bufferSize 
)
pure virtual

Use this function to open a specific audio device.

During engine initialization phase default audio device is automatically opened using openAudioDevice(). This means that you generally don't need to call openAudioDevice() as it's done for you during engine init. Use openAudioDevice() only if you need to open several audio devices for output!

Use Environment::getAudioDeviceID() to retrieve audio device id of the default device opened during engine init phase!

Parameters
deviceA UTF-8 string reported by getAudioDeviceName(). Passing in a device name of NULL requests the most reasonable default.
rateAudio rate / frequency to use.
formatAudio format to use (signed 16 bit, unsigned 16 bit etc. See HF_AudioFormat for more information about all available formats).
channelsAudio channels to use.
bufferSizeAudio buffer size in bytes to use.
Returns
HF_AudioDeviceID for the opened audio device.
See also
closeAudioDevice()

◆ pauseMusic()

virtual void HFCore::SoundPlayer::pauseMusic ( int32_hf  musicID)
pure virtual

Pause music stream.

Parameters
musicIDID of music stream.

◆ pauseSound()

virtual void HFCore::SoundPlayer::pauseSound ( Sound sound)
pure virtual

Pause Sound.

Parameters
soundSound to pause.

◆ playMusic() [1/2]

virtual void HFCore::SoundPlayer::playMusic ( int32_hf  musicID,
bool  loop 
)
pure virtual

Play music stream.

Parameters
musicIDID of music stream.
looptrue to loop, else false.

◆ playMusic() [2/2]

virtual void HFCore::SoundPlayer::playMusic ( int32_hf  musicID,
const UString musicFileName,
bool  loop 
)
pure virtual

Load and play music stream.

Parameters
musicIDID of music stream.
musicFileNameFile name to load.
looptrue to loop, else false.

◆ playSound()

virtual void HFCore::SoundPlayer::playSound ( Sound sound,
bool  loop 
)
pure virtual

Play a Sound.

Parameters
soundSound to play.
looptrue to loop, else false.

◆ removeListener()

virtual void HFCore::SoundPlayer::removeListener ( SoundPlayerListener listener)
pure virtual

Remove a listener class from receiving further SoundPlayerListener callbacks.

Parameters
listenerClass to remove as listener.
See also
addListener()

◆ resumeMusic()

virtual void HFCore::SoundPlayer::resumeMusic ( int32_hf  musicID)
pure virtual

Resume music stream.

Parameters
musicIDID of music stream.

◆ resumeSound()

virtual void HFCore::SoundPlayer::resumeSound ( Sound sound)
pure virtual

Resume Sound.

Parameters
soundSound to resume.

◆ setAudioDeviceCallbackEnabled()

virtual void HFCore::SoundPlayer::setAudioDeviceCallbackEnabled ( HF_AudioDeviceID  dev,
bool  enabled 
)
pure virtual

Use this function to enable or disable audio playback on a specified device.

After a audio device is successfully opened with openAudioDevice() a call to setAudioDeviceCallbackEnabled() is done automatically so that device start receive callbacks.

Parameters
devHF_AudioDeviceID to enable or disable playback for.
enabledtrue to enable audio playback, else false.

◆ setMusicVolume() [1/2]

virtual void HFCore::SoundPlayer::setMusicVolume ( fp32_hf  volume)
pure virtual

Set music stream volume in the range 0.0f - 1.0f.

Parameters
volumeVolume to set in the range 0.0f - 1.0f.
See also
getMusicVolume()

◆ setMusicVolume() [2/2]

virtual void HFCore::SoundPlayer::setMusicVolume ( int32_hf  musicID,
fp32_hf  volume 
)
pure virtual

Set music stream volume in the range 0.0f - 1.0f.

Parameters
musicIDID of the music stream.
volumeVolume to set in the range 0.0f - 1.0f.
See also
getMusicVolume()

◆ setPlayList()

virtual void HFCore::SoundPlayer::setPlayList ( int32_hf  musicID,
StringUtil::WStringVector vPlayListFilesFullPath,
StringUtil::WStringVector vPlayListFiles 
)
pure virtual

Set vector of files for playlist.

Parameters
musicIDID to use for this playlist.
vPlayListFilesFullPathVector containing file names only.
vPlayListFilesVector containing full file paths.

◆ setSoundVolume() [1/2]

virtual void HFCore::SoundPlayer::setSoundVolume ( fp32_hf  volume)
pure virtual

Set volume for all Sound's in the range 0.0f - 1.0f.

Parameters
volumeVolume to set in the range 0.0f - 1.0f.
See also
getSoundVolume()

◆ setSoundVolume() [2/2]

virtual void HFCore::SoundPlayer::setSoundVolume ( Sound sound,
fp32_hf  volume 
)
pure virtual

Set volume for given Sound in the range 0.0f - 1.0f.

Parameters
soundSounds to set volume for.
volumeVolume to set in the range 0.0f - 1.0f.
See also
getSoundVolume()

◆ stopMusic()

virtual void HFCore::SoundPlayer::stopMusic ( int32_hf  musicID)
pure virtual

Stop music stream.

Parameters
musicIDID of music stream.

◆ stopSound()

virtual void HFCore::SoundPlayer::stopSound ( Sound sound)
pure virtual

Stop Sound.

Parameters
soundSound to stop.

◆ toggleMute()

virtual bool HFCore::SoundPlayer::toggleMute ( )
pure virtual

Toggle all audio mute.

Returns
true if currently muted, else false.
See also
isMuted()

◆ unloadMusic()

virtual void HFCore::SoundPlayer::unloadMusic ( int32_hf  musicID)
pure virtual

Unload a music stream.

Parameters
musicIDID of music stream to unload.
See also
loadMusic()

◆ unloadSound()

virtual void HFCore::SoundPlayer::unloadSound ( Sound sound)
pure virtual

Unload a Sound.

Parameters
soundSound to unload.
See also
loadSound()

◆ unlockAudioDevice()

virtual void HFCore::SoundPlayer::unlockAudioDevice ( HF_AudioDeviceID  dev)
pure virtual

Use this function to unlock the audio callback function for a specified device.

Unlocks a previous lockAudioDevice() call. Please see that function's remarks for more details.

Parameters
devHF_AudioDeviceID to unlock.
See also
lockAudioDevice()

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