JUCE: MidiBufferIterator Class Reference

JUCE

- Main Page
- Related Pages
- Topics
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
MidiBufferIterator Class Reference
juce_audio_basics » midi

An iterator to move over contiguous raw MIDI data, which Allows iterating over a MidiBuffer using C++11 range-for syntax. More...

`#include <juce_MidiBuffer.h>`

## Public Types
using | difference_type = std::iterator_traits< Ptr >::difference_type
using | value_type = MidiMessageMetadata
using | reference = MidiMessageMetadata
using | pointer = void
using | iterator_category = std::input_iterator_tag

## Public Member Functions
| MidiBufferIterator ()=default
| MidiBufferIterator (const uint8 *dataIn) noexcept
| Constructs an iterator pointing at the message starting at the byte `dataIn`.
MidiBufferIterator & | operator++ () noexcept
| Make this iterator point to the next message in the buffer.
MidiBufferIterator | operator++ (int) noexcept
| Create a copy of this object, make this iterator point to the next message in the buffer, then return the copy.
bool | operator== (const MidiBufferIterator &other) const noexcept
| Return true if this iterator points to the same message as another iterator instance, otherwise return false.
bool | operator!= (const MidiBufferIterator &other) const noexcept
| Return false if this iterator points to the same message as another iterator instance, otherwise returns true.
reference | operator* () const noexcept
| Return an instance of MidiMessageMetadata which describes the message to which the iterator is currently pointing.

## Detailed Description

An iterator to move over contiguous raw MIDI data, which Allows iterating over a MidiBuffer using C++11 range-for syntax.

In the following example, we log all three-byte messages in a midi buffer.

void processBlock (AudioBuffer<float>&, MidiBuffer& midiBuffer) override
{
for (const MidiMessageMetadata metadata : midiBuffer)
if (metadata.numBytes == 3)
Logger::writeToLog (metadata.getMessage().getDescription());
}
AudioBuffer
A multi-channel buffer containing floating point audio samples.
Definition juce_AudioSampleBuffer.h:35
Logger
Acts as an application-wide logging class.
Definition juce_Logger.h:42
MidiBuffer
Holds a sequence of time-stamped midi events.
Definition juce_MidiBuffer.h:146
MidiMessageMetadata
A view of MIDI message data stored in a contiguous buffer.
Definition juce_MidiBuffer.h:38

## Member Typedef Documentation

## ◆ difference_type

using MidiBufferIterator::difference_type = std::iterator_traits<Ptr>::difference_type

## ◆ value_type

using MidiBufferIterator::value_type = MidiMessageMetadata

## ◆ reference

using MidiBufferIterator::reference = MidiMessageMetadata

## ◆ pointer

using MidiBufferIterator::pointer = void

## ◆ iterator_category

using MidiBufferIterator::iterator_category = std::input_iterator_tag

## Constructor & Destructor Documentation

## ◆ MidiBufferIterator() [1/2]

MidiBufferIterator::MidiBufferIterator | ( |  | ) |
| default

## ◆ MidiBufferIterator() [2/2]

MidiBufferIterator::MidiBufferIterator | ( | const uint8 * | dataIn | ) |
| explicitnoexcept

Constructs an iterator pointing at the message starting at the byte `dataIn`.

`dataIn` must point to the start of a valid MIDI message. If it does not, calling other member functions on the iterator will result in undefined behaviour.

## Member Function Documentation

## ◆ operator++() [1/2]

MidiBufferIterator & MidiBufferIterator::operator++ | ( |  | ) |
| noexcept

Make this iterator point to the next message in the buffer.

## ◆ operator++() [2/2]

MidiBufferIterator MidiBufferIterator::operator++ | ( | int |  | ) |
| noexcept

Create a copy of this object, make this iterator point to the next message in the buffer, then return the copy.

## ◆ operator==()

bool MidiBufferIterator::operator== | ( | const MidiBufferIterator & | other | ) | const
| noexcept

Return true if this iterator points to the same message as another iterator instance, otherwise return false.

## ◆ operator!=()

bool MidiBufferIterator::operator!= | ( | const MidiBufferIterator & | other | ) | const
| noexcept

Return false if this iterator points to the same message as another iterator instance, otherwise returns true.

References operator==().

## ◆ operator*()

reference MidiBufferIterator::operator* | ( |  | ) | const
| noexcept

Return an instance of MidiMessageMetadata which describes the message to which the iterator is currently pointing.

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

- juce_MidiBuffer.h