Methods (24) Properties (1)
Namespace: CSCore.XAudio2

Syntax

public class XAudio2SourceVoice : XAudio2Voice

Base Type

Summary

Use a source voice to submit audio data to the XAudio2 processing pipeline.You must send voice data to a mastering voice to be heard, either directly or through intermediate submix voices.

Uses

Used by

Methods

XAudio2SourceVoice(IntPtr ptr, XAudio2Version version)

Initializes a new instance of the XAudio2SourceVoice class.

public void XAudio2SourceVoice(IntPtr ptr, XAudio2Version version)

Parameters

ptr

IntPtr

Native pointer of the XAudio2SourceVoice object.

version

XAudio2Version

The XAudio2Version to use.

Discontinuity()

Notifies an XAudio2 voice that no more buffers are coming after the last one that is currently in its queue.

public void Discontinuity()

DiscontinuityNative()

Notifies an XAudio2 voice that no more buffers are coming after the last one that is currently in its queue.

public Int32 DiscontinuityNative()

Returns

HRESULT

ExitLoop()

Stops looping the voice when it reaches the end of the current loop region.

public void ExitLoop()

ExitLoop(Int32 operationSet)

Stops looping the voice when it reaches the end of the current loop region.

public void ExitLoop(Int32 operationSet)

Parameters

operationSet

Int32

Identifies this call as part of a deferred batch. For more details see http://msdn.microsoft.com/en-us/library/windows/desktop/ee415807(v=vs.85).aspx.

ExitLoopNative(Int32 operationSet)

Stops looping the voice when it reaches the end of the current loop region.

public Int32 ExitLoopNative(Int32 operationSet)

Parameters

operationSet

Int32

Identifies this call as part of a deferred batch. For more details see http://msdn.microsoft.com/en-us/library/windows/desktop/ee415807(v=vs.85).aspx.

Returns

HRESULT

FlushSourceBuffers()

Removes all pending audio buffers from the voice queue. If the voice is started, the buffer that is currently playing is not removed from the queue.

public void FlushSourceBuffers()

Remarks

See http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.ixaudio2sourcevoice.ixaudio2sourcevoice.flushsourcebuffers(v=vs.85).aspx.

FlushSourceBuffersNative()

Removes all pending audio buffers from the voice queue. If the voice is started, the buffer that is currently playing is not removed from the queue.

public Int32 FlushSourceBuffersNative()

Returns

HRESULT

Remarks

See http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.ixaudio2sourcevoice.ixaudio2sourcevoice.flushsourcebuffers(v=vs.85).aspx.

GetFrequencyRatio()

Returns the frequency adjustment ratio of the voi

public Single GetFrequencyRatio()

Returns

Current frequency adjustment ratio if successful.

GetState()

Returns the voice's current cursor position data.

public VoiceState GetState()

Returns

VoiceState structure containing the state of the voice.

GetState(GetVoiceStateFlags flags)

Returns the voice's current cursor position data.

public VoiceState GetState(GetVoiceStateFlags flags)

Parameters

flags

GetVoiceStateFlags

Flags controlling which voice state data should be returned. Valid values are Default or NoSamplesPlayed. The default value is Default. If you specify NoSamplesPlayed, GetState returns only the buffer state, not the sampler state. GetState takes roughly one-third as much time to complete when you specify NoSamplesPlayed.

Returns

VoiceState structure containing the state of the voice.

Remarks

If the Version is not XAudio2_8 the flags parameter will be ignored.

SetFrequencyRatio(Single ratio)

Sets the frequency adjustment ratio of the voice.

public void SetFrequencyRatio(Single ratio)

Parameters

ratio

Single

Frequency adjustment ratio. This value must be between MinFrequencyRatio and the MaxFrequencyRatio parameter specified when the voice was created CreateSourceVoice .

SetFrequencyRatio(Single ratio, Int32 operationSet)

Sets the frequency adjustment ratio of the voice.

public void SetFrequencyRatio(Single ratio, Int32 operationSet)

Parameters

ratio

Single

Frequency adjustment ratio. This value must be between MinFrequencyRatio and the MaxFrequencyRatio parameter specified when the voice was created CreateSourceVoice .

operationSet

Int32

Identifies this call as part of a deferred batch. For more details see http://msdn.microsoft.com/en-us/library/windows/desktop/ee415807(v=vs.85).aspx.

SetFrequencyRatioNative(Single ratio, Int32 operationSet)

Sets the frequency adjustment ratio of the voice.

public Int32 SetFrequencyRatioNative(Single ratio, Int32 operationSet)

Parameters

