Firmware: Need a little advice to get into processing architecture

Discuss mods, hacks, tweaks, etc.

Moderators: altitude, adafruit_support_bill, adafruit, phono, hamburgers

Please be positive and constructive with your questions and comments.
Locked
mario1089
 
Posts: 208
Joined: Wed Sep 19, 2012 8:11 am

Firmware: Need a little advice to get into processing architecture

Post by mario1089 »

Hello,

while most of the code is kinda easy to get, I find a bit hard to understand how sync /clocks / play status is working, espcecially without step-into-debugging.
What I basically want to do - besides other things that I found easy to achieve - is to change the MIDI sync mode in way, that it starts playing not on MIDI-Beat-Clock-Start command, but on "the first noteOn" (numHeldNotes>0) to arrive, and stopping playback after "the last NoteOff" ( numHeldNotes<1). That way I plan to have a nice integration of the whole thing into song-projects, having anything (start/stop, pattern select, current transposition) automatable from MIDI DAW.

A little hacky approach may be to just block the final sending-the-notes (and maybe also block the LED`s lightning), so that it runs silently for numHeldNotes<1, but I wouldn`t mind doing a more proper solution..

Could someone drop me a few sentences how this basically would be done?


Thanx in advance!

User avatar
antto
 
Posts: 1636
Joined: Thu Apr 15, 2010 3:21 pm

Re: Firmware: Need a little advice to get into processing architecture

Post by antto »

in pattern_play.c
you can find the code responsible for starting/stoping the internal sequencer
(it's somewhere near the end of the file)

to disable it to react to midi start/stop messages remove these conditions:
((sync == MIDI_SYNC) && (midi_cmd == MIDI_STOP))
((sync == MIDI_SYNC) && ((midi_cmd == MIDI_START) || (midi_cmd == MIDI_CONTINUE)))

then, right above that code you'll see a condition: if (sync == MIDI_SYNC) { ... midi_recv_cmd(); }
so this is a good place to process midi messages

mario1089
 
Posts: 208
Joined: Wed Sep 19, 2012 8:11 am

Re: Firmware: Need a little advice to get into processing architecture

Post by mario1089 »

Perfect, thanx!
Strange I haven`t found that myself:) Should have done more searching..

Locked
Please be positive and constructive with your questions and comments.

Return to “x0xm0dz”