I can't figure out why this wont work. I get an mp3 that is static. What am I missing? Thanks.
public partial class MainWindow : Window
{
private WaveIn waveIn;
Process p = new Process();
public MainWindow()
{
InitializeComponent();
waveIn = new WaveIn();
waveIn.WaveFormat = new WaveFormat();
waveIn.DataAvailable += waveIn_DataAvailable;
}
void waveIn_DataAvailable(object sender, WaveInEventArgs e)
{
p.StandardInput.BaseStream.Write(e.Buffer, 0, e.BytesRecorded);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
waveIn.StartRecording();
p.StartInfo.FileName = @"c:\lame.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.Arguments = "-r - testing2.mp3";
p.StartInfo.CreateNoWindow = true;
p.Start();
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
waveIn.StopRecording();
p.StandardInput.Close();
}
}