OpenShot Library | OpenShotAudio
0.2.2
|
Represents a midi output device. More...
#include <juce_MidiDevices.h>
Public Member Functions | |
~MidiOutput () override | |
Destructor. 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... | |
void | sendMessageNow (const MidiMessage &message) |
Sends out a MIDI message immediately. More... | |
void | sendBlockOfMessagesNow (const MidiBuffer &buffer) |
Sends out a sequence of MIDI messages immediately. More... | |
void | 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. More... | |
void | clearAllPendingMessages () |
Gets rid of any midi messages that had been added by sendBlockOfMessages(). More... | |
void | startBackgroundThread () |
Starts up a background thread so that the device can send blocks of data. More... | |
void | stopBackgroundThread () |
Stops the background thread, and clears any pending midi events. More... | |
Static Public Member Functions | |
static Array< MidiDeviceInfo > | getAvailableDevices () |
Returns a list of the available midi output devices. More... | |
static MidiDeviceInfo | getDefaultDevice () |
Returns the MidiDeviceInfo of the default midi output device to use. More... | |
static std::unique_ptr< MidiOutput > | openDevice (const String &deviceIdentifier) |
Tries to open one of the midi output devices. More... | |
static std::unique_ptr< MidiOutput > | createNewDevice (const String &deviceName) |
This will try to create a new midi output device (only available on Linux, macOS and iOS). More... | |
static StringArray | getDevices () |
Deprecated. More... | |
static int | getDefaultDeviceIndex () |
Deprecated. More... | |
static std::unique_ptr< MidiOutput > | openDevice (int) |
Deprecated. 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.
Definition at line 243 of file juce_MidiDevices.h.
|
override |
Destructor.
|
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.
Referenced by juce::AudioDeviceManager::initialise(), and juce::AudioDeviceManager::setDefaultMidiOutput().
|
static |
Returns the MidiDeviceInfo of the default midi output device to use.
|
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().
|
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.
deviceName | the name of the device to create |
|
inlinenoexcept |
Returns the MidiDeviceInfo struct containing some information about this device.
Definition at line 292 of file juce_MidiDevices.h.
|
inlinenoexcept |
Returns the identifier of this device.
Definition at line 295 of file juce_MidiDevices.h.
|
inlinenoexcept |
Returns the name of this device.
Definition at line 298 of file juce_MidiDevices.h.
|
inlinenoexcept |
Sets a custom name for the device.
Definition at line 301 of file juce_MidiDevices.h.
void juce::MidiOutput::sendMessageNow | ( | const MidiMessage & | message | ) |
Sends out a MIDI message immediately.
void juce::MidiOutput::sendBlockOfMessagesNow | ( | const MidiBuffer & | buffer | ) |
Sends out a sequence of MIDI messages immediately.
Definition at line 31 of file juce_MidiDevices.cpp.
References juce::MidiBuffer::Iterator::getNextEvent().
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 41 of file juce_MidiDevices.cpp.
References juce::MidiBuffer::data, and juce::MidiBuffer::Iterator::getNextEvent().
void juce::MidiOutput::clearAllPendingMessages | ( | ) |
Gets rid of any midi messages that had been added by sendBlockOfMessages().
Definition at line 83 of file juce_MidiDevices.cpp.
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 95 of file juce_MidiDevices.cpp.
void juce::MidiOutput::stopBackgroundThread | ( | ) |
Stops the background thread, and clears any pending midi events.
Definition at line 100 of file juce_MidiDevices.cpp.
References juce::Time::getMillisecondCounter(), and juce::Time::waitForMillisecondCounter().
|
static |
Deprecated.
|
static |
Deprecated.
|
static |
Deprecated.