clkIN

midi clock&position receive module. Works with the "clkOUT" module to proper functioning! Also features 5 extra "main" momentary trigger outputs. These can be used for whatever you want to trigger, but as I often use a dedicated reset and random, I've added these labels for the first two. Also, the "reset" output also goes high when receiving the midi start message, but not when midi continue is used.
Author: Remco van der Most
License: BSD
Github: sss/midi/clkIN.axo

Inlets

None

Outlets

int32 counter position

bool32 clock active

bool32 clock signal

bool32 reset/1st trigger to use to do something

bool32 randomise/2nd trigger to use to do something

bool32 trg1

bool32 trg2

bool32 trg3

Attributes

spinner CH

spinner CC

Declaration
int32_t _active;

int32_t _pos;
int clck, active, ccv;
Init
_active = 0;
_pos = 0;
Control Rate
outlet_active = _active;
outlet_clock = clck;
outlet_position = _pos;
clck = 0;
outlet_reset = ccv & 1;
outlet_random = (ccv >> 1) & 1;
outlet_trg1 = (ccv >> 2) & 1;
outlet_trg2 = (ccv >> 3) & 1;
outlet_trg3 = (ccv >> 4) & 1;
ccv = 0;
Midi Handler
if ((status == (attr_CH - 1) + MIDI_CONTROL_CHANGE) && (data1 == attr_CC)) {
  ccv = data2;
}
if (status == MIDI_TIMING_CLOCK) {
  clck = 1;
} else if (status == MIDI_START) {
  _active = 1;
  ccv = ccv - (ccv & 1) + 1;
} else if (status == MIDI_STOP) {
  _active = 0;

} else if (status == MIDI_CONTINUE) {
  _active = 1;
} else if (status == MIDI_SONG_POSITION) {
  _pos = ((data2 << 7) + data1);
}

Privacy

© 2024 Zrna Research