OpenShot Library | OpenShotAudio 0.2.2
juce::MidiInput Class Referencefinal

Represents a midi input device. More...

#include <juce_MidiDevices.h>

Public Member Functions

 ~MidiInput ()
 Destructor.
 
void start ()
 Starts the device running. More...
 
void stop ()
 Stops the device running. More...
 
MidiDeviceInfo getDeviceInfo () const noexcept
 Returns the MidiDeviceInfo struct containing some information about this device. More...
 
String getIdentifier () const noexcept
 Returns the identifier of this device. More...
 
String getName () const noexcept
 Returns the name of this device. More...
 
void setName (const String &newName) noexcept
 Sets a custom name for the device. More...
 

Static Public Member Functions

static Array< MidiDeviceInfogetAvailableDevices ()
 Returns a list of the available midi input devices. More...
 
static MidiDeviceInfo getDefaultDevice ()
 Returns the MidiDeviceInfo of the default midi input device to use.
 
static std::unique_ptr< MidiInputopenDevice (const String &deviceIdentifier, MidiInputCallback *callback)
 Tries to open one of the midi input devices. More...
 
static std::unique_ptr< MidiInputcreateNewDevice (const String &deviceName, MidiInputCallback *callback)
 This will try to create a new midi input device (only available on Linux, macOS and iOS). More...
 
static StringArray getDevices ()
 Deprecated.
 
static int getDefaultDeviceIndex ()
 Deprecated.
 
static std::unique_ptr< MidiInputopenDevice (int, MidiInputCallback *)
 Deprecated.
 

Detailed Description

Represents a midi input device.

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

Definition at line 85 of file juce_MidiDevices.h.

Member Function Documentation

◆ getAvailableDevices()

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

◆ openDevice()

static std::unique_ptr< MidiInput > juce::MidiInput::openDevice ( const String deviceIdentifier,
MidiInputCallback callback 
)
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
deviceIdentifierthe ID of the device to open - use the getAvailableDevices() method to find the available devices that can be opened
callbackthe object that will receive the midi messages from this device
See also
MidiInputCallback, getDevices

Referenced by juce::AudioDeviceManager::setMidiInputDeviceEnabled().

◆ createNewDevice()

static std::unique_ptr< MidiInput > juce::MidiInput::createNewDevice ( const String deviceName,
MidiInputCallback callback 
)
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
deviceNamethe name of the device to create
callbackthe 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
inlinenoexcept

Returns the MidiDeviceInfo struct containing some information about this device.

Definition at line 152 of file juce_MidiDevices.h.

◆ getIdentifier()

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

Returns the identifier of this device.

Definition at line 155 of file juce_MidiDevices.h.

◆ getName()

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

Returns the name of this device.

Definition at line 158 of file juce_MidiDevices.h.

◆ setName()

void juce::MidiInput::setName ( const String newName)
inlinenoexcept

Sets a custom name for the device.

Definition at line 161 of file juce_MidiDevices.h.


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