This project has moved and is read-only. For the latest updates, please go here.

WaveIn fail

Mar 16, 2010 at 2:11 AM

 

d:\projects\soundshop\ConsoleApplication2\ConsoleApplication2\Program.cs(18,20): error CS1729: 'NAudio.Wave.WaveIn' does not contain a constructor that takes 2 arguments
d:\projects\soundshop\ConsoleApplication2\ConsoleApplication2\Program.cs(21,35): error CS0120: An object reference is required for the non-static field, method, or property 'ConsoleApplication2.Program.waveInStream_DataAvailable(object, NAudio.Wave.WaveInEventArgs)'

d:\projects\soundshop\ConsoleApplication2\ConsoleApplication2\Program.cs(27,10): (Related location

 

 

 

 

 

 

 

 

 

 

 

 

)

I tried using the example at http://opensebj.blogspot.com/2009/04/naudio-tutorial-5-recording-audio.html to record audio.  here's my exact code:

 

using NAudio.CoreAudioApi;
using NAudio.Wave;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
  class Program
  {
    static void Main(string[] args)
    {

    WaveIn waveInStream;

    waveInStream = new WaveIn(44100,2);

    //waveInStream = new WaveIn();

    waveInStream.DataAvailable += new EventHandler<WaveInEventArgs>(waveInStream_DataAvailable);

    waveInStream.StartRecording();

    }

    void waveInStream_DataAvailable(object sender, WaveInEventArgs e)

    {

    }

    }

  }

I get these errors:
d:\projects\soundshop\ConsoleApplication2\ConsoleApplication2\Program.cs(18,20): error CS1729: 'NAudio.Wave.WaveIn' does not contain a constructor that takes 2 arguments

d:\projects\soundshop\ConsoleApplication2\ConsoleApplication2\Program.cs(21,35): error CS0120: An object reference is required for the non-static field, method, or property 'ConsoleApplication2.Program.waveInStream_DataAvailable(object, NAudio.Wave.WaveInEventArgs)'

using visual studio 2010

 

 

Mar 25, 2010 at 4:42 PM

yes, the WaveIn signature has changed. Call the parameterless constructor and then set the desired capture format by setting the WaveFormat property.

I would advise you create a GUI application rather than a console app, as your application will exit before anything has been recorded as it stands

Mark

Jun 8, 2010 at 3:41 PM
can you please show the equivalent code for that? I'm having the same problem.