New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AVEngine - issue with soundPlayerExample #7931
Comments
is that iOS? (on macOS how can I confirm I'm really getting the AVEngine back end? |
Not iOS, it is macOS. |
to test this I've copied the example to another project, adding this on App.xcconfig
the line LIB_FMOD one was unexpected, but this was needed to make it work |
Hmm. That's weird, the multi play stuff used to work well. Will try and reproduce with the nightlies.
|
hmm the state machine of that class is hard to follow with the threads, delays etc especially when multi-play, I don't get where how the superposed instances are tracked? anyhow here it does not crash easily (M1, 14.4.1). I have to click a lot (like 100 clicks in 12 seconds) then I get the above adding this to - (void)stop {
if (!_bIsPlaying) {
NSLog(@"stop() called before play()");
return;
} but it feels like a "patch" -- maybe the design needs a bit more robustness. |
@dimitre I can reproduce here - its crashing here, where the multiplayer objects that are done playing are deleted ( ie the old vector of multiplayer objects gets replaced with the new one ). I get this message: I remember stress testing this pretty hard and multiplay used to work, but maybe the ARC changes mean something is getting deleted twice. |
Nice! I think @artificiel patch can be applied so things work OK for now. |
yes in which case my patch means "dropping a request" for a sound to play (because play calls stop); ideally things would be locked and pass through once the sound becomes stoppable, presumably a buffer size later or something like that. the patch is good to confirm the problem is there (stopping a sound that's not playing), but the real solution might be in redesign. but as mentioned the reentrancy features of that class eludes my quick analysis. |
Yes, please submit a PR |
@artificiel tested here and working. no crashes |
ok I can look more but I believe @ofTheo wrote that might be more efficient to take a look at it in light of the info here? also an observation: the crash don't occur on click, but at the end of the sound. it seems there is something going on deallocation that gets somehow invalidated during the lifetime of the |
wow - @artificiel , beat me to it! :D this also works for me: but I am not sure if this hides the main bug, but possibly keeps it for the dispatch ( when audio outputs are changed mid playback ). |
Thanks @artificiel - yeah I notice that now it doesn't work anymore when unplugging headphones. I did have it working where it paused/stopped all audio and recreated it for the new engine and picked up where it left off. But I'll look into that separately. Thanks for tracking this issue down!! |
please do the PR! |
if you click any sample and wait until it stops it works OK
if you click again before the first sound is stopped it crashes in the first line of stop function:
The text was updated successfully, but these errors were encountered: