ibisum wrote: ↑Wed Mar 12, 2025 8:55 pm
I had thought this was intended, since there are two variants of the sound, but perhaps what I am hearing is an audio thread being killed and its buffers being reset uncleanly...
Yeah, it is not intentional. You are correct that it is due to the audio thread being suspended. I should try to clean that up.
ibisum wrote: ↑Wed Mar 12, 2025 9:12 pm
[Edit: I thought the audioContext.resume code was commented out, but never mind, I should learn what /*-{ }-*/ mean in Java GWT/Javascript world...]
No worries. I didn't see the original message, but I think I know what you might have written. Yeah, GWT uses a comment syntax to embed native Javascript, which I'm making use of in a number of places, mostly for features that GWT doesn't support out of the box, but also when it is more convenient to do so. The GWT transpiler recognises that syntax and includes those bits of Javascript as-is.
Thanks for the links to the info about the audiocontext on iOS. That has got me thinking now. I have a theory about what might be happening. If you look at the code I pasted earlier, there are two calls to resume. One is the original call on start up of the emulator. The then() is expected to be called when the audio context resume completes. For most of the platforms, if the browser doesn't yet have permission to play sound, then this promise gets queued and is resolved at such time that there is another resume call that is within a user interaction. This works for everything except for iOS, I think, but I'm not sure that the spec/documentation is clear about this behaviour, so perhaps iOS has implemented it differently. Maybe iOS rejects that first call immediately, which could be what that error message in your console is, which means that there isn't a queued promise waiting to be resolved, which means that when the next resume happens within a user interaction, it essentially does nothing.
I have a strong feeling this is on the right track. Regardless if it is or not, I have something that I can try now, which is to add a .then() to the second resume that will do the set up of the audioworkletprocessor module if it hasn't been done already.
I'll let you know when I have a new version to try.