Emergency 20 Dokumentation  4.2.0
em5::AudioProxy Class Reference

Extended audio proxy for easier multiplay usage. More...

#include <AudioProxy.h>

Inheritance diagram for em5::AudioProxy:
qsf::AudioProxy

Public Member Functions

 AudioProxy ()
 Default constructor. More...
 
virtual ~AudioProxy ()
 Destructor. More...
 
void synchronizeWithMultiplay (bool onlyDataUpdate=false)
 Initiates a synchronization with the multiplay code (to synchronize the audio to the multiplayer clients) More...
 
const uint32 getId () const
 Returns the id of this audio proxy. More...
 
- Public Member Functions inherited from qsf::AudioProxy
 AudioProxy ()
 Default constructor. More...
 
AudioProxyasset (const AssetProxy &sfxAsset)
 Switches the proxy to another asset. If there is currently a SFX instance handled by the proxy, it will be stopped and destroyed. More...
 
AudioProxysourceFile (const std::string &sfxFilename)
 Switches the proxy to another source file. If there is currently a SFX instance handled by the proxy, it will be stopped and destroyed. More...
 
AudioProxycontextEntity (Entity &contextEntity)
 Switches the context entity. If there is currently a SFX instance handled by the proxy, it will be re-attached to the new entity. It will not stop playing and it will not be destroyed. More...
 
AudioProxycontextFree ()
 Changes the SFX to be context-free. If there is currently a SFX playing, it will be detached from the previous context entity if there was any. It will then be free and you can control it manually. More...
 
bool isPlaying () const
 Checks if there is any audio source playing currently. More...
 
bool isPaused () const
 Checks if there is any audio source currently paused. More...
 
bool isStopped () const
 Checks if there is any audio source currently stopped. More...
 
AudioProxyplay ()
 Plays a SFX with the current configuration. If there still is a SFX managed by the proxy, it will be "continued" if it has been paused or just keep playing. To restart the SFX,. More...
 
AudioProxyplayDelayed (const Time &delay)
 Plays a SFX with the current configuration after a delay. More...
 
AudioProxyrestart ()
 Restarts the currently playing SFX. More...
 
AudioProxypause ()
 Pause the audio source playback. More...
 
AudioProxystop ()
 Stops playback of the previous started SFX. More...
 
AudioProxyloop ()
 Changes the currently playing source to looping mode. Don't detach a source that is looping! It will never be collected. More...
 
AudioProxyoneShot ()
 Changes the currently playing source to one-shot mode. In one-shot mode, the source is only played once. It is safe to detach from one-shot SFX. More...
 
AudioProxyvolume (float newVolume)
 Changes the volume of the currently played SFX. More...
 
float getVolume () const
 
AudioProxypitch (float newPitch)
 Changes the pitch of the currently played SFX. More...
 
AudioProxyposition (const glm::vec3 &position)
 Changes the position of playback source. For spatial sounds, this is an absolute position in world space. For non-spatial sounds, the position is in listener space, i.e. always relative to the listener (it will move and rotate with it). So this is perfect to align 3D sources in the world or to do panning of 2D stereo/mono sounds. More...
 
AudioProxyrollOffFactor (float factor)
 Changes the roll-off factor of the sound which is used to attenuate the sound based on the distance to the listener. More...
 
AudioProxyreferenceDistance (float distance)
 Changes the reference listener distance of the sound. This is the distance where the source volume would normally drop to half before being attenuated by the rolloff factor or maximum distance. More...
 
AudioProxymaximumDistance (float maximumDistance)
 Changes the maximum listener distance at which the source will no longer be attenuated. More...
 
AudioProxyspatial ()
 Switches the source to be spatial. This means it is placed in 3D space relative to the listener. More...
 
AudioProxyabsolute ()
 Switches source to absolute (i.e. 2D) playback mode. More...
 
AudioProxychannel (uint32 channelIndex)
 Changes the mixer channel the SFX is routed to. More...
 
AudioProxydetach ()
 Detaches the previously started source. This means you will no longer have access to the source and it will continue to play and when done, it will be automatically destroyed. More...
 
AudioProxystream ()
 Indicates that the next playback buffer should be streamed. More...
 
AudioProxyinMemory ()
 Indicates that the next playback buffer should be loaded into memory. More...
 
AudioProxystartVolumeFade (float targetVolume, const Time &duration, bool stopWhenFinished)
 Starts to fade the audio source volume over time. More...
 
AudioProxycancelVolumeFade ()
 Cancels any currently running volume fade. More...
 
AudioSourcegetCurrentlyManagedAudioSource ()
 Lets you access the underlying audio source which is currently playing. More...
 

Protected Member Functions

virtual void onPlay () override
 Gets called when a user of this class calls play() or playDelayed() More...
 
virtual void onStop () override
 Gets called when a user of this class calls stop() More...
 
virtual void onContextChanged (qsf::Entity *contextEntity) override
 Gets called when a user of this class calls contextFree() or contextEntity() More...
 
virtual void onDetach () override
 Gets called when a user of this class calls detach() More...
 
- Protected Member Functions inherited from qsf::AudioProxy
const TimegetDelayTime () const
 
const uint32 getChannel () const
 
const bool isSpartial () const
 
const bool isAbsolute () const
 
const bool isLooping () const
 
const AssetProxygetAssetProxy ()
 
const std::string & getFileName () const
 

Detailed Description

Extended audio proxy for easier multiplay usage.

Constructor & Destructor Documentation

em5::AudioProxy::AudioProxy ( )

Default constructor.

virtual em5::AudioProxy::~AudioProxy ( )
virtual

Destructor.

Reimplemented from qsf::AudioProxy.

Member Function Documentation

const uint32 em5::AudioProxy::getId ( ) const

Returns the id of this audio proxy.

virtual void em5::AudioProxy::onContextChanged ( qsf::Entity entity)
overrideprotectedvirtual

Gets called when a user of this class calls contextFree() or contextEntity()

Reimplemented from qsf::AudioProxy.

virtual void em5::AudioProxy::onDetach ( )
overrideprotectedvirtual

Gets called when a user of this class calls detach()

Reimplemented from qsf::AudioProxy.

virtual void em5::AudioProxy::onPlay ( )
overrideprotectedvirtual

Gets called when a user of this class calls play() or playDelayed()

Reimplemented from qsf::AudioProxy.

virtual void em5::AudioProxy::onStop ( )
overrideprotectedvirtual

Gets called when a user of this class calls stop()

Reimplemented from qsf::AudioProxy.

void em5::AudioProxy::synchronizeWithMultiplay ( bool  onlyDataUpdate = false)

Initiates a synchronization with the multiplay code (to synchronize the audio to the multiplayer clients)

Parameters
[in]onlyDataUpdateIndicates if we should do only an data update (e.g. looping or context entity changed while playing) but no start/stop is handled with this
Note
This method does nothing, when not in multiplayer context

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