Plasma Engine  2.0
Loading...
Searching...
No Matches
plSoundInterface Class Referenceabstract
Inheritance diagram for plSoundInterface:

Public Member Functions

virtual void LoadConfiguration (plStringView sFile)=0
 Can be called before startup to load the configs from a different file. Otherwise will automatically be loaded by the sound system startup with the default path.
 
virtual void SetOverridePlatform (plStringView sPlatform)=0
 By default the integration should auto-detect the platform (and thus the config) to use. Calling this before startup allows to override which configuration is used.
 
virtual void UpdateSound ()=0
 Has to be called once per frame to update all sounds.
 
virtual void SetMasterChannelVolume (float fVolume)=0
 Adjusts the master volume. This affects all sounds, with no exception. Value must be between 0.0f and 1.0f.
 
virtual float GetMasterChannelVolume () const =0
 
virtual void SetMasterChannelMute (bool bMute)=0
 Allows to mute all sounds. Useful for when the application goes to a background state.
 
virtual bool GetMasterChannelMute () const =0
 
virtual void SetMasterChannelPaused (bool bPaused)=0
 Allows to pause all sounds. Useful for when the application goes to a background state and you want to pause all sounds, instead of mute them.
 
virtual bool GetMasterChannelPaused () const =0
 
virtual void SetSoundGroupVolume (plStringView sVcaGroupGuid, float fVolume)=0
 Specifies the volume for a VCA ('Voltage Control Amplifier').
 
virtual float GetSoundGroupVolume (plStringView sVcaGroupGuid) const =0
 
virtual void SetNumListeners (plUInt8 uiNumListeners)=0
 Default is 1. Allows to set how many virtual listeners the sound is mixed for (split screen game play).
 
virtual plUInt8 GetNumListeners ()=0
 
virtual void SetListenerOverrideMode (bool bEnabled)=0
 The editor activates this to ignore the listener positions from the listener components, and instead use the editor camera as the listener position.
 
virtual void SetListener (plInt32 iIndex, const plVec3 &vPosition, const plVec3 &vForward, const plVec3 &vUp, const plVec3 &vVelocity)=0
 Sets the position for listener N. Index -1 is used for the override mode listener.
 
virtual plResult OneShotSound (plStringView sResourceID, const plTransform &globalPosition, float fPitch=1.0f, float fVolume=1.0f, bool bBlockIfNotLoaded=true)=0
 Plays a sound once. Callced by plSoundInterface::PlaySound().
 

Static Public Member Functions

static PL_CORE_DLL plResult PlaySound (plStringView sResourceID, const plTransform &globalPosition, float fPitch=1.0f, float fVolume=1.0f, bool bBlockIfNotLoaded=true)
 Plays a sound once.
 

Member Function Documentation

◆ GetMasterChannelMute()

virtual bool plSoundInterface::GetMasterChannelMute ( ) const
pure virtual

Implemented in plAudioSystem.

◆ GetMasterChannelPaused()

virtual bool plSoundInterface::GetMasterChannelPaused ( ) const
pure virtual

Implemented in plAudioSystem.

◆ GetMasterChannelVolume()

virtual float plSoundInterface::GetMasterChannelVolume ( ) const
pure virtual

Implemented in plAudioSystem.

◆ GetNumListeners()

virtual plUInt8 plSoundInterface::GetNumListeners ( )
pure virtual

Implemented in plAudioSystem.

◆ GetSoundGroupVolume()

virtual float plSoundInterface::GetSoundGroupVolume ( plStringView sVcaGroupGuid) const
pure virtual

Implemented in plAudioSystem.

◆ LoadConfiguration()

virtual void plSoundInterface::LoadConfiguration ( plStringView sFile)
pure virtual

Can be called before startup to load the configs from a different file. Otherwise will automatically be loaded by the sound system startup with the default path.

Implemented in plAudioSystem, and plFmod.

◆ OneShotSound()

