new MidiPorts( dhc, midi )

Description

The MidiPorts class

Parameters
Name Type Description
dhc HUM.DHC

The DHC instance to which it belongs

midi HUM.midi.MidiHub

The MidiHub instance to which it belongs

Details

Members


dhc :HUM.DHC

Description

The DHC instance

Details

midi :HUM.midi.MidiHub

Description

The MidiHub instance

Details

midiAccess :MIDIAccess

Description

The global MIDIAccess object

Details

Web MIDI API specs for 'MIDIAccess'


webMidi :Object

Description

Namespace for WebMidiLink

Properties
Name Type Description
input HUM.midi.WebMidiLinkIn

The WebMidiLinkIn instance

outputs Object.<string, HUM.midi.WebMidiLinkOut>

An array containing all the WebMidiLinkOut instances; the key is the HUM.midi.WebMidiLinkOut#id

outQty number

How many WebMidiLinkOut instances must be created (integer)

Details
Object

selectedOutputs :Map.<string, MIDIPort>

Description

The global map of selected MIDI outputs

Details
Map.<string, MIDIPort>

atLeastOneMidi :Object

Description

Data structure to keep track of how many ports are available and how many are used.
Just used to inform the user about the current MIDI port situation and give the right advices.

Properties
Name Type Description
availablePort Object

Available ports namespace

Name Type Description
input number

Number of available input ports

output number

Number of available output ports

openPort Object

Open ports namespace

Name Type Description
input number

Number of open input ports

output number

Number of open output ports

Details
Object

uiElements :Object

Description

UI HTML elements

Properties
Name Type Description
fn Object.<string, HTMLElement>

Functional UI elements

in Object.<string, HTMLElement>

Input UI elements

out Object.<string, HTMLElement>

Output UI elements

Details
Object

Methods


_postRequestMIDI()

Description

Inintialize the WebMidiLink Output and make accessible the UI modal panel

Details

_initWebMidiLinkOut()

Description

Inintialize the WebMidiLink Output

Details

_onMidiReject( error )

Description

What to do on MIDI Access error, if MIDIAccess exist but there is another kind of problem

Parameters
Name Type Description
error DOMException

Possible error


_onMidiInit( midiAccess )

Description

What to do on MIDI Access, when MIDI is initialized

Parameters
Name Type Description
midiAccess MIDIAccess

The MIDIAccess object; see the Web MIDI API specs

Details

openMidiPanel()

Description

Open the MIDI I/O modal panel on UI

Details

portLogger( midiPort )

Description

Log on the Event Log the informations about a single input or output port

Parameters
Name Type Description
midiPort MIDIPort

The MIDI port

Details

createPortCheckbox( midiPort, htmlElement )

Description

Create a single checkbox and its label in a div.
Assign the onclick event to the the checkbox.

Parameters
Name Type Description
midiPort MIDIPort

The MIDI port; see the Web MIDI API specs

htmlElement HTMLElement

The 'div' containers of the ports on UI ('this.uiElements.out.inputPorts' or 'this.uiElements.out.outputPorts')

Details

portSelect( event )

Description

If an Input port has been selected, open that port and start to listen from it.
If an Output port has been selected, start to send MIDI messages to that port.
The function is invoked when a HTML checkbox has been clicked.

Parameters
Name Type Description
event Event

OnClick event on the MIDI I/O Ports checkboxes

Name Type Description
target Object

The event's target HTML element (could be just a namespace)

Name Type Description
checked boolean

Checkbox checked or not

Details

midiStateRefresh( event )

Description

Midi State Refresh for hot (un)plugging
Update the informations about the state of the MIDI ports/devices in the HTML UI

Parameters
Name Type Description
event MIDIConnectionEvent

Event from MidiAccess.onstatechange; see the Web MIDI API specs

Name Type Description
port MIDIPort

The MIDI Port; see the Web MIDI API specs

Details

checkAtLeastOneMidi( xPut, isOpen )

Description

Check if there is at least one available MIDI port (Input or Output)
Check if there is at least one open MIDI port (Input or Output)

Parameters
Name Type Description
xPut 'i' | 'o' | 'io'

Check for Input ('i'), Output port ('o') or both ('io')

isOpen boolean

false: Check if there are ports selected and used by the user
true: Check if there are available ports

Details