Loading...
Searching...
No Matches
juce::MidiBuffer::Iterator Class Reference

`#include <juce_MidiBuffer.h>`

## Public Member Functions

| Iterator (const MidiBuffer &b) noexcept
void | setNextSamplePosition (int samplePosition) noexcept
bool | getNextEvent (MidiMessage &result, int &samplePosition) noexcept
bool | getNextEvent (const uint8 *&midiData, int &numBytesOfMidiData, int &samplePosition) noexcept

## Detailed Description

This class is now deprecated in favour of MidiBufferIterator.

Used to iterate through the events in a MidiBuffer.

Note that altering the buffer while an iterator is using it will produce undefined behaviour.

See also
  MidiBuffer

Definition at line 286 of file juce_MidiBuffer.h.

## Constructor & Destructor Documentation

## Iterator()

juce::MidiBuffer::Iterator::Iterator | ( | const MidiBuffer & | b | ) |

noexcept

Creates an Iterator for this MidiBuffer.

Definition at line 215 of file juce_MidiBuffer.cpp.

Referenced by Iterator().

## Member Function Documentation

## getNextEvent() [1/2]

bool juce::MidiBuffer::Iterator::getNextEvent | ( | const uint8 *& | midiData,
|  | int & | numBytesOfMidiData,
|  | int & | samplePosition )

noexcept

Retrieves the next event from the buffer.

Parameters

  midiData | on return, this pointer will be set to a block of data containing the midi message. Note that to make it fast, this is a pointer directly into the MidiBuffer's internal data, so is only valid temporarily until the MidiBuffer is altered.
  numBytesOfMidiData | on return, this is the number of bytes of data used by the midi message
  samplePosition | on return, this will be the position of the event, as a sample index in the buffer

Returns
  true if an event was found, or false if the iterator has reached the end of the buffer

Definition at line 225 of file juce_MidiBuffer.cpp.

## getNextEvent() [2/2]

bool juce::MidiBuffer::Iterator::getNextEvent | ( | MidiMessage & | result,
|  | int & | samplePosition )

noexcept

Retrieves a copy of the next event from the buffer.

Parameters

  result | on return, this will be the message. The MidiMessage's timestamp is set to the same value as samplePosition.
  samplePosition | on return, this will be the position of the event, as a sample index in the buffer

Returns
  true if an event was found, or false if the iterator has reached the end of the buffer

Definition at line 237 of file juce_MidiBuffer.cpp.

## setNextSamplePosition()

void juce::MidiBuffer::Iterator::setNextSamplePosition | ( | int | samplePosition | ) |

noexcept

Repositions the iterator so that the next event retrieved will be the first one whose sample position is at greater than or equal to the given position.

Definition at line 220 of file juce_MidiBuffer.cpp.

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

- juce_MidiBuffer.h
- juce_MidiBuffer.cpp