Loading...
Searching...
No Matches
juce::MidiInput Class Referencefinal

## Detailed Description

Represents a midi input device using the old bytestream format.

To create one of these, use the static getAvailableDevices() method to find out what inputs are available, and then use the openDevice() method to try to open one.

See also
  MidiOutput

The documentation for this class was generated from the following file:

- juce_audio_devices/midi_io/juce_MidiDevices.h

## Public Member Functions

| MidiInput (MidiInput &&)=delete
MidiInput & | operator= (MidiInput &&)=delete
| ~MidiInput ()
void | start ()
| Starts the device running.
void | stop ()
| Stops the device running.
MidiDeviceInfo | getDeviceInfo () const noexcept
| Returns the MidiDeviceInfo struct containing some information about this device.
String | getIdentifier () const noexcept
| Returns the identifier of this device.
String | getName () const noexcept
| Returns the name of this device.
void | setName (const String &newName) noexcept
| Sets a custom name for the device.
uint8_t | getGroup () const
| In the case that this input refers to a specific group of a UMP input, this returns the index of the group.
ump::EndpointId | getEndpointId () const
| Returns the EndpointId that uniquely identifies the UMP endpoint that contains this input.
void | addCallback (MidiInputCallback &)
| Adds an input listener.
void | removeCallback (MidiInputCallback &)
| Removed an input listener.

## Static Public Member Functions

static Array< MidiDeviceInfo > | getAvailableDevices ()
| Returns a list of the available midi input devices.
static MidiDeviceInfo | getDefaultDevice ()
| Returns the MidiDeviceInfo of the default midi input device to use.
static std::unique_ptr< MidiInput > | openDevice (const String &deviceIdentifier, MidiInputCallback *callback=nullptr)
| Tries to open one of the midi input devices.
static std::unique_ptr< MidiInput > | createNewDevice (const String &deviceName, MidiInputCallback *callback=nullptr)
| This will try to create a new midi input device (only available on Linux, macOS and iOS).

## Constructors and Destructors

## MidiInput()

juce::MidiInput::MidiInput | ( | MidiInput && |  | ) |

delete

References MidiInput().

Referenced by MidiInput(), operator=(), and removeCallback().

## ~MidiInput()

juce::MidiInput::~MidiInput | ( |  | ) |

## Member Functions

## operator=()

MidiInput & juce::MidiInput::operator= | ( | MidiInput && |  | ) |

delete

References MidiInput().

## getAvailableDevices()

Array< MidiDeviceInfo > juce::MidiInput::getAvailableDevices | ( |  | ) |

static

Returns a list of the available midi input devices.

You can open one of the devices by passing its identifier into the openDevice() method.

See also
  MidiDeviceInfo, getDevices, getDefaultDeviceIndex, openDevice

## getDefaultDevice()

MidiDeviceInfo juce::MidiInput::getDefaultDevice | ( |  | ) |

static

Returns the MidiDeviceInfo of the default midi input device to use.

## openDevice()

std::unique_ptr< MidiInput > juce::MidiInput::openDevice | ( | const String & | deviceIdentifier,
|  | MidiInputCallback * | callback = nullptr )

static

Tries to open one of the midi input devices.

This will return a MidiInput object if it manages to open it, you can then call start() and stop() on this device.

If the device can't be opened, this will return an empty object.

Parameters

  deviceIdentifier | the ID of the device to open - use the getAvailableDevices() method to find the available devices that can be opened
  callback | the object that will receive the midi messages from this device, you can also add and remove receivers with addCallback() and removeCallback()

See also
  MidiInputCallback, getDevices

## createNewDevice()

std::unique_ptr< MidiInput > juce::MidiInput::createNewDevice | ( | const String & | deviceName,
|  | MidiInputCallback * | callback = nullptr )

static

This will try to create a new midi input device (only available on Linux, macOS and iOS).

This will attempt to create a new midi input device with the specified name for other apps to connect to.

NB - if you are calling this method on iOS you must have enabled the "Audio Background Capability" setting in the iOS exporter otherwise this method will fail.

Returns an empty object if a device can't be created.

Parameters

  deviceName | the name of the device to create
  callback | the object that will receive the midi messages from this device

## start()

void juce::MidiInput::start | ( |  | ) |

Starts the device running.

After calling this, the device will start sending midi messages to the MidiInputCallback object that was specified when the openDevice() method was called.

See also
  stop

## stop()

void juce::MidiInput::stop | ( |  | ) |

Stops the device running.

See also
  start

## getDeviceInfo()

MidiDeviceInfo juce::MidiInput::getDeviceInfo | ( |  | ) | const

noexcept

Returns the MidiDeviceInfo struct containing some information about this device.

Referenced by getIdentifier(), and getName().

## getIdentifier()

String juce::MidiInput::getIdentifier | ( |  | ) | const

inline noexcept

Returns the identifier of this device.

References getDeviceInfo(), and getIdentifier().

Referenced by getIdentifier().

## getName()

String juce::MidiInput::getName | ( |  | ) | const

inline noexcept

Returns the name of this device.

References getDeviceInfo().

## setName()

void juce::MidiInput::setName | ( | const String & | newName | ) |

noexcept

Sets a custom name for the device.

## getGroup()

uint8_t juce::MidiInput::getGroup | ( |  | ) | const

In the case that this input refers to a specific group of a UMP input, this returns the index of the group.

## getEndpointId()

ump::EndpointId juce::MidiInput::getEndpointId | ( |  | ) | const

Returns the EndpointId that uniquely identifies the UMP endpoint that contains this input.

## addCallback()

void juce::MidiInput::addCallback | ( | MidiInputCallback & |  | ) |

Adds an input listener.

## removeCallback()

void juce::MidiInput::removeCallback | ( | MidiInputCallback & |  | ) |

Removed an input listener.

References MidiInput().

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited