Jazz-Soft.net

We make it sound!

Home » Documentation » JZZ.js » JZZ engine

JZZ engine

JZZ()

JZZ() is the first function you are going to call in your MIDI application.

On the first call, the function checks it's arguments, creates the singleton engine object and tries to initialize it.

On all successive calls, it returns the same object and ignores the arguments.

Engine is considered successfully initialized if there is at least one MIDI-Out or MIDI-In port that can be opened.

If the engine fails to initialize, it will execute its first or call (if there is one), and ignore all further calls.

Argument can be either empty or an object(map) with the following keys:

close()

engine.close() - closes all ports.

No other calls except the common calls can be chained to the closed engine.

This call is optional in HTML, but may be required in Node.js if there are any MIDI-In ports remaining open.

info()

engine.info() - returns an info object with the following keys:

Currently, implementation can be one of the following:

refresh()

engine.refresh() - refreshes the list of available input/output ports.

For the case if a device was disconnected or a new device connected during the session.

openMidiIn()

engine.openMidiIn() - opens the MIDI-In port. See more details here.

openMidiOut()

engine.openMidiOut() - opens the MIDI-Out port. See more details here.

Other calls

engine.or(), engine.and(), engine.wait()

Example

JZZ({sysex:true}).or('Cannot start MIDI engine!')
    .and(function(){ console.log(this.info()); })
    .wait(10000).refresh()
    .and(function(){ console.log(this.info()); })
    .and('Thank you!');

Add-ons

See also