Represents a midi output device.
More...
Represents a midi output device.
To create one of these, use the static getAvailableDevices() method to find out what outputs are available, and then use the openDevice() method to try to open one.
- See also
- MidiInput
◆ ~MidiOutput()
MidiOutput::~MidiOutput |
( |
| ) |
|
|
override |
◆ getAvailableDevices()
◆ getDefaultDevice()
◆ openDevice() [1/2]
static std::unique_ptr<MidiOutput> MidiOutput::openDevice |
( |
const String & |
deviceIdentifier | ) |
|
|
static |
Tries to open one of the midi output devices.
This will return a MidiOutput object if it manages to open it, you can then send messages to 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 |
- See also
- getDevices
◆ createNewDevice()
static std::unique_ptr<MidiOutput> MidiOutput::createNewDevice |
( |
const String & |
deviceName | ) |
|
|
static |
This will try to create a new midi output device (only available on Linux, macOS and iOS).
This will attempt to create a new midi output device with the specified name that other apps can connect to and use as their midi input.
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 |
◆ getDeviceInfo()
Returns the MidiDeviceInfo struct containing some information about this device.
◆ getIdentifier()
String MidiOutput::getIdentifier |
( |
| ) |
const |
|
noexcept |
Returns the identifier of this device.
◆ getName()
String MidiOutput::getName |
( |
| ) |
const |
|
noexcept |
Returns the name of this device.
◆ setName()
void MidiOutput::setName |
( |
const String & |
newName | ) |
|
|
noexcept |
◆ sendMessageNow()
void MidiOutput::sendMessageNow |
( |
const MidiMessage & |
message | ) |
|
Sends out a MIDI message immediately.
◆ sendBlockOfMessagesNow()
void MidiOutput::sendBlockOfMessagesNow |
( |
const MidiBuffer & |
buffer | ) |
|
Sends out a sequence of MIDI messages immediately.
◆ sendBlockOfMessages()
void MidiOutput::sendBlockOfMessages |
( |
const MidiBuffer & |
buffer, |
|
|
double |
millisecondCounterToStartAt, |
|
|
double |
samplesPerSecondForBuffer |
|
) |
| |
This lets you supply a block of messages that will be sent out at some point in the future.
The MidiOutput class has an internal thread that can send out timestamped messages - this appends a set of messages to its internal buffer, ready for sending.
This will only work if you've already started the thread with startBackgroundThread().
A time is specified, at which the block of messages should be sent. This time uses the same time base as Time::getMillisecondCounter(), and must be in the future.
The samplesPerSecondForBuffer parameter indicates the number of samples per second used by the MidiBuffer. Each event in a MidiBuffer has a sample position, and the samplesPerSecondForBuffer value is needed to convert this sample position to a real time.
◆ clearAllPendingMessages()
void MidiOutput::clearAllPendingMessages |
( |
| ) |
|
◆ startBackgroundThread()
void MidiOutput::startBackgroundThread |
( |
| ) |
|
Starts up a background thread so that the device can send blocks of data.
Call this to get the device ready, before using sendBlockOfMessages().
◆ stopBackgroundThread()
void MidiOutput::stopBackgroundThread |
( |
| ) |
|
◆ getDevices()
◆ getDefaultDeviceIndex()
static int MidiOutput::getDefaultDeviceIndex |
( |
| ) |
|
|
static |
◆ openDevice() [2/2]
static std::unique_ptr<MidiOutput> MidiOutput::openDevice |
( |
int |
| ) |
|
|
static |
The documentation for this class was generated from the following file: