AVMIDIPlayer Extension (Alpha)
An extension for playing MIDI files. This is currently in alpha; please see below for a list of features and bugs. The function names are currently intended to match that of Apple’s AVMIDIPlayer; however, this is subject to change upon release.
This extension uses KyoSherlock’s MidiDriver library, which is licensed under the Apache License.
- Init(contentsOf, soundBankURL): Initializes the component with the contents of the MIDI file specified by the path, using the specified sound bank (SF2). This MUST be called before doing anything else, and to change the loaded MIDI or sound bank file. File paths can be used in the same way as the ReadFrom method of the File component (docs).
- Play(): Plays the sequence.
- Stop(): Stops playing the sequence.
Completed(): A block to be called when a MIDI playback request is completed.
This currently is never called.Fixed.
get: A Boolean value that indicates whether the sequence is playing.
get: The length of the currently loaded file, in seconds.
get set: The current playback position, in seconds.
get set: The playback rate of the player.
You cannot currently access packaged assets (a path starting with two slashes will throw anFixed.
UnsupportedOperationException, since I haven’t implemented this yet). One workaround is to use the Web component to download the files you need to external storage or to the private user data directory and access them from there.
- Friendly error handling is buggy right now - please use
AIX: (coming soon)
AIA: (will return soon)
Feel free to reply with any feedback, questions, comments, and/or concerns you may have.