My Project
Public Member Functions | Public Attributes | List of all members
ParaEngine::CAudioSource2 Class Reference

it represent an audio engine source More...

#include <AudioEngine2.h>

Inheritance diagram for ParaEngine::CAudioSource2:
ParaEngine::intrusive_ptr_single_thread_base ParaEngine::IAudioSourceEventHandler

Public Member Functions

 CAudioSource2 (const char *sName, IParaAudioSource *pSource=NULL)
 
HRESULT Stop (ParaAudioFlagsEnum dwFlags)
 stop a wave file More...
 
void SetSource (IParaAudioSource *pSource)
 reset the source. More...
 
IParaAudioSourceGetSource ()
 
void SetName (const char *sName)
 set the name
 
const std::string & GetName () const
 get the name
 
void EnableCallback (bool bEnable=true)
 this function must be called before the music is played. More...
 
bool play ()
 Plays the source with the last set parameters. More...
 
bool play2d (const bool &toLoop=false, bool bIgnoreIfPlaying=true)
 Plays the source in 2D mode. More...
 
bool play3d (const PARAVECTOR3 &position, const float &soundstr=1.0, const bool &toLoop=false)
 Plays the source in 3D mode. More...
 
void pause ()
 Pauses playback of the sound source.
 
void stop ()
 Stops playback of the sound source.
 
void loop (const bool &toLoop)
 Controls whether the source should loop or not. More...
 
bool IsAsyncLoadingWhileLoopPlaying ()
 weather it is the audio is still playing while being async loaded. More...
 
bool IsWaveFileLoopPlaying ()
 whether the file should be loop playing. More...
 
bool IsPlaying ()
 whether the file is playing or not. More...
 
virtual void onUpdate ()
 This function is called when a source updates its buffers.
 
virtual void onRelease ()
 This function is called when a source is released and soon to be deleted.
 
virtual void onPlay ()
 This function is called when a source starts playing.
 
virtual void onStop ()
 This function is called when a source stopped playback.
 
virtual void onPause ()
 This function is called when a source is paused.
 

Public Attributes

IParaAudioSourcem_pSource
 
int m_nLoopCount
 
bool m_bReleaseOnStop
 
std::string m_name
 
ParaAudioFlagsEnum m_status
 
bool m_bIsAsyncLoadingWhileLoopPlaying
 this is true, if an audio resource is being loop played but without being downloaded yet. More...
 
- Public Attributes inherited from ParaEngine::intrusive_ptr_single_thread_base
long m_ref_count
 

Additional Inherited Members

- Protected Member Functions inherited from ParaEngine::intrusive_ptr_single_thread_base
 intrusive_ptr_single_thread_base (const intrusive_ptr_single_thread_base &)
 
intrusive_ptr_single_thread_baseoperator= (const intrusive_ptr_single_thread_base &)
 

Detailed Description

it represent an audio engine source

Member Function Documentation

§ EnableCallback()

void ParaEngine::CAudioSource2::EnableCallback ( bool  bEnable = true)
inline

this function must be called before the music is played.

Otherwise you are at risk of thread-safety.

§ IsAsyncLoadingWhileLoopPlaying()

bool ParaEngine::CAudioSource2::IsAsyncLoadingWhileLoopPlaying ( )

weather it is the audio is still playing while being async loaded.

§ IsPlaying()

bool ParaEngine::CAudioSource2::IsPlaying ( )

whether the file is playing or not.

§ IsWaveFileLoopPlaying()

bool ParaEngine::CAudioSource2::IsWaveFileLoopPlaying ( )

whether the file should be loop playing.

§ loop()

void ParaEngine::CAudioSource2::loop ( const bool &  toLoop)

Controls whether the source should loop or not.

Parameters
toLoopWhether to loop (restart) the audio when the end is reached.

§ play()

bool ParaEngine::CAudioSource2::play ( )

Plays the source with the last set parameters.

Returns
True if the source is playing, false if not.

§ play2d()

bool ParaEngine::CAudioSource2::play2d ( const bool &  toLoop = false,
bool  bIgnoreIfPlaying = true 
)

Plays the source in 2D mode.

No automatic attenuation or panning will take place in this mode, but using setPosition will allow you to manually pan mono audio streams.

Parameters
toLoopWhether to loop (restart) the audio when the end is reached.
bIgnoreIfPlayingif true(default), we will only play if the audio is not currently playing.
Returns
True if the source is playing, false if not.

§ play3d()

bool ParaEngine::CAudioSource2::play3d ( const PARAVECTOR3 position,
const float &  soundstr = 1.0,
const bool &  toLoop = false 
)

Plays the source in 3D mode.

Parameters
positionPosition to start the sound off at.
soundstrAffects how the source attenuates due to distance. Higher values cause the source to stand out more over distance.
toLoopWhether to loop (restart) the audio when the end is reached.
Returns
True if the source is playing, false if not.

§ SetSource()

void ParaEngine::CAudioSource2::SetSource ( IParaAudioSource pSource)
inline

reset the source.

§ Stop()

HRESULT ParaEngine::CAudioSource2::Stop ( ParaAudioFlagsEnum  dwFlags)

stop a wave file

Parameters
szWavePathPath to the wave file.
dwFlagsFlags that affect how the wave is stopped:
  • AUDIO_FLAG_STOP_RELEASE Plays the wave to completion, then stops. For looping waves, this flag plays the current iteration to completion, then stops (ignoring any subsequent iterations). In either case, any release (or tail) is played. To stop the wave immediately, use the XACT_FLAG_STOP_IMMEDIATE flag.
  • AUDIO_FLAG_STOP_IMMEDIATE Stops the playback immediately.
Returns
Returns S_OK if successful. Otherwise, an error code.

Member Data Documentation

§ m_bIsAsyncLoadingWhileLoopPlaying

bool ParaEngine::CAudioSource2::m_bIsAsyncLoadingWhileLoopPlaying

this is true, if an audio resource is being loop played but without being downloaded yet.


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