Set Omni/Mono/Poly mode

midi_mode  mode (mode_keyword)

Sends the Omni/Mono/Poly MIDI mode message to all connected MIDI devices on all channels. Use the port: and channel: opts to restrict which MIDI ports and channels are used.

Valid modes are:

:omni_off - Omni Mode Off :omni_on - Omni Mode On :mono - Mono Mode On (Poly Off). Set num_chans: to be the number of channels to use (Omni Off) or 0 (Omni On). Default for num_chans: is 16. :poly - Poly Mode On (Mono Off)

Note that this fn also includes the behaviour of midi_all_notes_off.

[MIDI 1.0 Specification - Channel Mode Messages - Omni Mode Off Omni Mode On Mono Mode On (Poly Off) Poly Mode On](https://www.midi.org/specifications/item/table-1-summary-of-midi-message)

Introduced in v3.0

Options

channel:

Channel to send the MIDI mode message to

port:

MIDI port to send to

mode:

Mode keyword - one of :omni_off, :omni_on, :mono or :poly

num_chans:

Used in mono mode only - Number of channels (defaults to 16)

on:

If specified and false/nil/0 will stop the midi local control off message from being sent out. (Ensures all opts are evaluated in this call to midi_local_control_off regardless of value).

Examples

# Example 1

midi_mode :omni_on



#=> Turn Omni Mode On on all ports and channels



# Example 2

midi_mode :mono, num_chans: 5



#=> Mono Mode On, Omni off using 5 channels.



# Example 3

midi_mode :mono, num_chans: 0



#=> Mono Mode On, Omni on.



# Example 4

midi_mode :mono



#=> Mono Mode On, Omni off using 16 channels (the default) .