WP8: PlaySound crashes in some cases
Monkey Forums/Monkey Bug Reports/WP8: PlaySound crashes in some cases
| ||
Playsound crashes when there was some resource loading in between. To be exact, it crashes at StopChannel, because the pointer to the channel "voice" has become invalid. Commenting out StopChannel in PlaySound solves it. It's a bit hard to reproduce, doesn't happen with small test projects, but I can send you my full project if you like, Mark? It crashes then all the time and the same place. |
| ||
Send me the project. |
| ||
Done. |
| ||
Great that this is getting looked into, because I have the same problem, but I haven't been able to make a small runnable example. I get the error the exact same place on both Windows Phone and Windows 8 target. |
| ||
Difference a quick fix is to comment out the StopChannel call in PlaySound in MonkeyGame.cpp |
| ||
Well Mark, Sorry for the huge project, I managed to strip it down to the bug itself, here's the code. Looks like a Discard call screws up your GC? Strict Import mojo Function Main:Int() New Test() Return 0 End Function Class Test Extends App Field _counter:Int Field _lastPlayTime:Int Field _sound:Sound Field _sfxLoaded:Bool = False Method OnCreate:Int() SetUpdateRate(30) _sound = LoadSound( "click.wav" ) _sfxLoaded = True Return 0 End Method Method OnUpdate:Int() Return 0 End Method Method OnSuspend:Int() Return 0 End Method Method OnResume:Int() Return 0 End Method Method OnRender:Int() Cls() Local dt:Int = Millisecs() - _lastPlayTime If( dt > 1000 And _sfxLoaded ) _lastPlayTime = Millisecs() PlaySound( _sound ) End If 'Every 2nd update we discard all images If( _counter Mod 2 = 0 ) _sound.Discard() _sfxLoaded = False Else _sound = LoadSound( "click.wav" ) _sfxLoaded = True End If _counter += 1 Return 0 End Method Method OnBack:Int() Return 0 End Method End Class Whole project: http://www.leidel.net/dl/monkey/wp8test.zip |
| ||
Thanks for the much reduced demo! I've just uploaded v77e which includes a fix for this. |
| ||
Thanks Mark, you did a marvellous job! :) |
| ||
Wow..you cant beat customer service like that...good on ya Mark...gonna buy soon. |