MidiOutputThreadImplementation

Undocumented in source.

Constructors

this
this(string device, bool startSuspended)

If you use the device string "DUMMY", it will still give you a timed thread with callbacks, but will not actually write to any midi device. You might use this if you want, for example, to display notes visually but not play them so a student can follow along with the computer.

Members

Functions

exit
void exit()

Exits the thread. The object is not usable again after calling this.

injectEvent
void injectEvent(ubyte a, ubyte b, ubyte c)
void injectEvent(MidiEvent event)

Injects a midi event to the stream. It will be triggered as soon as possible and will NOT trigger you callback.

loadStream
void loadStream(const(PlayStreamEvent)[] pendingStream)

If you want to use only injected events as a play stream, you might use arsd.midi.longWait here and just inject things as they come.

pause
void pause()

Pauses the midi playback. Will send a silence notes controller message to all channels, but otherwise leaves everything in place for a future call to unpause.

play
void play()

Instructs the player to start playing - unsuspend if suspended, unpause if paused. If it is already playing, it will do nothing.

setCallback
void setCallback(bool delegate(const PlayStreamEvent) callback)

Set this if you want to filter or otherwise respond to events.

setSpeed
void setSpeed(float multiplier)

Changes the speed of the playback clock to the given multiplier. So passing 2.0 will play at double real time. Calling it again will still play a double real time; the multiplier is always relative to real time and will not stack.

setStreamFinishedCallback
void setStreamFinishedCallback(void delegate() callback)

Set this to customize what happens when a stream finishes.

stop
void stop()

Stops the current playback stream. Will call the callback you set in setCallback.

suspend
void suspend()

Stops playback and closes the midi device, but keeps the thread waiting for an unsuspend call.

togglePause
void togglePause()
unpause
void unpause()

Pauses the midi playback. Will send a silence notes controller message to all channels, but otherwise leaves everything in place for a future call to unpause.

unsuspend
void unsuspend()

Stops playback and closes the midi device, but keeps the thread waiting for an unsuspend call.

Meta