filoe / cscore

An advanced audio library, written in C#. Provides tons of features. From playing/recording audio to decoding/encoding audio streams/files to processing audio data in realtime (e.g. applying custom effects during playback, create visualizations,...). The possibilities are nearly unlimited.
Other
2.14k stars 450 forks source link

[MediaFoundationException] Decode Stream using MediaFoundationDecoder #447

Closed steam3d closed 3 years ago

steam3d commented 3 years ago

I can't figure out what i did wrong. Here is my code:

SpeechSynthesisStream synthesisStream = await synthesizer.SynthesizeTextToStreamAsync(text);
Stream stream = synthesisStream.AsStream();
var waveSource = new MediaFoundationDecoder(stream);

At line 3 i get Exception thrown: 'CSCore.MediaFoundation.MediaFoundationException' in CSCore.dll but program still works i can then send waveSource to media player and it will play.

I tried to catch

try{
    var waveSource = new MediaFoundationDecoder(stream);
}
catch{
***
}

but obviously it never happens

Maybe is there way to get more more detailed error?

filoe commented 3 years ago

Does it really throw the exception or is it just in the logs?

steam3d commented 3 years ago

Just in the logs

filoe commented 3 years ago

So just ignore it. It gets handled by CSCore.