PlaySample failed to play sound - Android 6.0
Monkey Forums/Monkey Bug Reports/PlaySample failed to play sound - Android 6.0
| ||
Getting a few ANR from Android 6:java.lang.Error: PlaySample failed to play sound at com.therevillsgames.piratesolitairetriPeaks.gxtkAudio.PlaySample(MonkeyGame.java:3333) at com.therevillsgames.piratesolitairetriPeaks.bb_audio.g_PlaySound(MonkeyGame.java:15382) java.lang.Error: PlaySample failed to play sound at com.therevillsgames.csusatripeaks.gxtkAudio.PlaySample(MonkeyGame.java:2603) at com.therevillsgames.csusatripeaks.bb_audio.g_PlaySound(MonkeyGame.java:22603) |
| ||
have you a test apk for me to test it on my device? Which device do you have? |
| ||
Working here with audiotest in emulator, but that's not saying much. The audio code is throwing an exception when it fails to play a sound though, which is not good. Try replacing PlaySample in mojo.android.java with this: int PlaySample( gxtkSample sample,int channel,int flags ){ gxtkChannel chan=channels[channel]; if( chan.state!=0 ) pool.stop( chan.stream ); float rv=(chan.pan * .5f + .5f) * chan.volume; float lv=chan.volume-rv; int loops=(flags&1)!=0 ? -1 : 0; chan.stream=pool.play( sample.sound,lv,rv,0,loops,chan.rate ); if( chan.stream!=0 ){ chan.state=1; return 0; } System.out.println( "PlaySample failed" ); return -1; } This should at least allow the app to continue to run if it fails to play a sound. It also disables a very nasty hack that was necessary to deal with android's utterly fubared SoundPool system, but I guess we should first try and determine if *any* sounds play. |
| ||
@Malublu - all my Android devices currently dont have the latest version of Android so I cant reproduce it. The users have reported it to me have the following devices: Nexus 5 (hammerhead) x 2 Galaxy Tab4 10.0 (matisselte) @Mark - thanks for that I'll try it with that code. |
| ||
Okay i can test it, because i have an android device with android 6.0.1. I test it, if i become the monkey licence. |
| ||
> @Mark - thanks for that I'll try it with that code. It's probably not enough on it's own to 'fix' android audio, but it should stop app crashes. Can you find out if it audio is working at all? ie: does the above patch kill *all* audio or just some? And does it eventually 'recover', ie: it only fails to play some sounds the first time? |
| ||
I've applied the above code change to Chef Solitaire: https://play.google.com/store/apps/details?id=com.therevillsgames.csusatripeaks Since I cant reproduce the issue its hard, and within Android's dev console I cant see a way to contact the users. Looking at the stack trace it is happening when clicking on a button within the game on the title screen (more than likely the big play button), that would be the first sound effect played. Music should be playing at that stage. java.lang.Error: PlaySample failed to play sound at com.therevillsgames.csusatripeaks.gxtkAudio.PlaySample(MonkeyGame.java:2603) at com.therevillsgames.csusatripeaks.bb_audio.g_PlaySound(MonkeyGame.java:22603) at com.therevillsgames.csusatripeaks.c_SoundPlayer.m_PlayFx(MonkeyGame.java:9662) at com.therevillsgames.csusatripeaks.c_GameSound.p_Play(MonkeyGame.java:6812) at com.therevillsgames.csusatripeaks.c_SimpleButton.p_Click(MonkeyGame.java:13777) at com.therevillsgames.csusatripeaks.c_SimpleButton.p_Update2(MonkeyGame.java:13793) at com.therevillsgames.csusatripeaks.c_SimpleMenu.p_Update2(MonkeyGame.java:13539) at com.therevillsgames.csusatripeaks.c_TitleScreen.p_Update2(MonkeyGame.java:10646) at com.therevillsgames.csusatripeaks.c_DiddyApp.p_Update(MonkeyGame.java:5336) at com.therevillsgames.csusatripeaks.c_DiddyApp.p_OnUpdate(MonkeyGame.java:5365) at com.therevillsgames.csusatripeaks.c_GameDelegate.UpdateGame(MonkeyGame.java:5627) at com.therevillsgames.csusatripeaks.BBGame.UpdateGame(MonkeyGame.java:616) at com.therevillsgames.csusatripeaks.BBAndroidGame.UpdateGame(MonkeyGame.java:1341) at com.therevillsgames.csusatripeaks.BBAndroidGame$GameTimer.run(MonkeyGame.java:874) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) |
| ||
Can you email me the sound file you think is causing the problem? |
| ||
I think it this one: https://dl.dropboxusercontent.com/u/35103024/ButtonClick.ogg |