"DirectSoundOut is not initialized" Exception

Jan 9, 2015 at 12:02 PM
Hi,

I was trying to use the example-code to play a .wav-file, but I got this strange error.

Here is my code:
using (IWaveSource soundSource = CodecFactory.Instance.GetCodec( "test.wav"))
             {               
                 using (DirectSoundOut soundOut = new DirectSoundOut())
                 {                  
                     soundOut.Initialize(soundSource); 
                     soundOut.Play();  //here appears the error                  
                 }
             }
I am unsure what that means, since I initialize the objekt right above.

Regards, Marc
Coordinator
Jan 9, 2015 at 4:28 PM
That should not happen. Which version are you using? The latest version of the source code?
The unittests are passing. So I can't reproduce your error. Can you upload something which reproduces the error?
Feb 19, 2015 at 4:14 AM
Edited Feb 19, 2015 at 4:14 AM
The version (1.0.2) on nuget and available for download on the front page here looks like its from ~8/24. There was a bug in CheckForIsInitialized() in DirectSoundOut.
private void CheckForIsInitialized()
{
    if (_isInitialized)
        throw new InvalidOperationException("DirectSoundOut is not initialized.");

}
Clearly this should have been !_isInitialized and indeed it was caught and fixed in a later commit here

I built a copy from the current source and it all works now which is cool.
Coordinator
Feb 19, 2015 at 5:03 AM
Gonna update the nuget package as soon as possible.
Marked as answer by filoe on 2/19/2015 at 3:14 PM