Click or drag to resize
RecorderEx Class
RecorderEx is a component for sound recording in PCM, IMA ADPCM, Microsoft ADPCM, CCITT A-Law, CCITT u-Law, GSM 6.10, Windows Media Audio V2, MPEG Layer-3 (mp3) and other wave file format.
Inheritance Hierarchy

Namespace: Alvas.Audio
Assembly: Alvas.Audio (in Alvas.Audio.dll) Version: 2016.0.6173.41573
Syntax
public class RecorderEx : Component

The RecorderEx type exposes the following members.

Constructors
  NameDescription
Public methodRecorderEx
Initializes a new instance of the RecorderEx class
Public methodRecorderEx(Boolean)
Initializes a new instance of the RecorderEx class
Top
Methods
  NameDescription
Public methodCreateObjRef
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject.)
Public methodDispose
Releases all resources used by the Component.
(Inherited from Component.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodFormatBytes
Returns audio format byte array.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetLifetimeService
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Public methodGetMixerNo
Return mixer number
Public methodGetPosition
Gets the current sound position.
Public methodStatic memberCode exampleGetRecorderName
Returns recorder name by index.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInitializeLifetimeService
Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Public methodPauseRecord
Pauses recording. Use StartRecord method to resume recording.
Public methodStartRecord
Starts recording.
Public methodStopRecord
Stops recording.
Public methodToString
Returns a String containing the name of the Component, if any. This method should not be overridden.
(Inherited from Component.)
Top
Properties
  NameDescription
Public propertyBufferSizeInMS
Gets or sets the recorder buffer size in milliseconds. By default 500 ms.
Public propertyContainer
Gets the IContainer that contains the Component.
(Inherited from Component.)
Public propertyFormat
Gets and sets pointer to audio format.
Public propertyStatic memberRecorderCount
Gets the number of audio recorders installed in system.
Public propertyRecorderID
Gets or sets the current recorder. If -1 the system uses suitable recorder.
Public propertySite
Gets or sets the ISite of the Component.
(Inherited from Component.)
Public propertyState
Gets the recorder state.
Top
Events
  NameDescription
Public eventClose
Occurs when the recorder is closed after recording.
Public eventData
Occurs when the Recorder returns next portion of the recorded data.
Public eventDisposed
Occurs when the component is disposed by a call to the Dispose method.
(Inherited from Component.)
Public eventOpen
Occurs when the recorder is opened for recording.
Top
Examples
This example shows simple using of RecorderEx class.
public static void TestRecorderEx()
{
    RecorderEx rex = new RecorderEx();
    rex.Open += new EventHandler(rex_Open);
    rex.Data += new RecorderEx.DataEventHandler(rex_Data);
    rex.Close += new EventHandler(rex_Close);
    rex.Format = AudioCompressionManager.GetPcmFormat(1, 16, 44100);
    rex.StartRecord();
}

static WaveWriter ww;
static int i = 0;

static void rex_Close(object sender, EventArgs e)
{
    ww.Close();
    ww = null;
}

static void rex_Data(object sender, DataEventArgs e)
{
    ww.WriteData(e.Data);
    i += 1;
    if (i == 10)
    {
        ((RecorderEx)sender).StopRecord();
    }
}

static void rex_Open(object sender, EventArgs e)
{
    if (ww == null)
    {
        ww = new WaveWriter(File.Create("rec.wav"), AudioCompressionManager.FormatBytes(((RecorderEx)sender).Format));
    }
}
See Also