Phatline

blm_scalar - call without sysex - internal - standalone

2 posts in this topic

Posted (edited)

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now