notator / WebMIDISynthHost

Hosts software Web MIDI Synths that implement a superset of the Web MIDI API Output Device interface.
Other
18 stars 3 forks source link

MIDIPort open() and close() functions #24

Open notator opened 8 years ago

notator commented 8 years ago

MIDIPort open() and close() are defined for MIDIPort in Web MIDI API §4.6. I have defined these as empty stubs in both synths, so that the code for selecting synths in my Assistant Performer does not have to be changed. This solution is probably too simple. Possibly my init() functions should be renamed open().

I'm not sure if open() and close() really MUST be defined for soft synths. Software synths have constructors, and can be set to null. The situation is different for hardware synths...

Question: Why do software synths have to be opened asynchronously? I suspect that the current version of the Web MIDI API stipulates that open() must be done asynchronously because that makes sense for hardware synths.

notator commented 5 years ago

14 Dec 2018: To comply with Chrome's autoplay policy [1] (December 2018), in which the audioContext object has to be created after the user has interacted with the site, I have now moved all the synths' initialisation code into their open() functions, and called them when the corresponding synth is selected in the main synth selector.

But I'm still not sure about the questions raised above.

[1] For Chrome's policy, see: https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#webaudio