C# Class Mp3Sharp.EventRaisingSoundBuffer

Component representing a secondary buffer that can be used for streaming. The buffer raises events when it reaches its half-way mark, as well as its end.
Show file Open project: RHY3756547/FreeSO Class Usage Examples

Protected Properties

Property Type Description
Device Device
NotificationEvent System.Threading.AutoResetEvent

Public Methods

Method Description
EventRaisingSoundBuffer ( Device device, WaveFormat waveFormat, System.TimeSpan bufferLength ) : System
Play ( ) : void
Stop ( ) : void

Protected Methods

Method Description
InitSecondaryBuffer ( ) : void

Initialize the SecondaryBuffer and Notify instances.

Private Methods

Method Description
GetBytesByRaisingEvent ( int locationInSecondaryBuffer, int numBytesToAcquire, BufferNotificationEventArgs e ) : void
HandleNewBytesInControlThread ( int nextPlaceForBytes, int byteWindowSize, BufferNotificationEventArgs ea ) : NextNotificationTask
StreamControlThread ( ) : void

The stream control thread raises events every half the stream. When the BufferNotificationEventArgs contains a SoundFinished property set to true, the current buffer segment is padded with silence. At the next notification, the next buffer segment is filled with silence, and no event is raised. At the next notification, which will come when the padded segment (not the completely silent segment) is finished, the SecondaryBuffer is stopped and the thread terminated.

Method Details

EventRaisingSoundBuffer() public method

public EventRaisingSoundBuffer ( Device device, WaveFormat waveFormat, System.TimeSpan bufferLength ) : System
device Device
waveFormat WaveFormat
bufferLength System.TimeSpan
return System

InitSecondaryBuffer() protected method

Initialize the SecondaryBuffer and Notify instances.
protected InitSecondaryBuffer ( ) : void
return void

Play() public method

public Play ( ) : void
return void

Stop() public method

public Stop ( ) : void
return void

Property Details

Device protected property

protected Device Device
return Device

NotificationEvent protected property

protected AutoResetEvent,System.Threading NotificationEvent
return System.Threading.AutoResetEvent