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

Created Issue: This finalizes the application, what is the problem? [16357]

$
0
0
Hi! I don't speak english good, sorry but I speak spanish.

This is my code, that have a problem. Sometime, it finalize the application with an error (the application stopped working).

The code:

var t = new Thread(() =>
{
try
{
sonido.Position = 0; // Reset position... sonido = Properties.Resources.bateria_1
var StreamFile = new WaveFileReader(sonido);
var time = StreamFile.TotalTime.Milliseconds + 2200; // the sum is for prevent an error
var Channel32 = new WaveChannel32(StreamFile);
var waveout = new WaveOut(WaveCallbackInfo.FunctionCallback());

waveout.Init(Channel32);
waveout.Play();


Thread.Sleep(time);

waveout.Stop();
waveout.Dispose();

Thread.CurrentThread.Abort();
}
catch(IOException e) {
MessageBox.Show("Error: " + e.Message); // this exception e, dont have a description for view the error...
}
});
t.Name = "Sonido_platillo";
t.Start();

Thanks!

Viewing all articles
Browse latest Browse all 738

Trending Articles