virtual plResult plSoundInterface::OneShotSound ( plStringView sResourceID,
const plTransform & globalPosition,
float fPitch = 1.0f,
float fVolume = 1.0f,
bool bBlockIfNotLoaded = true )
pure virtual

Plays a sound once. Callced by plSoundInterface::PlaySound().

Implemented in plAudioSystem, and plFmod.

◆ PlaySound()

plResult plSoundInterface::PlaySound ( plStringView sResourceID,
const plTransform & globalPosition,
float fPitch = 1.0f,
float fVolume = 1.0f,
bool bBlockIfNotLoaded = true )
static

Plays a sound once.

Convenience function to call OneShotSound() without having to retrieve the plSoundInterface first.

Which sound to play is specified through a resource ID ('Asset GUID'). This is not the most efficient way to load a sound, as there is no way to preload the resource. If preloading is desired, you need to access the implementation-specific resource type directly (e.g. plFmodSoundEventResource). Also see plFmodSoundEventResource::PlayOnce(). In practice, though, sounds are typically loaded in bulk from sound-banks, and preloading is not necessary.

Be aware that this does not allow to adjust volume, pitch or position after creation. Stopping is also not possible. Use a sound component, if that is necessary.

Also by default a pitch of 1 is always used. If the game speed is not 1 (plWorld clock), a custom pitch would need to be provided, if the sound should play at the same speed.

◆ SetListener()

virtual void plSoundInterface::SetListener ( plInt32 iIndex,
const plVec3 & vPosition,
const plVec3 & vForward,
const plVec3 & vUp,
const plVec3 & vVelocity )
pure virtual

Sets the position for listener N. Index -1 is used for the override mode listener.

Implemented in plAudioSystem, and plFmod.

◆ SetListenerOverrideMode()

virtual void plSoundInterface::SetListenerOverrideMode ( bool bEnabled)
pure virtual

The editor activates this to ignore the listener positions from the listener components, and instead use the editor camera as the listener position.

Implemented in plAudioSystem, and plFmod.

◆ SetMasterChannelMute()

virtual void plSoundInterface::SetMasterChannelMute ( bool bMute)
pure virtual

Allows to mute all sounds. Useful for when the application goes to a background state.

Implemented in plAudioSystem, and plFmod.

◆ SetMasterChannelPaused()

virtual void plSoundInterface::SetMasterChannelPaused ( bool bPaused)
pure virtual

Allows to pause all sounds. Useful for when the application goes to a background state and you want to pause all sounds, instead of mute them.

Implemented in plAudioSystem, and plFmod.

◆ SetMasterChannelVolume()

virtual void plSoundInterface::SetMasterChannelVolume ( float fVolume)
pure virtual

Adjusts the master volume. This affects all sounds, with no exception. Value must be between 0.0f and 1.0f.

Implemented in plAudioSystem, and plFmod.

◆ SetNumListeners()

virtual void plSoundInterface::SetNumListeners ( plUInt8 uiNumListeners)
pure virtual

Default is 1. Allows to set how many virtual listeners the sound is mixed for (split screen game play).

Implemented in plAudioSystem, and plFmod.

◆ SetOverridePlatform()

virtual void plSoundInterface::SetOverridePlatform ( plStringView sPlatform)
pure virtual

By default the integration should auto-detect the platform (and thus the config) to use. Calling this before startup allows to override which configuration is used.

Implemented in plAudioSystem, and plFmod.

◆ SetSoundGroupVolume()

virtual void plSoundInterface::SetSoundGroupVolume ( plStringView sVcaGroupGuid,
float fVolume )
pure virtual

Specifies the volume for a VCA ('Voltage Control Amplifier').

This is used to control the volume of high level sound groups, such as 'Effects', 'Music', 'Ambiance' or 'Speech'. Note that the Fmod strings banks are never loaded, so the given string must be a GUID (Fmod Studio -> Copy GUID).

Implemented in plAudioSystem, and plFmod.

◆ UpdateSound()

virtual void plSoundInterface::UpdateSound ( )
pure virtual

Has to be called once per frame to update all sounds.

Implemented in plAudioSystem, and plFmod.


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