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

OpenShot Audio Library | OpenShotAudio 0.3.2

Loading...
Searching...
No Matches
Public Member Functions | List of all members
juce::MidiMessageCollector Class Reference

`#include <juce_MidiMessageCollector.h>`

Inheritance diagram for juce::MidiMessageCollector:

## Public Member Functions
| MidiMessageCollector ()
| ~MidiMessageCollector () override
void | reset (double sampleRate)
void | addMessageToQueue (const MidiMessage &message)
void | removeNextBlockOfMessages (MidiBuffer &destBuffer, int numSamples)
void | handleNoteOn (MidiKeyboardState *, int midiChannel, int midiNoteNumber, float velocity) override
void | handleNoteOff (MidiKeyboardState *, int midiChannel, int midiNoteNumber, float velocity) override
void | handleIncomingMidiMessage (MidiInput *, const MidiMessage &) override
virtual void | handleNoteOn (MidiKeyboardState *source, int midiChannel, int midiNoteNumber, float velocity)=0
virtual void | handleNoteOff (MidiKeyboardState *source, int midiChannel, int midiNoteNumber, float velocity)=0
Public Member Functions inherited from juce::MidiInputCallback
virtual | ~MidiInputCallback ()=default
virtual void | handleIncomingMidiMessage (MidiInput *source, const MidiMessage &message)=0
virtual void | handlePartialSysexMessage (MidiInput *source, const uint8 *messageData, int numBytesSoFar, double timestamp)

## Detailed Description

Collects incoming realtime MIDI messages and turns them into blocks suitable for processing by a block-based audio callback.

The class can also be used as either a MidiKeyboardStateListener or a MidiInputCallback so it can easily use a midi input or keyboard component as its source.

See also
  MidiMessage, MidiInput

Definition at line 38 of file juce_MidiMessageCollector.h.

## Constructor & Destructor Documentation

## ◆ MidiMessageCollector()

juce::MidiMessageCollector::MidiMessageCollector | ( |  | ) |

Creates a MidiMessageCollector.

Definition at line 26 of file juce_MidiMessageCollector.cpp.

## ◆ ~MidiMessageCollector()

juce::MidiMessageCollector::~MidiMessageCollector | ( |  | ) |
| override

Destructor.

Definition at line 30 of file juce_MidiMessageCollector.cpp.

## Member Function Documentation

## ◆ addMessageToQueue()

void juce::MidiMessageCollector::addMessageToQueue | ( | const MidiMessage & | message | ) |

Takes an incoming real-time message and adds it to the queue.

The message's timestamp is taken, and it will be ready for retrieval as part of the block returned by the next call to removeNextBlockOfMessages().

This method is fully thread-safe when overlapping calls are made with removeNextBlockOfMessages().

Definition at line 49 of file juce_MidiMessageCollector.cpp.

Referenced by handleIncomingMidiMessage(), handleNoteOff(), and handleNoteOn().

## ◆ handleIncomingMidiMessage()

void juce::MidiMessageCollector::handleIncomingMidiMessage | ( | MidiInput * | ,
|  | const MidiMessage & | message
| ) |  |
| overridevirtual

Implements juce::MidiInputCallback.

Definition at line 155 of file juce_MidiMessageCollector.cpp.

## ◆ handleNoteOff()

void juce::MidiMessageCollector::handleNoteOff | ( | MidiKeyboardState * | ,
|  | int | midiChannel,
|  | int | midiNoteNumber,
|  | float | velocity
| ) |  |
| overridevirtual

Implements juce::MidiKeyboardStateListener.

Definition at line 147 of file juce_MidiMessageCollector.cpp.

## ◆ handleNoteOn()

void juce::MidiMessageCollector::handleNoteOn | ( | MidiKeyboardState * | ,
|  | int | midiChannel,
|  | int | midiNoteNumber,
|  | float | velocity
| ) |  |
| overridevirtual

Implements juce::MidiKeyboardStateListener.

Definition at line 139 of file juce_MidiMessageCollector.cpp.

## ◆ removeNextBlockOfMessages()

void juce::MidiMessageCollector::removeNextBlockOfMessages | ( | MidiBuffer & | destBuffer,
|  | int | numSamples
| ) |  |

Removes all the pending messages from the queue as a buffer.

This will also correct the messages' timestamps to make sure they're in the range 0 to numSamples - 1.

This call should be made regularly by something like an audio processing callback, because the time that it happens is used in calculating the midi event positions.

This method is fully thread-safe when overlapping calls are made with addMessageToQueue().

Precondition: numSamples must be greater than 0.

Definition at line 71 of file juce_MidiMessageCollector.cpp.

## ◆ reset()

void juce::MidiMessageCollector::reset | ( | double | sampleRate | ) |

Clears any messages from the queue.

You need to call this method before starting to use the collector, so that it knows the correct sample rate to use.

Definition at line 35 of file juce_MidiMessageCollector.cpp.

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

- juce_MidiMessageCollector.h
- juce_MidiMessageCollector.cpp