Jump to content

blm_scalar - call without sysex - internal - standalone


Phatline
 Share

Recommended Posts

Hi,

i want to modify the blm_scalar app a bit

http://svnmios.midiboxorg/filedetails.php?repname=svn.mios32&path=%2Ftrunk%2Fapps%2Fcontrollers%2Fblm_scalar%2FREADME.txt

i want to use it in standalone and via midi/sysex...

so my question: how to call the BLM internally? when i want to display a "array[16][16]=0 or 1 or 2;"

i know i can call it like below

but is there a more direct way to use it?

thx. mike


void APP_Background(void){

u8 chn = 0;
u8 note = 0;
u8 velocity = 0;

for(chn=0; chn<16; chn++){ 
for(note=0; note<16; note++){ 
    velocity = Seq[chn][note];
    
    if( note <= 0x0f ) {                                    //note<=15?
      // BLM16x16 LEDs
      led_mod_ix = chn >> 2;
      led_row_ix = ((chn&3) << 1) + ((note >> 3) & 1);
      led_column_ix = note & 0x7; //7
      modify_led = 1;
    } else if( note == 0x40 ) {                             //note==64
      // extra column LEDs
      led_mod_ix = 4;
      led_row_ix = (chn&3) << 1;
      led_column_ix = chn >> 2;
      modify_led = 1;
    } else if( chn == 0 && note >= 0x60 && note <= 0x6f ) { //Chn0, note>=96, note>0111
      // extra row LEDs
      led_mod_ix = 4;
      led_row_ix = 1 + ((note >> 1) & 6);
      led_column_ix = note & 3;
      modify_led = 1;
    } else if( chn == 0xf && note >= 0x60 && note <= 0x6f ) { //Chn15, note>=96, note>0111
      // additional extra LEDs
      led_mod_ix = 4;
      led_row_ix = 1 + ((note >> 1) & 6);
      led_column_ix = 4 + (note & 3);
      modify_led = 1;
    }


    if( modify_led ) {
      u8 led_mask = 1 << led_column_ix;

      // 90 xx 00 is the same like a note off event!
      // (-> http://www.borg.com/~jglatt/tech/midispec.htm)
      if( velocity == 0x00 ) {
	// Note Off or velocity == 0x00: clear both LEDs
	blm_scalar_led[led_mod_ix][led_row_ix][0] &= ~led_mask;
#if BLM_SCALAR_NUM_COLOURS >= 2
	blm_scalar_led[led_mod_ix][led_row_ix][1] &= ~led_mask;
#endif
      } else if( velocity < 0x40 ) {
	// Velocity < 0x40: set green LED, clear red LED
	blm_scalar_led[led_mod_ix][led_row_ix][0] |= led_mask;
#if BLM_SCALAR_NUM_COLOURS >= 2
	blm_scalar_led[led_mod_ix][led_row_ix][1] &= ~led_mask;
#endif
      } else if( velocity < 0x60 ) {
	// Velocity < 0x60: clear green LED, set red LED
	blm_scalar_led[led_mod_ix][led_row_ix][0] &= ~led_mask;
#if BLM_SCALAR_NUM_COLOURS >= 2
	blm_scalar_led[led_mod_ix][led_row_ix][1] |= led_mask;
#endif
      } else {
	// Velocity >= 0x60: set both LEDs
	blm_scalar_led[led_mod_ix][led_row_ix][0] |= led_mask;
#if BLM_SCALAR_NUM_COLOURS >= 2
	blm_scalar_led[led_mod_ix][led_row_ix][1] |= led_mask;
#endif
      }
    }
  }



}} // END - FOR - LOOPS
  

 

Edited by Phatline
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...