AudioSink.OnSamples Method

When overridden in a derived class, is invoked when an audio device captures a complete audio sample.

Namespace:  System.Windows.Media
Assembly:  System.Windows (in System.Windows.dll)


Protected MustOverride Sub OnSamples ( _
    sampleTimeInHundredNanoseconds As Long, _
    sampleDurationInHundredNanoseconds As Long, _
    sampleData As Byte() _
protected abstract void OnSamples(
    long sampleTimeInHundredNanoseconds,
    long sampleDurationInHundredNanoseconds,
    byte[] sampleData


  • sampleTimeInHundredNanoseconds
    Type: System.Int64
    The time, in 100-nanosecond units, when the sample was captured.
  • sampleDurationInHundredNanoseconds
    Type: System.Int64
    The duration of the sample, in 100-nanosecond units.
  • sampleData
    Type: array<System.Byte[]
    A byte stream that contains audio data, to be interpreted per the relevant audio format information.


The interval at which OnSamples is called depends on the AudioFrameSize value for the active AudioCaptureDevice.

Version Information


Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.