|
LMMS
|
#include <juce_MidiDevices.h>
Classes | |
| struct | PendingMessage |
| class | Pimpl |
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) |
Private Member Functions | |
| MidiOutput (const String &, const String &) | |
| void | run () override |
| Private Member Functions inherited from juce::Thread | |
| Thread (const String &threadName, size_t threadStackSize=0) | |
| virtual | ~Thread () |
| void | startThread () |
| void | startThread (int priority) |
| bool | stopThread (int timeOutMilliseconds) |
| bool | isThreadRunning () const |
| void | signalThreadShouldExit () |
| bool | threadShouldExit () const |
| bool | waitForThreadToExit (int timeOutMilliseconds) const |
| void | addListener (Listener *) |
| void | removeListener (Listener *) |
| bool | setPriority (int priority) |
| void | setAffinityMask (uint32 affinityMask) |
| bool | wait (int timeOutMilliseconds) const |
| void | notify () const |
| ThreadID | getThreadId () const noexcept |
| const String & | getThreadName () const noexcept |
Private Attributes | |
| MidiDeviceInfo | deviceInfo |
| std::unique_ptr< Pimpl > | internal |
| CriticalSection | lock |
| PendingMessage * | firstMessage = nullptr |
Additional Inherited Members | |
| Private Types inherited from juce::Thread | |
| enum | { realtimeAudioPriority = -1 } |
| using | ThreadID = void* |
| Static Private Member Functions inherited from juce::Thread | |
| static void | launch (std::function< void()> functionToRun) |
| static bool | currentThreadShouldExit () |
| static bool | setCurrentThreadPriority (int priority) |
| static void JUCE_CALLTYPE | setCurrentThreadAffinityMask (uint32 affinityMask) |
| static void JUCE_CALLTYPE | sleep (int milliseconds) |
| static void JUCE_CALLTYPE | yield () |
| static ThreadID JUCE_CALLTYPE | getCurrentThreadId () |
| static Thread *JUCE_CALLTYPE | getCurrentThread () |
| static void JUCE_CALLTYPE | setCurrentThreadName (const String &newThreadName) |
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.
@tags{Audio}
|
overridedefault |
Destructor.
|
explicitprivate |
| void juce::MidiOutput::clearAllPendingMessages | ( | ) |
Gets rid of any midi messages that had been added by sendBlockOfMessages().
|
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.
|
static |
|
inlinenoexcept |
Returns the MidiDeviceInfo struct containing some information about this device.
|
static |
|
inlinenoexcept |
Returns the identifier of this device.
|
inlinenoexcept |
Returns the name of this device.
|
inlinenoexcept |
Returns true if the background thread used to send blocks of data is running.
|
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 |
|
static |
|
overrideprivatevirtual |
Must be implemented to perform the thread's actual code.
Remember that the thread must regularly check the threadShouldExit() method whilst running, and if this returns true it should return from the run() method as soon as possible to avoid being forcibly killed.
Implements juce::Thread.
| 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.
| void juce::MidiOutput::sendBlockOfMessagesNow | ( | const MidiBuffer & | buffer | ) |
Sends out a sequence of MIDI messages immediately.
| void juce::MidiOutput::sendMessageNow | ( | const MidiMessage & | message | ) |
Sends out a MIDI message immediately.
Sets a custom name for the device.
| 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().
| void juce::MidiOutput::stopBackgroundThread | ( | ) |
Stops the background thread, and clears any pending midi events.
|
private |
|
private |
|
private |
|
private |