Deluge Firmware 1.3.0
Build date: 2026.10.14
Loading...
Searching...
No Matches
MIDIQueue Class Reference

#include <midi_queue.h>

Public Member Functions

bool push (MIDIMessage message, int32_t filter, bool usb, bool din, uint32_t due, uint32_t now)
bool popDue (QueuedMIDI &out, uint32_t now, bool all=false)
bool popOldest (QueuedMIDI &out)
bool nextDue (uint32_t &due)
 Consumer only. Get the due time of the oldest queued MIDI. Returns false if nothing's queued.
bool empty () const
bool full () const
size_t size () const

Static Public Attributes

static constexpr size_t kCapacity = 256
static constexpr int32_t kMaxTicksAhead = DELUGE_CLOCKS_PER / 100
 Due times are never legitimately more than an audio buffer or so ahead.

Private Attributes

etl::queue_spsc_atomic< QueuedMIDI, kCapacity > queue_

Detailed Description

MIDI waiting to be sent at its due time. Lock free for a single producer (the audio routine) and a single consumer (the MIDI/gate output timer ISR)

Member Function Documentation

◆ popDue()

bool MIDIQueue::popDue ( QueuedMIDI & out,
uint32_t now,
bool all = false )

Consumer only. Take the oldest queued MIDI if it's due by now, or regardless if all. MIDI comes out in the order it was queued, so anything due behind something which isn't yet waits for it

◆ popOldest()

bool MIDIQueue::popOldest ( QueuedMIDI & out)

Consumer only (or the producer, with the consumer locked out). Take the oldest queued MIDI whether it's due or not, e.g. to make room when the queue's full. Returns false if nothing's queued

◆ push()

bool MIDIQueue::push ( MIDIMessage message,
int32_t filter,
bool usb,
bool din,
uint32_t due,
uint32_t now )

Producer only. A due time in the past or more than kMaxTicksAhead after now is stale (e.g. the audio routine hasn't run for a while) and is replaced with now, rather than letting the wrap make it look far in the future and hold up the queue. Returns false if the queue's full


The documentation for this class was generated from the following files:
  • src/deluge/io/midi/midi_queue.h
  • src/deluge/io/midi/midi_queue.cpp