SFXXAudioVoice

Engine/source/sfx/xaudio/sfxXAudioVoice.h

More...

Data for Non-Streaming Voices

bool

Whether we have loaded our non-streaming data.

XAUDIO2_BUFFER

Audio buffer for non-streaming voice.

Sample to start playing at when seting up mNonStreamBuffer.

Public Types

Parent 

Public Friends

Protected Attributes

X3DAUDIO_EMITTER

The cached X3DAudio emitter data.

bool

Whether we have started playback.

bool

Whether the voice has stopped playing.

bool

Used to know what sounds need positional updates.

bool

Whether playback is looping.

bool

Whether playback is currently running.

CRITICAL_SECTION

Since 3D sounds are pitch shifted for doppler effect we need to track the users base pitch.

XAudio does not reset the SamplesPlayed count as is stated in the docs.

The device that created us.

IXAudio2SourceVoice *

The XAudio voice.

Protected Functions

This constructor does not create a valid voice.

Pause playback on the device.

Start playback on the device.

_seek(U32 sample)

Set the playback cursor on the device.

Return the current playback status (playing, paused, or stopped).

Stop playback on the device.

Get the playback cursor on the device.

void STDMETHODCALLTYPE
OnBufferEnd(void * bufferContext)
void STDMETHODCALLTYPE
OnBufferStart(void * bufferContext)
void STDMETHODCALLTYPE
OnLoopEnd(void * bufferContext)
void STDMETHODCALLTYPE
void STDMETHODCALLTYPE
OnVoiceError(void * bufferContext, HRESULT error)
void STDMETHODCALLTYPE
void STDMETHODCALLTYPE
void STDMETHODCALLTYPE
OnVoiceProcessingPassStart(UINT32 BytesRequired)

Public Static Functions

create(IXAudio2 * xaudio, bool is3D, SFXXAudioBuffer * buffer, SFXXAudioVoice * inVoice)

Public Functions

const X3DAUDIO_EMITTER &
bool
is3D()

Is this a 3D positional voice.

play(bool looping)

Starts playback from the current position.

setCone(F32 innerAngle, F32 outerAngle, F32 outerVolume)

Set sound cone of a 3D sound.

Sets the minimum and maximum distances for 3d falloff.

setPitch(F32 pitch)

Sets the pitch scale.

setTransform(const MatrixF & transform)

Sets the position and orientation for a 3d voice.

Sets the velocity for a 3d voice.

setVolume(F32 volume)

Sets the volume.

Detailed Description

Data for Non-Streaming Voices

bool mNonStreamBufferLoaded 

Whether we have loaded our non-streaming data.

We use an explicit flag here as we really can't rely on XAUDIO2_VOICE_STATE.

XAUDIO2_BUFFER mNonStreamBuffer 

Audio buffer for non-streaming voice.

U32 mNonStreamSampleStartPos 

Sample to start playing at when seting up mNonStreamBuffer.

Public Types

typedef SFXVoice Parent 

Public Friends

Protected Attributes

X3DAUDIO_EMITTER mEmitter 

The cached X3DAudio emitter data.

bool mHasStarted 

Whether we have started playback.

bool mHasStopped 

Whether the voice has stopped playing.

bool mIs3D 

Used to know what sounds need positional updates.

bool mIsLooping 

Whether playback is looping.

bool mIsPlaying 

Whether playback is currently running.

CRITICAL_SECTION mLock 
F32 mPitch 

Since 3D sounds are pitch shifted for doppler effect we need to track the users base pitch.

S32 mSamplesPlayedOffset 

XAudio does not reset the SamplesPlayed count as is stated in the docs.

To work around that, we offset the values reported by XAudio through this field.

SFXXAudioDevice * mXAudioDevice 

The device that created us.

IXAudio2SourceVoice * mXAudioVoice 

The XAudio voice.

Protected Functions

SFXXAudioVoice(SFXXAudioBuffer * buffer)

This constructor does not create a valid voice.

_flush()

_getBuffer()

_loadNonStreamed()

_pause()

Reimplemented from: SFXVoice

_play()

Reimplemented from: SFXVoice

_seek(U32 sample)

Reimplemented from: SFXVoice

_status()

Reimplemented from: SFXVoice

_stop()

Reimplemented from: SFXVoice

_tell()

Reimplemented from: SFXVoice

OnBufferEnd(void * bufferContext)

OnBufferStart(void * bufferContext)

OnLoopEnd(void * bufferContext)

OnStreamEnd()

OnVoiceError(void * bufferContext, HRESULT error)

OnVoiceProcessingPassEnd()

OnVoiceProcessingPassStart()

Deprecated:

This is only here for compatibility with the March 2008 SDK version of IXAudio2VoiceCallback.

OnVoiceProcessingPassStart(UINT32 BytesRequired)

Public Static Functions

create(IXAudio2 * xaudio, bool is3D, SFXXAudioBuffer * buffer, SFXXAudioVoice * inVoice)

Public Functions

~SFXXAudioVoice()

getEmitter()

is3D()

Is this a 3D positional voice.

play(bool looping)

Reimplemented from: SFXVoice

setCone(F32 innerAngle, F32 outerAngle, F32 outerVolume)

Reimplemented from: SFXVoice

setMinMaxDistance(F32 min, F32 max)

Reimplemented from: SFXVoice

setPitch(F32 pitch)

Reimplemented from: SFXVoice

setTransform(const MatrixF & transform)

Reimplemented from: SFXVoice

setVelocity(const VectorF & velocity)

Reimplemented from: SFXVoice

setVolume(F32 volume)

Reimplemented from: SFXVoice