Firmware: Need a little advice to get into processing architecture
Moderators: Altitude, adafruit_support_bill, adafruit, phono, mome rath

Firmware: Need a little advice to get into processing architecture

by mario1089 on Fri Oct 12, 2012 2:38 am

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!
mario1089
 
Posts: 196
Joined: Wed Sep 19, 2012 7:11 am

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

by antto on Fri Oct 12, 2012 8:13 am

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
We are here too: irc.freenode.net >>> #x0xb0x
..:: c0nb0x v1.00 ::.. http://forums.adafruit.com/viewtopic.php?f=7&t=29282 (new control app - win/osx)
VCO Tuning: http://forums.adafruit.com/viewtopic.php?f=12&t=24759 (do it the EASY way)
User avatar
antto
 
Posts: 1355
Joined: Thu Apr 15, 2010 2:21 pm
Location: 127.0.0.1

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

by mario1089 on Fri Oct 12, 2012 10:05 am

Perfect, thanx!
Strange I haven`t found that myself:) Should have done more searching..
mario1089
 
Posts: 196
Joined: Wed Sep 19, 2012 7:11 am