OpenShot Audio Library | OpenShotAudio 0.3.2
|
#include <juce_MidiBuffer.h>
Classes | |
class | Iterator |
Public Member Functions | |
MidiBuffer () noexcept | |
MidiBuffer (const MidiMessage &message) noexcept | |
MidiBuffer (const MidiBuffer &) noexcept | |
MidiBuffer & | operator= (const MidiBuffer &) noexcept |
~MidiBuffer () | |
void | clear () noexcept |
void | clear (int start, int numSamples) |
bool | isEmpty () const noexcept |
int | getNumEvents () const noexcept |
void | addEvent (const MidiMessage &midiMessage, int sampleNumber) |
void | addEvent (const void *rawMidiData, int maxBytesOfMidiData, int sampleNumber) |
void | addEvents (const MidiBuffer &otherBuffer, int startSample, int numSamples, int sampleDeltaToAdd) |
int | getFirstEventTime () const noexcept |
int | getLastEventTime () const noexcept |
void | swapWith (MidiBuffer &) noexcept |
void | ensureSize (size_t minimumNumBytes) |
Public Attributes | |
Array< uint8 > | data |
Holds a sequence of time-stamped midi events.
Analogous to the AudioBuffer, this holds a set of midi events with integer time-stamps. The buffer is kept sorted in order of the time-stamps.
If you're working with a sequence of midi events that may need to be manipulated or read/written to a midi file, then MidiMessageSequence is probably a more appropriate container. MidiBuffer is designed for lower-level streams of raw midi data.
Definition at line 42 of file juce_MidiBuffer.h.
|
noexcept |
Creates an empty MidiBuffer.
Definition at line 84 of file juce_MidiBuffer.cpp.
|
explicitnoexcept |
Creates a MidiBuffer containing a single midi message.
Definition at line 95 of file juce_MidiBuffer.cpp.
|
noexcept |
Creates a copy of another MidiBuffer.
Definition at line 87 of file juce_MidiBuffer.cpp.
juce::MidiBuffer::~MidiBuffer | ( | ) |
Destructor
Definition at line 85 of file juce_MidiBuffer.cpp.
void juce::MidiBuffer::addEvent | ( | const MidiMessage & | midiMessage, |
int | sampleNumber | ||
) |
Adds an event to the buffer.
The sample number will be used to determine the position of the event in the buffer, which is always kept sorted. The MidiMessage's timestamp is ignored.
If an event is added whose sample position is the same as one or more events already in the buffer, the new event will be placed after the existing ones.
To retrieve events, use a MidiBuffer::Iterator object
Definition at line 113 of file juce_MidiBuffer.cpp.
Referenced by addEvent(), addEvents(), juce::MidiMessageCollector::addMessageToQueue(), juce::MidiRPNGenerator::generate(), juce::MidiKeyboardState::noteOff(), juce::MidiKeyboardState::noteOn(), and juce::MidiKeyboardState::processNextMidiBuffer().
void juce::MidiBuffer::addEvent | ( | const void * | rawMidiData, |
int | maxBytesOfMidiData, | ||
int | sampleNumber | ||
) |
Adds an event to the buffer from raw midi data.
The sample number will be used to determine the position of the event in the buffer, which is always kept sorted.
If an event is added whose sample position is the same as one or more events already in the buffer, the new event will be placed after the existing ones.
The event data will be inspected to calculate the number of bytes in length that the midi event really takes up, so maxBytesOfMidiData may be longer than the data that actually gets stored. E.g. if you pass in a note-on and a length of 4 bytes, it'll actually only store 3 bytes. If the midi data is invalid, it might not add an event at all.
To retrieve events, use a MidiBuffer::Iterator object
Definition at line 118 of file juce_MidiBuffer.cpp.
void juce::MidiBuffer::addEvents | ( | const MidiBuffer & | otherBuffer, |
int | startSample, | ||
int | numSamples, | ||
int | sampleDeltaToAdd | ||
) |
Adds some events from another buffer to this one.
otherBuffer | the buffer containing the events you want to add |
startSample | the lowest sample number in the source buffer for which events should be added. Any source events whose timestamp is less than this will be ignored |
numSamples | the valid range of samples from the source buffer for which events should be added - i.e. events in the source buffer whose timestamp is greater than or equal to (startSample + numSamples) will be ignored. If this value is less than 0, all events after startSample will be taken. |
sampleDeltaToAdd | a value which will be added to the source timestamps of the events that are added to this buffer |
Definition at line 138 of file juce_MidiBuffer.cpp.
Referenced by juce::MPEMessages::clearAllZones(), and juce::MPEMessages::setZoneLayout().
|
noexcept |
Removes all events from the buffer.
Definition at line 101 of file juce_MidiBuffer.cpp.
Referenced by juce::MidiMessageCollector::addMessageToQueue(), juce::MidiKeyboardState::noteOff(), juce::MidiKeyboardState::noteOn(), juce::MidiKeyboardState::processNextMidiBuffer(), juce::MidiMessageCollector::removeNextBlockOfMessages(), juce::MidiKeyboardState::reset(), and juce::MidiMessageCollector::reset().
Removes all events between two times from the buffer.
All events for which (start <= event position < start + numSamples) will be removed.
Definition at line 105 of file juce_MidiBuffer.cpp.
Preallocates some memory for the buffer to use. This helps to avoid needing to reallocate space when the buffer has messages added to it.
Definition at line 102 of file juce_MidiBuffer.cpp.
|
noexcept |
Returns the sample number of the first event in the buffer. If the buffer's empty, this will just return 0.
Definition at line 165 of file juce_MidiBuffer.cpp.
Referenced by juce::MidiKeyboardState::processNextMidiBuffer().
|
noexcept |
Returns the sample number of the last event in the buffer. If the buffer's empty, this will just return 0.
Definition at line 170 of file juce_MidiBuffer.cpp.
Referenced by juce::MidiKeyboardState::processNextMidiBuffer().
|
noexcept |
Counts the number of events in the buffer.
This is actually quite a slow operation, as it has to iterate through all the events, so you might prefer to call isEmpty() if that's all you need to know.
Definition at line 154 of file juce_MidiBuffer.cpp.
|
noexcept |
Returns true if the buffer is empty. To actually retrieve the events, use a MidiBuffer::Iterator object
Definition at line 103 of file juce_MidiBuffer.cpp.
Referenced by juce::MidiMessageCollector::removeNextBlockOfMessages().
|
noexcept |
Makes a copy of another MidiBuffer.
Definition at line 89 of file juce_MidiBuffer.cpp.
|
noexcept |
Exchanges the contents of this buffer with another one.
This is a quick operation, because no memory allocating or copying is done, it just swaps the internal state of the two buffers.
Definition at line 100 of file juce_MidiBuffer.cpp.
Array<uint8> juce::MidiBuffer::data |
The raw data holding this buffer. Obviously access to this data is provided at your own risk. Its internal format could change in future, so don't write code that relies on it!
Definition at line 228 of file juce_MidiBuffer.h.
Referenced by addEvent(), clear(), clear(), ensureSize(), getFirstEventTime(), getLastEventTime(), juce::MidiBuffer::Iterator::getNextEvent(), juce::MidiBuffer::Iterator::getNextEvent(), getNumEvents(), isEmpty(), and juce::MidiBuffer::Iterator::setNextSamplePosition().