#include <juce_MidiDevices.h>
Public Member Functions | |
~MidiOutput () override | |
MidiDeviceInfo | getDeviceInfo () const noexcept |
String | getIdentifier () const noexcept |
String | getName () const noexcept |
void | setName (const String &newName) noexcept |
void | sendMessageNow (const MidiMessage &message) |
void | sendBlockOfMessagesNow (const MidiBuffer &buffer) |
void | sendBlockOfMessages (const MidiBuffer &buffer, double millisecondCounterToStartAt, double samplesPerSecondForBuffer) |
void | clearAllPendingMessages () |
void | startBackgroundThread () |
void | stopBackgroundThread () |
bool | isBackgroundThreadRunning () const noexcept |
Static Public Member Functions | |
static Array< MidiDeviceInfo > | getAvailableDevices () |
static MidiDeviceInfo | getDefaultDevice () |
static std::unique_ptr< MidiOutput > | openDevice (const String &deviceIdentifier) |
static StringArray | getDevices () |
static int | getDefaultDeviceIndex () |
static std::unique_ptr< MidiOutput > | openDevice (int) |
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.
Definition at line 324 of file juce_MidiDevices.h.
|
override |
Destructor.
void juce::MidiOutput::clearAllPendingMessages | ( | ) |
Gets rid of any midi messages that had been added by sendBlockOfMessages().
Definition at line 157 of file juce_MidiDevices.cpp.
Referenced by sendMessageNow().
|
static |
Returns a list of the available midi output devices.
You can open one of the devices by passing its identifier into the openDevice() method.
|
static |
Returns the MidiDeviceInfo of the default midi output device to use.
|
inlinenoexcept |
Returns the MidiDeviceInfo struct containing some information about this device.
Definition at line 373 of file juce_MidiDevices.h.
|
inlinenoexcept |
Returns the identifier of this device.
Definition at line 376 of file juce_MidiDevices.h.
|
inlinenoexcept |
Returns the name of this device.
Definition at line 379 of file juce_MidiDevices.h.
|
inlinenoexcept |
Returns true if the background thread used to send blocks of data is running.
Definition at line 428 of file juce_MidiDevices.h.
|
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.
deviceIdentifier | the ID of the device to open - use the getAvailableDevices() method to find the available devices that can be opened |
Referenced by juce::AudioDeviceManager::setDefaultMidiOutputDevice().
void juce::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.
Definition at line 118 of file juce_MidiDevices.cpp.
Referenced by sendMessageNow().
void juce::MidiOutput::sendBlockOfMessagesNow | ( | const MidiBuffer & | buffer | ) |
Sends out a sequence of MIDI messages immediately.
Definition at line 112 of file juce_MidiDevices.cpp.
Referenced by sendMessageNow().
void juce::MidiOutput::sendMessageNow | ( | const MidiMessage & | message | ) |
Sends out a MIDI message immediately.
Referenced by sendBlockOfMessagesNow().
|
inlinenoexcept |
Sets a custom name for the device.
Definition at line 382 of file juce_MidiDevices.h.
void juce::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().
Definition at line 169 of file juce_MidiDevices.cpp.
Referenced by sendMessageNow().
void juce::MidiOutput::stopBackgroundThread | ( | ) |
Stops the background thread, and clears any pending midi events.
Definition at line 174 of file juce_MidiDevices.cpp.
Referenced by sendMessageNow().