I just tested MP2 recording and I don't get it to work, a file is created but it's 0 kB. I don't see any wrong in my code, or...? MP3 recording works just fine. I tested both EncoderTwoLAME and EncoderTooLAME, and I have the encoders (exe).
private EncoderLAME lame;
private EncoderTwoLAME lameMP2;
public void StartRecording(int soundcardIndex,string filename, int bitRate, bool encodetoMP2)
{
// init your recording device (we use the default device)
if (!Bass.BASS_RecordInit(soundcardIndex))
Console.WriteLine("Rec: Bass_RecordInit error!");
_recProc = new RECORDPROC(RecordingHandler);
// start recording at 44.1kHz, stereo
_recHandle = Bass.BASS_RecordStart(44100, 2, BASSRecord.BASS_DEFAULT, _recProc, 0);
if (_recHandle == Bass.FALSE)
Console.WriteLine("Rec: BASS_RecordStart error!");
// set up a ready-made DSP (here the PeakLevelMeter)
_plm = new DSP_PeakLevelMeter(_recHandle, 1);
//_plm.CalcRMS = true;
//_plm.Notification += new EventHandler(_plm_Notification);
if (encodetoMP2)
{
lameMP2 = new EncoderTwoLAME(_recHandle);
lameMP2.InputFile = null;
lameMP2.OutputFile = filename + ".MP2";
lameMP2.TWO_Bitrate = bitRate;
lameMP2.Start(null, 0);
if (!lameMP2.EncoderExists)
{
Console.WriteLine("Rec: twoLAME.EXE can not be found...");
}
}
else
{
lame = new EncoderLAME(_recHandle);
lame.InputFile = null;
lame.OutputFile = filename + ".MP3";
lame.LAME_Bitrate = bitRate;
lame.LAME_Mode = EncoderLAME.LAMEMode.Stereo;
lame.LAME_TargetSampleRate = (int)EncoderLAME.SAMPLERATE.Hz_44100;
lame.LAME_Quality = EncoderLAME.LAMEQuality.Quality;
lame.Start(null, 0);
if (!lame.EncoderExists)
{
Console.WriteLine("Rec: LAME.EXE can not be found...");
}
}
}