WaveInput Class |
Namespace: StreamCoders.Wave
The WaveInput type exposes the following members.
Name | Description | |
---|---|---|
![]() | BitsPerSample |
Get/Set the Bits per sample.
|
![]() | BytesAvailable |
Gets the BytesAvailable property.
|
![]() | ChannelMask |
Gets or sets the channel mask present in the multichannel stream. Audio interleave
channel numbers start from lowest to highest value in channel mask bit-flags. (Stereo:
Interleave 0 -> Left (0x1), Interleave 1 -> Right (0x2))
|
![]() | Channels |
Get/Set the number of channels.
|
![]() | Devices |
Gets all available audio input devices. This includes the default device mapper in position zero.
|
![]() | SampleRate |
Get/Set the Sample rate.
|
![]() | SamplesAvailable |
Indicates whether audio samples are enqueued and ready to be read.
|
![]() | TransferBufferCount |
Gets or sets the number of Transfer buffers. |
![]() | TransferBufferSize |
Gets or sets the size of each of the buffers used to transfer data from the sound device
to the application. |
Name | Description | |
---|---|---|
![]() | ClearBuffers |
Removes all pending buffers from the audio device. This call is functionally equivalent to calling SamplesAvailable and GetAllData, but is more efficient. |
![]() | CloseDevice |
Close previously opened device Should be called after calling Stop() |
![]() | Dispose |
Destructor.
|
![]() | FindDeviceByIndex | |
![]() | FindDeviceByName |
Find audio Device provided its name.
|
![]() | GetNextSamples |
Gets the next samples in the wave input devices queue. Calling this method and events
cannot be mixed.
|
![]() | Init |
Initializes WaveInput object.
|
![]() | OpenDevice |
Open default audio input device.
|
![]() | OpenDevice(String) |
Opens an audio input device.
|
![]() | OpenDevice(AudioDeviceInfo) |
Opens an audio input device.
|
![]() | SetTransferBufferSizeMilliseconds |
Sets transfer buffer size given milliseconds using Formula: SR * CH * BPS * milliseconds / 1000. This function must be called after setting SampleRate, Channels and BitsPerSample, but before Init(). |
![]() | Start |
Start recording and queueing data.
|
![]() | Stop |
Stop recording and queueing data.
|
![]() ![]() | WaitSamplesAvailable |
Uses internal semaphore to wait for samples to become available.
|
Name | Description | |
---|---|---|
![]() | OnSamplesAvailable |
Event that is raised whenever a sample is available. Events and polling (GetNextSamples)
cannot be mixed.
|
Name | Description | |
---|---|---|
![]() | Copy | Overloaded.
Creates a copy of the object.
(Defined by ObjectExtensions.) |
![]() | Copy(Object) | Overloaded.
Creates a deep copy of the object using the supplied object as a target for the copy operation.
(Defined by ObjectExtensions.) |
WaveOutput wout = new WaveOutput(); wout.BitsPerSample = audioBitsPerSample; wout.Channels = audioChannels; wout.SampleRate = audioSampleFreq; wout.Init(); wout.OpenDevice(); WaveInput win = new WaveInput(); win.BitsPerSample = audioBitsPerSample; win.Channels = audioChannels; win.SampleRate = audioSampleFreq; win.Init(); win.OpenDevice(); win.Start(); while(true) { if (win.SamplesAvailable) { byte[] samples = win.GetAllData(); wout.Enqueue(samples); } }