OpenShot Audio Library | OpenShotAudio: juce::MidiOutput Class Reference

OpenShot Audio Library | OpenShotAudio 0.3.1

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

`#include <juce_MidiDevices.h>`

Inheritance diagram for juce::MidiOutput:

## 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 ()

## 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)

## 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

Definition at line 239 of file juce_MidiDevices.h.

## Constructor & Destructor Documentation

## ◆ ~MidiOutput()

juce::MidiOutput::~MidiOutput | ( |  | ) |
| override

Destructor.

## Member Function Documentation

## ◆ clearAllPendingMessages()

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.

## ◆ getAvailableDevices()

static 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

Referenced by juce::AudioDeviceManager::setDefaultMidiOutput().

## ◆ getDefaultDevice()

static MidiDeviceInfo juce::MidiOutput::getDefaultDevice | ( |  | ) |
| static

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

## ◆ getDefaultDeviceIndex()

static int juce::MidiOutput::getDefaultDeviceIndex | ( |  | ) |
| static

Deprecated.

## ◆ getDeviceInfo()

MidiDeviceInfo juce::MidiOutput::getDeviceInfo | ( |  | ) | const
| inlinenoexcept

Returns the MidiDeviceInfo struct containing some information about this device.

Definition at line 288 of file juce_MidiDevices.h.

## ◆ getDevices()

static StringArray juce::MidiOutput::getDevices | ( |  | ) |
| static

Deprecated.

## ◆ getIdentifier()

String juce::MidiOutput::getIdentifier | ( |  | ) | const
| inlinenoexcept

Returns the identifier of this device.

Definition at line 291 of file juce_MidiDevices.h.

## ◆ getName()

String juce::MidiOutput::getName | ( |  | ) | const
| inlinenoexcept

Returns the name of this device.

Definition at line 294 of file juce_MidiDevices.h.

## ◆ openDevice() [1/2]

static 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

  deviceIdentifier | the ID of the device to open - use the getAvailableDevices() method to find the available devices that can be opened

See also
  getDevices

Referenced by juce::AudioDeviceManager::setDefaultMidiOutputDevice().

## ◆ openDevice() [2/2]

static std::unique_ptr< MidiOutput > juce::MidiOutput::openDevice | ( | int |  | ) |
| static

Deprecated.

## ◆ 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 41 of file juce_MidiDevices.cpp.

## ◆ sendBlockOfMessagesNow()

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

Sends out a sequence of MIDI messages immediately.

Definition at line 31 of file juce_MidiDevices.cpp.

## ◆ sendMessageNow()

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

Sends out a MIDI message immediately.

## ◆ setName()

void juce::MidiOutput::setName | ( | const String & | newName | ) |
| inlinenoexcept

Sets a custom name for the device.

Definition at line 297 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 95 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 100 of file juce_MidiDevices.cpp.

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

- juce_MidiDevices.h
- juce_MidiDevices.cpp