toneburst BSD PExch[PARAM_INDEX_attr_legal_name_ch1], attr_table.array[preset_table_start ],0xFFFD); PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_ch2], attr_table.array[preset_table_start + 1],0xFFFD); PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_ch3], attr_table.array[preset_table_start + 2],0xFFFD); PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_ch4], attr_table.array[preset_table_start + 3],0xFFFD); } // Update old preset value old_preset = param_preset; ///////////////////////////////////////// // Update current state for 4 channels // ///////////////////////////////////////// current_channel_state[0] = param_ch1; current_channel_state[1] = param_ch2; current_channel_state[2] = param_ch3; current_channel_state[3] = param_ch4; ///////////////////////////////////////////////////////// // Detect changes to channel states (ie steps toggled) // ///////////////////////////////////////////////////////// // Set save outlet false // This will be overridden if changes to sequences detected below outlet_save = false; for(i = 0; i < 4; i++) { // Check if channel edited if(current_channel_state[i] != old_channel_state[i]) { // Save data to table attr_table.array[preset_table_start + i] = current_channel_state[i]; // Update old channel states old_channel_state[i] = current_channel_state[i]; // Send pulse from save outlet outlet_save = true; } } //////////////////////// // Detect step change // //////////////////////// if(current_step != old_step) { // Step value has changed, update channel outlets // Update bit-mask for current step by bit-shifting // 00000000000000001.. step 0 // 00000000000000010.. step 1 // 00000000000000100.. step 2 // etc. step_mask = 1 << current_step; // Get step value from 16-bit integers representing state of each channel. // Combining state integer and mask using '&'(boolean AND) mask out required bit. // Casting to boolean produces TRUE if both state integer and mask bits are 1 // i.e. // 0000000000000001 // & // 0000000000000001 // = TRUE // // 0000000000000001 // & // 0000000000000010 // = FALSE outlet_ch1 = (bool)(current_channel_state[0] & step_mask); outlet_ch2 = (bool)(current_channel_state[1] & step_mask); outlet_ch3 = (bool)(current_channel_state[2] & step_mask); outlet_ch4 = (bool)(current_channel_state[3] & step_mask); } else { // No change to step, set all outputs low // This ensures outlets are only ever high/TRUE for one cycle, on rising edge of step value change outlet_ch1 = false; outlet_ch2 = false; outlet_ch3 = false; outlet_ch4 = false; } // Update old step old_step = current_step; // DEBUG]]> no 173 71 1380 861