ratio

Single

Frequency adjustment ratio. This value must be between MinFrequencyRatio and the MaxFrequencyRatio parameter specified when the voice was created CreateSourceVoice .

operationSet

Int32

Identifies this call as part of a deferred batch. For more details see http://msdn.microsoft.com/en-us/library/windows/desktop/ee415807(v=vs.85).aspx.

Returns

HRESULT

SetSourceSampleRate(Int32 newSourceSampleRate)

Reconfigures the voice to consume source data at a different sample rate than the rate specified when the voice was created.

public void SetSourceSampleRate(Int32 newSourceSampleRate)

Parameters

newSourceSampleRate

Int32

The new sample rate the voice should process submitted data at. Valid sample rates are 1kHz to 200kHz.

SetSourceSampleRateNative(Int32 newSourceSampleRate)

Reconfigures the voice to consume source data at a different sample rate than the rate specified when the voice was created.

public Int32 SetSourceSampleRateNative(Int32 newSourceSampleRate)

Parameters

newSourceSampleRate

Int32

The new sample rate the voice should process submitted data at. Valid sample rates are 1kHz to 200kHz.

Returns

HRESULT

Start()

Starts consumption and processing of audio by the voice. Delivers the result to any connected submix or mastering voices, or to the output device.

public void Start()

Start(Int32 flags, Int32 operationSet)

Starts consumption and processing of audio by the voice. Delivers the result to any connected submix or mastering voices, or to the output device.

public void Start(Int32 flags, Int32 operationSet)

Parameters

flags

Int32

Flags that control how the voice is started. Must be 0.

operationSet

Int32

Identifies this call as part of a deferred batch. For more details see http://msdn.microsoft.com/en-us/library/windows/desktop/ee415807(v=vs.85).aspx.

StartNative(Int32 flags, Int32 operationSet)

Starts consumption and processing of audio by the voice. Delivers the result to any connected submix or mastering voices, or to the output device.

public Int32 StartNative(Int32 flags, Int32 operationSet)

Parameters

flags

Int32

Flags that control how the voice is started. Must be 0.

operationSet

Int32

Identifies this call as part of a deferred batch. For more details see http://msdn.microsoft.com/en-us/library/windows/desktop/ee415807(v=vs.85).aspx.

Returns

HRESULT

Stop()

Stops consumption of audio by the current voice.

public void Stop()

Stop(SourceVoiceStopFlags flags, Int32 operationSet)

Stops consumption of audio by the current voice.

public void Stop(SourceVoiceStopFlags flags, Int32 operationSet)

Parameters

flags

SourceVoiceStopFlags

Flags that control how the voice is stopped. Can be None or PlayTails.

operationSet

Int32

Identifies this call as part of a deferred batch. For more details see http://msdn.microsoft.com/en-us/library/windows/desktop/ee415807(v=vs.85).aspx.

StopNative(SourceVoiceStopFlags flags, Int32 operationSet)

Stops consumption of audio by the current voice.

public Int32 StopNative(SourceVoiceStopFlags flags, Int32 operationSet)

Parameters

flags

SourceVoiceStopFlags

Flags that control how the voice is stopped. Can be None or PlayTails.

operationSet

Int32

Identifies this call as part of a deferred batch. For more details see http://msdn.microsoft.com/en-us/library/windows/desktop/ee415807(v=vs.85).aspx.

Returns

HRESULT

SubmitSourceBuffer(XAudio2Buffer buffer)

Adds a new audio buffer to the voice queue.

public void SubmitSourceBuffer(XAudio2Buffer buffer)

Parameters

buffer

XAudio2Buffer

XAudio2Buffer structure to queue.

Remarks

See http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.ixaudio2sourcevoice.ixaudio2sourcevoice.submitsourcebuffer(v=vs.85).aspx.

SubmitSourceBufferNative(IntPtr buffer, IntPtr bufferWma)

Adds a new audio buffer to the voice queue.

public Int32 SubmitSourceBufferNative(IntPtr buffer, IntPtr bufferWma)

Parameters

buffer

IntPtr

Pointer to an XAudio2Buffer structure to queue.

bufferWma

IntPtr

Pointer to an additional XAudio2BufferWma structure used when submitting WMA data.

Returns

HRESULT

Remarks

See http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.ixaudio2sourcevoice.ixaudio2sourcevoice.submitsourcebuffer(v=vs.85).aspx.

Properties

State

Gets the VoiceState of the source voice.

public VoiceState State { get; }

Class Diagram

save

reset

Drag to pan - Use Mousewheel + Ctrl to zoom