JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
juce::MidiOutput Class Referencefinal

Represents a midi output device. More...

#include "juce_MidiDevices.h"

Inheritance diagram for juce::MidiOutput:
juce::Thread

Classes

class  Pimpl
 

Public Member Functions

 ~MidiOutput () override
 Destructor.
 
MidiDeviceInfo getDeviceInfo () const noexcept
 Returns the MidiDeviceInfo struct containing some information about this device.
 
String getIdentifier () const noexcept
 Returns the identifier of this device.
 
String getName () const noexcept
 Returns the name of this device.
 
void setName (const String &newName) noexcept
 Sets a custom name for the device.
 
void sendMessageNow (const MidiMessage &message)
 Sends out a MIDI message immediately.
 
void sendBlockOfMessagesNow (const MidiBuffer &buffer)
 Sends out a sequence of MIDI messages immediately.
 
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.
 
void clearAllPendingMessages ()
 Gets rid of any midi messages that had been added by sendBlockOfMessages().
 
void startBackgroundThread ()
 Starts up a background thread so that the device can send blocks of data.
 
void stopBackgroundThread ()
 Stops the background thread, and clears any pending midi events.
 
bool isBackgroundThreadRunning () const noexcept
 Returns true if the background thread used to send blocks of data is running.
 

Static Public Member Functions

static Array< MidiDeviceInfogetAvailableDevices ()
 Returns a list of the available midi output devices.
 
static MidiDeviceInfo getDefaultDevice ()
 Returns the MidiDeviceInfo of the default midi output device to use.
 
static std::unique_ptr< MidiOutputopenDevice (const String &deviceIdentifier)
 Tries to open one of the midi output devices.
 
static std::unique_ptr< MidiOutputcreateNewDevice (const String &deviceName)
 This will try to create a new midi output device (only available on Linux, macOS and iOS).
 

Detailed Description

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

@tags{Audio}

Definition at line 324 of file juce_MidiDevices.h.


Class Documentation

◆ juce::MidiOutput::Pimpl

class juce::MidiOutput::Pimpl

Definition at line 762 of file juce_Midi_linux.cpp.

Constructor & Destructor Documentation

◆ ~MidiOutput()

juce::MidiOutput::~MidiOutput ( )
override

Destructor.

Definition at line 764 of file juce_Midi_linux.cpp.

Member Function Documentation

◆ clearAllPendingMessages()

void juce::MidiOutput::clearAllPendingMessages ( )

Gets rid of any midi messages that had been added by sendBlockOfMessages().

Definition at line 159 of file juce_MidiDevices.cpp.

◆ createNewDevice()

std::unique_ptr< MidiOutput > juce::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
deviceNamethe name of the device to create

Definition at line 769 of file juce_Midi_linux.cpp.

◆ getAvailableDevices()

Array< MidiDeviceInfo > juce::MidiOutput::getAvailableDevices ( )
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.

See also
MidiDeviceInfo, getDevices, getDefaultDeviceIndex, openDevice

Definition at line 766 of file juce_Midi_linux.cpp.

◆ getDefaultDevice()

MidiDeviceInfo juce::MidiOutput::getDefaultDevice ( )
static

Returns the MidiDeviceInfo of the default midi output device to use.

Definition at line 767 of file juce_Midi_linux.cpp.

◆ getDeviceInfo()

MidiDeviceInfo juce::MidiOutput::getDeviceInfo ( ) const
noexcept

Returns the MidiDeviceInfo struct containing some information about this device.

Definition at line 373 of file juce_MidiDevices.h.

◆ getIdentifier()

String juce::MidiOutput::getIdentifier ( ) const
noexcept

Returns the identifier of this device.

Definition at line 376 of file juce_MidiDevices.h.

◆ getName()

String juce::MidiOutput::getName ( ) const
noexcept

Returns the name of this device.

Definition at line 379 of file juce_MidiDevices.h.

◆ isBackgroundThreadRunning()

bool juce::MidiOutput::isBackgroundThreadRunning ( ) const
noexcept

Returns true if the background thread used to send blocks of data is running.

See also
startBackgroundThread, stopBackgroundThread

Definition at line 428 of file juce_MidiDevices.h.

◆ openDevice()

std::unique_ptr< MidiOutput > juce::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
deviceIdentifierthe ID of the device to open - use the getAvailableDevices() method to find the available devices that can be opened
See also
getDevices

Definition at line 768 of file juce_Midi_linux.cpp.

◆ sendBlockOfMessages()

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 120 of file juce_MidiDevices.cpp.

◆ sendBlockOfMessagesNow()

void juce::MidiOutput::sendBlockOfMessagesNow ( const MidiBuffer buffer)

Sends out a sequence of MIDI messages immediately.

Definition at line 114 of file juce_MidiDevices.cpp.

◆ sendMessageNow()

void juce::MidiOutput::sendMessageNow ( const MidiMessage message)

Sends out a MIDI message immediately.

Definition at line 765 of file juce_Midi_linux.cpp.

◆ setName()

void juce::MidiOutput::setName ( const String newName)
noexcept

Sets a custom name for the device.

Definition at line 382 of file juce_MidiDevices.h.

◆ startBackgroundThread()

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 171 of file juce_MidiDevices.cpp.

◆ stopBackgroundThread()

void juce::MidiOutput::stopBackgroundThread ( )

Stops the background thread, and clears any pending midi events.

See also
startBackgroundThread

Definition at line 176 of file juce_MidiDevices.cpp.


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