clock_tx

MIDI clock transmitter
Author: Are Leistad
License: BSD
Github: drj/midi/clock_tx.axo

Inlets

bool32.rising Send 24 PPQ clock

bool32.rising Send start

bool32.rising Send stop

bool32.rising Send continue

bool32.rising Send song select

bool32.rising Send song position

int32 Song selection

int32 Song position

Outlets

None

Attributes

combo device

Declaration
//#define DEBUGF LogTextMessage
#define DEBUGF(...)                                                            \
  {}

uint32_t old_24ppq;
uint32_t old_start;
uint32_t old_stop;
uint32_t old_continue;
// uint32_t old_reset;
uint32_t old_songsel;
uint32_t old_songpos;
Init
old_24ppq = 0;
old_start = 0;
old_stop = 0;
old_continue = 0;
// old_reset      = 0;
old_songsel = 0;
old_songpos = 0;
Control Rate
if (inlet_24ppq && !old_24ppq) {
  MidiSend1((midi_device_t)attr_device, MIDI_TIMING_CLOCK);
}

if (inlet_start && !old_start) {
  MidiSend1((midi_device_t)attr_device, MIDI_START);
}

if (inlet_stop && !old_stop) {
  MidiSend1((midi_device_t)attr_device, MIDI_STOP);
}

if (inlet_continue && !old_continue) {
  MidiSend1((midi_device_t)attr_device, MIDI_CONTINUE);
}

// if( inlet_reset && !old_reset    )
//  {
//    MidiSend1( (midi_device_t) attr_device, MIDI_RESET );
//  }

if (inlet_songsel && !old_songsel) {
  MidiSend2((midi_device_t)attr_device, MIDI_SONG_SELECT,
            (uint8_t)inlet_selected);
}

if (inlet_songpos && !old_songpos) {
  MidiSend3((midi_device_t)attr_device, MIDI_SONG_POSITION,
            (uint8_t)inlet_position & 0x7F,
            (uint8_t)(inlet_position << 7) & 0x7F);
}

old_24ppq = inlet_24ppq;
old_start = inlet_start;
old_stop = inlet_stop;
old_continue = inlet_continue;
// old_reset    = inlet_reset;
old_songsel = inlet_songsel;
old_songpos = inlet_songpos;

Privacy

© 2024 Zrna Research