Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I get a InvalidOperationException after calling Play2D a 2nd time: henry irrSoundEngine = new ISoundEngine(); any help? |
||||
|
Not sure why this happens, but is there any reason why you are using two instances of ISoundEngine? You usually only need one, and you can reuse it as long as you want. Maybe this might be a reason for your problem. |
||||
|
oh sorry, no, I pasted this line accidentially. Its a global: using System; |
||||
|
I tried to preload both files with irrSoundEngine.AddSoundSourceFromFile. no fix. I isolated my audio class in a new small VS2010 C project. no fix. |
||||
|
when I call Next() from outside of my sound class: AudioPlayer.Next(); than it works. But when Next() is called from the OnSoundStopped() event my app crashes.
|
||||
|
I tried to use a different ISound object to play the second file. no fix. Maybe this helps: Die Laufzeit hat einen schwerwiegenden Fehler entdeckt. Fehleradresse: "0x67e6d2c6" in Thread "0x2618". Fehlercode: 0xc0000005. Bei diesem Fehler könnte es sich um ein Problem in der CLR oder in den unsicheren oder nicht verifizierbaren Teilen des Benutzercodes handeln. Übliche Ursachen dieses Bugs sind Marshallerfehler für COM-Interop oder PInvoke, die den Stapel beschädigen können. |
||||
|
here is the code to reproduce the crash. all I do is call PlayTest.Play("\\\\server\\music\\file1.mp3"); It will crash in OnSoundStopped(). But not if I call Next() before file1 finished playing. Sorry but this must be a bug no? using IrrKlang;
|
||||
|
Did you try not calling Dispose()? |
||||
|
Of course. s. above code. |
||||
|
I think the problem occurrs because OnSoundStopped will occurr in a different thread, and this somehow might cause some race condition. You could try running irrklang in single threaded mode, and see if this fixes the problem. If so this might be the problem. Quick workaround: Don't use the sound stopped event receiver, but test the ISound if the sound stopped by querying it via Finished |
|