Quantcast
Channel: naudio Work Item Rss Feed
Viewing all articles
Browse latest Browse all 738

Commented Issue: NAudio.MmException: UnspecifiedError calling waveOutOpen [16284]

$
0
0
Hello,

I am new to using Naudio

I am using Naudio in a very simple windows service which keeps playing selected songs. I have around 5 one second clips in my selection. The service seems to run without any problem for a while. But around about 4 hour and 45 minute period I keep getting the following error

NAudio.MmException: UnspecifiedError calling waveOutOpen
at NAudio.Wave.WaveOut.Init(IWaveProvider waveProvider)

I really don't know how to trouble shoot the problem with this information

Here is the function that plays the audio files

private void playFile (string fileFullPath)
{
using (IWavePlayer waveout = new WaveOut(WaveCallbackInfo.FunctionCallback()))
{
WaveStream outputStream = createInputStream(fileFullPath);

int duration = getSoundDurationinMiliSeconds(fileFullPath);

try
{
Logger.Log(Level.Verbose, "Now playing song -> " + fileFullPath);
waveout.Init(outputStream); // THE EXCEPTION IS POINTING TO THIS LINE

waveout.PlaybackStopped += new EventHandler(waveout_PlaybackStopped);

mIsPlaying = true;
waveout.Play();


if (fileFullPath.ToLower().EndsWith(".mp3") || fileFullPath.ToLower().EndsWith(".wma"))
{
while (waveout.PlaybackState == PlaybackState.Playing && mIsPlaying)
{
Thread.Sleep(100);
}
}

else if (fileFullPath.ToLower().EndsWith(".wav"))
{
Thread.Sleep(duration + 100);
}

waveout.Stop();
}
catch (Exception ex)
{
Logger.Log(Level.Error, "Error Occur while playing file " + fileFullPath + " " + ex.ToString());
Thread.Sleep(5000);
}
finally
{
outputStream.Close();
outputStream.Dispose();
waveout.Dispose();
waveout.PlaybackStopped -= waveout_PlaybackStopped;
}
}
}
Comments: I have the sam error with WaveOutEvent and have no clue what it was. At the end (month later) I figure it out. I have 4 USB soundcards on one USB hub. I checked with USB Device Tree Viewer and program reported error for soundcard - not enough bandwidth.

Viewing all articles
Browse latest Browse all 738

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>