Alvas.Audio Class Library

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.

For a list of all members of this type, see RecorderEx Members.

System.Object
   MarshalByRefObject
      Component
         RecorderEx

[Visual Basic]
Public Class RecorderEx
    Inherits 
[C#]
public class RecorderEx : Component

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Example

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));
    }
}
 

Requirements

Namespace: Alvas.Audio

Assembly: Alvas.Audio (in Alvas.Audio.dll)

See Also

RecorderEx Members | Alvas.Audio Namespace