Events (1) Methods (4)
Namespace: CSCore.XAudio2

Syntax

public class StreamingSourceVoice : XAudio2SourceVoice

Base Type

Summary

Extends the the XAudio2SourceVoice to enable real-time audio streaming.

Uses

Events

Stopped

Occurs when the playback stops and no more data is available.

public Stopped

Remarks

This event occurs whenever the StreamEnd event occurs.

Methods

public void StreamingSourceVoice(IntPtr ptr, VoiceCallback voiceCallback, IWaveSource waveSource, Int32 bufferSize)

Parameters

ptr

IntPtr

Pointer to a XAudio2SourceVoice object.

voiceCallback

VoiceCallback

VoiceCallback instance which receives notifications from the XAudio2SourceVoice which got passed as a pointer (see the ptr argument).

waveSource

IWaveSource

IWaveSource which provides the audio data to stream.

bufferSize

Int32

Buffersize of the internal used buffers in milliseconds. Values in the range from 70ms to 200ms are recommended.

Remarks

It is recommended to use the Create method instead of the this constructor.

Create(XAudio2 xaudio2, IWaveSource waveSource, Int32 bufferSize)

Creates an instance of the StreamingSourceVoice class.

public static StreamingSourceVoice Create(XAudio2 xaudio2, IWaveSource waveSource, Int32 bufferSize)

Parameters

xaudio2

XAudio2

Instance of the XAudio2 class.

waveSource

IWaveSource

IWaveSource which provides the audio data to stream.

bufferSize

Int32

Buffersize of the internal used buffers in milliseconds. Values in the range from 70ms to 200ms are recommended.

Returns

Configured StreamingSourceVoice instance.

Dispose(Boolean disposing)

Stops and disposes the XAudio2SourceVoice, closes the internal used waithandle and frees the allocated memory of all used buffers.

protected void Dispose(Boolean disposing)

Parameters

disposing

Boolean

True to release both managed and unmanaged resources; false to release only unmanaged resources.

Refill()

Notifies the StreamingSourceVoice class that new data got requested. If there are any buffers which are currently not queued and the underlying IWaveSource holds any more data, this data refills the internal used buffers and provides audio data to play.

public virtual void Refill()

Class Diagram

public classStreamingSourceVoiceStoppedCreateDisposeRefillStreamingSourceVoicepublic classXAudio2SourceVoiceDiscontinuityDiscontinuityNativeExitLoopExitLoopExitLoopNativeFlushSourceBuffersFlushSourceBuffersNativeGetFrequencyRatioGetStateGetStateSetFrequencyRatioSetFrequencyRatioSetFrequencyRatioNativeSetSourceSampleRateSetSourceSampleRateNativeStartStartStartNativeStopStopStopNativeSubmitSourceBufferSubmitSourceBufferNativeXAudio2SourceVoiceState { get; }public abstract classXAudio2CommitAllCommitNowDefaultChannelsDefaultFrequencyRatioDefaultSampleRateMaxAudioChannelsMaxFrequencyRatioMaximumSampleRateMinFrequencyRatioMinimumSampleRateQuantumDenominatorCommitChangesCommitChangesCommitChangesNativeCreateMasteringVoiceCreateMasteringVoiceCreateMasteringVoiceCreateMasteringVoiceCreateMasteringVoiceNativeCreateMasteringVoicePtrCreateSourceVoiceCreateSourceVoiceCreateSourceVoiceCreateSourceVoiceNativeCreateSourceVoicePtrCreateSubmixVoiceCreateSubmixVoiceCreateSubmixVoiceNativeCreateSubmixVoicePtrCreateXAudio2CreateXAudio2GetDefaultDeviceGetPerformanceDataNativeRegisterForCallbacksRegisterForCallbacksNativeSetDebugConfigurationSetDebugConfigurationNativeStartEngineStartEngineNativeStopEngineUnregisterForCallbacksXAudio2DefaultDevice { get; }PerformanceData { get; }Version { get; set; }public structXAudio2BufferAudioBytesAudioDataPtrContextPtrFlagsLoopBeginLoopCountLoopInfiniteLoopLengthMaxBufferBytesMaxLoopCountPlayBeginPlayLengthDisposeFreeGetStreamXAudio2BufferXAudio2Bufferpublic classXAudio2SourceVoiceDiscontinuityDiscontinuityNativeExitLoopExitLoopExitLoopNativeFlushSourceBuffersFlushSourceBuffersNativeGetFrequencyRatioGetStateGetStateSetFrequencyRatioSetFrequencyRatioSetFrequencyRatioNativeSetSourceSampleRateSetSourceSampleRateNativeStartStartStartNativeStopStopStopNativeSubmitSourceBufferSubmitSourceBufferNativeXAudio2SourceVoiceState { get; }public classXAudio2VoiceDestroyVoiceDisableEffectDisableEffectDisableEffectNativeDisposeEnableEffectEnableEffectEnableEffectNativeGetChannelVolumesGetChannelVolumesNativeGetEffectParametersGetEffectParametersNativeGetEffectStateNativeGetFilterParametersGetFilterParametersNativeGetOutputFilterParametersGetOutputFilterParametersNativeGetOutputMatrixGetOutputMatrixNativeGetVoiceDetailsNativeGetVolumeGetVolumeNativeIsEffectEnabledSetChannelVolumesSetChannelVolumesSetChannelVolumesNativeSetEffectChainSetEffectChainNativeSetEffectParametersSetEffectParametersSetEffectParametersNativeSetFilterParametersSetFilterParametersNativeSetOutputFilterParametersSetOutputFilterParametersSetOutputFilterParametersNativeSetOutputMatrixSetOutputMatrixSetOutputMatrixNativeSetOutputVoicesSetOutputVoicesNativeSetVolumeSetVolumeNativeXAudio2VoiceFilterParameters { get; set; }Version { get; }VoiceDetails { get; }Volume { get; set; }

save

reset

Drag to pan - Use Mousewheel + Ctrl to zoom