I made a windows form application that listens from the microphone and detects sound patrons.
Now i want to do the same but in a service.
I use Naudio and this event:
myWave = new WaveIn();
...
myWave.DataAvailable += new EventHandler<WaveInEventArgs>(myWave_DataAvailable);
At windows form works fine, but the service don't fires the event.
Does anyone know why?
Another question is
Will my service hear the microphone even when not logged in?
Thanks!
Edited with new information and using WaveInEvent class:
I declare the variable in the class
public partial class SoundDetector : ServiceBase {
...
private WaveInEvent myWave;
Set the event in the constructor
public SoundDetector()
{
myWave.DataAvailable += myWave_DataAvailable;
And start recordig in the OnStart
protected override void OnStart(string[] args)
{
myWave.StartRecording();
But the event still stop firing...