Closed davepagurek closed 3 weeks ago
as a workaround on OP, right now I'm adding window.getAudioContext = undefined
to my setup
.
Thanks for tagging me, @davepagurek. GetAudioContext is a native function, no? Surprised that it is causing an error. What is the error you see? Do you have any examples I can check?
ah if that's a native function then that's probably the issue, it's also defined by this library in p5.prototype, which then gets added to the window in global mode.
It at least used to be a method in the earlier p5 sound library, but it maybe used to get set up earlier or something like that: https://p5js.org/reference/p5/getAudioContext/
I've been testing here https://openprocessing.org/sketch/2338010, commenting the line in setup that sets it back to undefined should get it to trigger again
sorry, my bad, it is not a native function. Yes, I am using P5js getAudioContext to follow any updates on the context and update the volume icon accordingly. Browsers usually mute the sketches on load, so need a way to show users that the sketch is muted.
On line 14554, I see that getAudioContext is being set (albeit, with debugger
), but gets stuck somewhere. I removed the debugger and returned the getContext() directly here. No errors, but the returned audioContext doesn't seem to be used. Maybe the tone.js is using its own audiocontext?
https://openprocessing.org/sketch/2340238
Yes, fixed it here: https://beta.openprocessing.org/sketch/2340238 I also added support to capture Tonejs context mute/suspended state. Weird that it doesn't have suspend() function. But now it also works with the mute icon on OpenProcessing.
Thanks Sinan!
OP has this code in its sketch runner to enable audio:
It's calling
window.getAudioContext
, presumably because this was ok in the previous sound library, but just as a heads up, it's causing errors now.The change to fix this may not need to be in this repo, but I thought I'd raise the issue since it might need some discussion to figure out how OpenProcessing should handle this new version of the library.
cc @msawired