///////////////////////////////////////////////////////////////////////////// // Called by MIDI Tx Notificaton hook if a MIDI event should be sent // Allows to provide additional MIDI ports // If 1 is returned, package will be filtered! ///////////////////////////////////////////////////////////////////////////// s32 SEQ_MIDI_PORT_NotifyMIDITx(mios32_midi_port_t port, mios32_midi_package_t package) { // MIDI Out monitor function u8 mon_filtered = 0; if( seq_midi_port_mon_filter.MIDI_CLOCK && package.evnt0 == 0xf8 ) mon_filtered = 1; else if( seq_midi_port_mon_filter.ACTIVE_SENSE && package.evnt0 == 0xfe ) mon_filtered = 1; if( !mon_filtered ) { int port_ix = -1; if( port != DEFAULT ) { port_ix = SEQ_MIDI_PORT_OutIxGet(port); if( !port_ix ) port_ix = -1; // port not mapped } if( port_ix >= 0 ) { midi_out_package[port_ix] = package; midi_out_ctr[port_ix] = 20; // 2 seconds lifetime seq_midi_port_out_combined_ctr = 5; // 500 mS lifetime } } // DIN Sync Event (0xf9 sent over port 0xff) if( port == 0xff && package.evnt0 == 0xf9 ) { SEQ_CV_Clk_Trigger(package.evnt1); // second byte contains clock number (see also 0xf9 generation in seq_core) return 1; // filter package } if( (port & 0xf0) == OSC0 ) { // OSC1..4 port // avoid OSC feedback in seq_live.c (can cause infinite loops or stack overflows) if( filter_osc_packets || OSC_CLIENT_SendMIDIEvent(port & 0xf, package) >= 0 ) return 1; // filter package } else if( port == 0x80 ) { // AOUT port if( SEQ_CV_SendPackage(port & 0xf, package) ) return 1; // filter package } else if( port == 0xc0 ) { // Multi OUT port int i; u32 mask = 1; for(i=0; i<16; ++i, mask <<= 1) { if( seq_midi_port_multi_enable_flags & mask ) { // USB0/1/2/3, UART0/1/2/3, IIC0/1/2/3, OSC0/1/2/3 mios32_midi_port_t port = 0x10 + ((i&0xc) << 2) + (i&3); if( port != seq_blm_port ) // ensure that no note will be sent to BLM port if enabled MIOS32_MIDI_SendPackage(port, package); } } if( seq_midi_port_multi_enable_flags & (1 << 16) ) { MIOS32_MIDI_SendPackage(0x80, package); // AOUT } return 1; // filter forwarding } return 0; // don't filter package }
s32 SEQ_TERMINAL_PrintTracks(void *_output_function) { void (*out)(char *format, ...) = _output_function; char str_buffer[128]; MUTEX_MIDIOUT_TAKE; out("Track Overview:\n"); out("===============\n"); out("| Track | Mode | Layer P/T/I | Steps P/T | Length | Port | Chn. | Muted |\n"); out("+-------+-------+-------------+-----------+--------+-------+------+-------+\n"); u8 track; for(track=0; track<SEQ_CORE_NUM_TRACKS; ++track) { seq_event_mode_t event_mode = SEQ_CC_Get(track, SEQ_CC_MIDI_EVENT_MODE); u16 num_instruments = SEQ_TRG_NumInstrumentsGet(track); u16 num_par_layers = SEQ_PAR_NumLayersGet(track); u16 num_par_steps = SEQ_PAR_NumStepsGet(track); u16 num_trg_layers = SEQ_TRG_NumLayersGet(track); u16 num_trg_steps = SEQ_TRG_NumStepsGet(track); u16 length = (u16)SEQ_CC_Get(track, SEQ_CC_LENGTH) + 1; mios32_midi_port_t midi_port = SEQ_CC_Get(track, SEQ_CC_MIDI_PORT); u8 midi_chn = SEQ_CC_Get(track, SEQ_CC_MIDI_CHANNEL) + 1; sprintf(str_buffer, "| G%dT%d | %s |", (track/4)+1, (track%4)+1, SEQ_LAYER_GetEvntModeName(event_mode)); sprintf((char *)(str_buffer + strlen(str_buffer)), " %2d/%2d/%2d | %3d/%3d | %3d | %s%c | %2d |", num_par_layers, num_trg_layers, num_instruments, num_par_steps, num_trg_steps, length, SEQ_MIDI_PORT_OutNameGet(SEQ_MIDI_PORT_OutIxGet(midi_port)), SEQ_MIDI_PORT_OutCheckAvailable(midi_port) ? ' ' : '*', midi_chn); if( seq_core_trk_muted & (1 << track) ) sprintf((char *)(str_buffer + strlen(str_buffer)), " yes |\n"); else if( seq_core_trk[track].layer_muted ) sprintf((char *)(str_buffer + strlen(str_buffer)), " layer |\n"); else sprintf((char *)(str_buffer + strlen(str_buffer)), " no |\n"); out(str_buffer); } out("+-------+-------+-------------+-----------+--------+-------+------+-------+\n"); out("done.\n"); MUTEX_MIDIOUT_GIVE; return 0; // no error }
///////////////////////////////////////////////////////////////////////////// // Local encoder callback function // Should return: // 1 if value has been changed // 0 if value hasn't been changed // -1 if invalid or unsupported encoder ///////////////////////////////////////////////////////////////////////////// static s32 Encoder_Handler(seq_ui_encoder_t encoder, s32 incrementer) { // any encoder changes the dir view if( !dir_name[0] ) { if( SEQ_UI_SelectListItem(incrementer, dir_num_items, NUM_LIST_DISPLAYED_ITEMS, &ui_selected_item, &dir_view_offset) ) { SEQ_UI_SYSEX_UpdateDirList(); } } else { switch( encoder ) { case SEQ_UI_ENCODER_GP13: { // select MIDI port u8 port_ix = SEQ_MIDI_PORT_OutIxGet(sysex_port); if( SEQ_UI_Var8_Inc(&port_ix, 0, SEQ_MIDI_PORT_OutNumGet()-1, incrementer) >= 0 ) { sysex_port = SEQ_MIDI_PORT_OutPortGet(port_ix); store_file_required = 1; return 1; // value changed } return 0; // no change } break; case SEQ_UI_ENCODER_GP14: case SEQ_UI_ENCODER_GP15: { // select delay if( SEQ_UI_Var16_Inc(&sysex_delay_between_dumps, 0, 999, incrementer) >= 0 ) { store_file_required = 1; return 1; // value changed } return 0; // no change } break; case SEQ_UI_ENCODER_GP16: // EXIT only via button if( incrementer == 0 ) { if( store_file_required ) SEQ_UI_SYSEX_StoreConfig(); // Exit dir_name[0] = 0; ui_selected_item = 0; dir_view_offset = 0; SEQ_UI_SYSEX_UpdateDirList(); } return 1; default: if( SEQ_UI_SelectListItem(incrementer, dir_num_items, NUM_LIST_DISPLAYED_ITEMS-2, &ui_selected_item, &dir_view_offset) ) SEQ_UI_SYSEX_UpdateDirList(); } } return 1; }
///////////////////////////////////////////////////////////////////////////// // Returns 1 if MIOS32 MIDI Out Port is muted ///////////////////////////////////////////////////////////////////////////// s32 SEQ_MIDI_PORT_OutMuteGet(mios32_midi_port_t port) { u8 port_ix = 0; if( port != DEFAULT ) { port_ix = SEQ_MIDI_PORT_OutIxGet(port); if( !port_ix ) return 0; // port not supported... and not muted (therefore 0 instead of -1) } return (muted_out & (1 << port_ix)) ? 1 : 0; }
///////////////////////////////////////////////////////////////////////////// // Returns the last sent MIDI package of given output port ///////////////////////////////////////////////////////////////////////////// mios32_midi_package_t SEQ_MIDI_PORT_OutPackageGet(mios32_midi_port_t port) { u8 port_ix = 0; mios32_midi_package_t empty; empty.ALL = 0; if( port != DEFAULT ) { port_ix = SEQ_MIDI_PORT_OutIxGet(port); if( !port_ix ) return empty; // port not supported... } if( !midi_out_ctr[port_ix] ) return empty; // package expired return midi_out_package[port_ix]; }
s32 SEQ_TERMINAL_PrintCurrentMixerMap(void *_output_function) { void (*out)(char *format, ...) = _output_function; char str_buffer[128]; MUTEX_MIDIOUT_TAKE; u8 map = SEQ_MIXER_NumGet(); int i; out("Mixer Map #%3d\n", map+1); out("==============\n"); out("|Num|Port|Chn|Prg|Vol|Pan|Rev|Cho|Mod|CC1|CC2|CC3|CC4|C1A|C2A|C3A|C4A|\n"); out("+---+----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+\n"); for(i=0; i<16; ++i) { sprintf(str_buffer, "|%3d|%s|", i, SEQ_MIDI_PORT_OutNameGet(SEQ_MIDI_PORT_OutIxGet(SEQ_MIXER_Get(i, SEQ_MIXER_PAR_PORT)))); int par; for(par=1; par<2; ++par) sprintf((char *)(str_buffer + strlen(str_buffer)), "%3d|", SEQ_MIXER_Get(i, par)+1); for(par=2; par<12; ++par) { u8 value = SEQ_MIXER_Get(i, par); if( value ) sprintf((char *)(str_buffer + strlen(str_buffer)), "%3d|", value-1); else sprintf((char *)(str_buffer + strlen(str_buffer)), " - |"); } for(par=12; par<16; ++par) sprintf((char *)(str_buffer + strlen(str_buffer)), "%3d|", SEQ_MIXER_Get(i, par)); out("%s\n", str_buffer); } out("+---+----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+\n"); out("done.\n"); MUTEX_MIDIOUT_GIVE; return 0; // no error }
///////////////////////////////////////////////////////////////////////////// // Mutes/Unmutes a MIDI port ///////////////////////////////////////////////////////////////////////////// s32 SEQ_MIDI_PORT_OutMuteSet(mios32_midi_port_t port, u8 mute) { u8 port_ix; if( port == DEFAULT ) port_ix = 0; else { port_ix = SEQ_MIDI_PORT_OutIxGet(port); if( !port_ix ) return -1; // port not supported } if( mute ) muted_out |= (1 << port_ix); else muted_out &= ~(1 << port_ix); return 0; // no error }
///////////////////////////////////////////////////////////////////////////// // Local button callback function // Should return: // 1 if value has been changed // 0 if value hasn't been changed // -1 if invalid or unsupported button ///////////////////////////////////////////////////////////////////////////// static s32 Button_Handler(seq_ui_button_t button, s32 depressed) { if( depressed ) return 0; // ignore when button depressed #if 0 // leads to: comparison is always true due to limited range of data type if( button >= SEQ_UI_BUTTON_GP1 && button <= SEQ_UI_BUTTON_GP16 ) { #else if( button <= SEQ_UI_BUTTON_GP16 ) { #endif // re-use encoder handler - only select UI item, don't increment, flags will be toggled return Encoder_Handler((int)button, 0); } // remaining buttons: switch( button ) { case SEQ_UI_BUTTON_Select: case SEQ_UI_BUTTON_Right: if( ++ui_selected_item >= NUM_OF_ITEMS ) ui_selected_item = 0; SetSubpageBasedOnItem(ui_selected_item); return 1; // value always changed case SEQ_UI_BUTTON_Left: if( ui_selected_item == 0 ) ui_selected_item = NUM_OF_ITEMS-1; else --ui_selected_item; SetSubpageBasedOnItem(ui_selected_item); return 1; // value always changed case SEQ_UI_BUTTON_Up: return Encoder_Handler(SEQ_UI_ENCODER_Datawheel, 1); case SEQ_UI_BUTTON_Down: return Encoder_Handler(SEQ_UI_ENCODER_Datawheel, -1); } return -1; // invalid or unsupported button } ///////////////////////////////////////////////////////////////////////////// // Local Display Handler function // IN: <high_prio>: if set, a high-priority LCD update is requested ///////////////////////////////////////////////////////////////////////////// static s32 LCD_Handler(u8 high_prio) { if( high_prio ) return 0; // there are no high-priority updates // layout: // 00000000001111111111222222222233333333330000000000111111111122222222223333333333 // 01234567890123456789012345678901234567890123456789012345678901234567890123456789 // <--------------------------------------><--------------------------------------> // Transposer Section MIDI Ext. Bus Port Chn. Lower/Upper Mode Reset // and Arp. Control Router Ctrl Misc. 1 IN1 #16 --- --- T&A Stacks // Transposer Section MIDI Ext. Port Chn. G1 G2 G3 G4 Fwd Reset // and Arp. Control Router Ctrl Misc. All #16 C-1 C-2 C-3 C-4 USB1 Stcks // Transposer Section MIDI Ext. Node IN P/Chn OUT P/Chn | DefaultPort // and Arp. Control Router Ctrl Misc. #1 Def. All Def. # 1 | USB1 // Transposer Section MIDI Ext. Port Chn. Function CC# // Transposer Section MIDI Ext. IN OUT Chn.| Function CC# // and Arp. Control Router Ctrl Misc. All off --- | Morph Value 1 // Transposer Section MIDI Ext. BLM_SCALAR MIDI // and Arp. Control Router Ctrl Misc.Port: OUT2 Monitor seq_midi_router_node_t *n = &seq_midi_router_node[selected_router_node]; /////////////////////////////////////////////////////////////////////////// //<<<<<<< .mine /* const char leftpage[2][41] = { "Transposer Section MIDI ", " and Arp. Control Router Misc. " }; ======= */ SEQ_LCD_CursorSet(0, 0); SEQ_LCD_PrintString("Transposer Section MIDI Ext. "); SEQ_LCD_CursorSet(0, 1); SEQ_LCD_PrintString(" and Arp. Control Router Ctrl Misc."); //>>>>>>> .r1826 if( ui_cursor_flash && selected_subpage <= 5 ) { const u8 select_pos1[5] = { 0, 10, 20, 30, 35 }; const u8 select_width[5] = { 10, 10, 10, 5, 5 }; int line; for(line=0; line<2; ++line) { SEQ_LCD_CursorSet(select_pos1[selected_subpage], line); SEQ_LCD_PrintSpaces(select_width[selected_subpage]); } } /* SEQ_LCD_CursorSet(0, 0); if (selected_subpage == SUBPAGE_TRANSPOSE && ui_cursor_flash) { SEQ_LCD_PrintSpaces(21); } else { SEQ_LCD_PrintString(" Transposer and Arp "); } SEQ_LCD_CursorSet(0, 1); if (selected_subpage == SUBPAGE_SECTIONS && ui_cursor_flash) { SEQ_LCD_PrintSpaces(21); } else { SEQ_LCD_PrintString(" Section control "); } SEQ_LCD_CursorSet(0, 2); if (selected_subpage == SUBPAGE_ROUTER && ui_cursor_flash) { SEQ_LCD_PrintSpaces(21); } else { SEQ_LCD_PrintString(" MIDI router "); } SEQ_LCD_CursorSet(0, 3); if (selected_subpage == SUBPAGE_MISC && ui_cursor_flash) { SEQ_LCD_PrintSpaces(21); } else { SEQ_LCD_PrintString(" Miscilenious "); } */ SEQ_LCD_CursorSet(0, 4); switch( selected_subpage ) { /////////////////////////////////////////////////////////////////////////// case SUBPAGE_TRANSPOSE: { //SEQ_LCD_CursorSet(40, 0); SEQ_LCD_PrintString(" Bus Port Chn. Mode "); SEQ_LCD_CursorSet(0, 6); SEQ_LCD_PrintString(" Lower/Upper Reset "); SEQ_LCD_CursorSet(0, 5); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_IN_BUS && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(5); } else { SEQ_LCD_PrintFormattedString(" %d ", selected_bus+1); } /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_IN_PORT && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(4); } else { if( seq_midi_in_port[selected_bus] ) SEQ_LCD_PrintString(SEQ_MIDI_PORT_InNameGet(SEQ_MIDI_PORT_InIxGet(seq_midi_in_port[selected_bus]))); else SEQ_LCD_PrintString(" All"); } SEQ_LCD_PrintSpaces(1); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_IN_CHN && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(3); } else { if( seq_midi_in_channel[selected_bus] ) SEQ_LCD_PrintFormattedString("#%2d", seq_midi_in_channel[selected_bus]); else SEQ_LCD_PrintString("---"); } SEQ_LCD_PrintSpaces(3); /* /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_IN_MODE && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(4); } else { SEQ_LCD_PrintString(seq_midi_in_options[selected_bus].MODE_PLAY ? "Play" : "T&A "); } SEQ_LCD_PrintSpaces(3); SEQ_LCD_CursorSet(0, 7); */ /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_IN_LOWER && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(3); } else { SEQ_LCD_PrintNote(seq_midi_in_lower[selected_bus]); } SEQ_LCD_PrintSpaces(3); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_IN_UPPER && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(3); } else { SEQ_LCD_PrintNote(seq_midi_in_upper[selected_bus]); } SEQ_LCD_PrintSpaces(2); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_IN_MODE && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(4); } else { SEQ_LCD_PrintString(seq_midi_in_options[selected_bus].MODE_PLAY ? "Play" : "T&A "); } SEQ_LCD_PrintSpaces(3); SEQ_LCD_PrintString("Stacks"); } break; /////////////////////////////////////////////////////////////////////////// case SUBPAGE_SECTIONS: { //SEQ_LCD_CursorSet(40, 0); SEQ_LCD_PrintString(" Port Chn. G1 G2 "); SEQ_LCD_CursorSet(0, 6); SEQ_LCD_PrintString(" G3 G4 Fwd Reset "); SEQ_LCD_CursorSet(0, 5); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_S_PORT && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(4); } else { if( seq_midi_in_sect_port ) SEQ_LCD_PrintString(SEQ_MIDI_PORT_InNameGet(SEQ_MIDI_PORT_InIxGet(seq_midi_in_sect_port))); else SEQ_LCD_PrintString(" All"); } SEQ_LCD_PrintSpaces(1); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_S_CHN && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(3); } else { if( seq_midi_in_sect_channel ) SEQ_LCD_PrintFormattedString("#%2d", seq_midi_in_sect_channel); else SEQ_LCD_PrintString("---"); } SEQ_LCD_PrintSpaces(2); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_S_OCT_G1 && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(3); } else { SEQ_LCD_PrintNote(seq_midi_in_sect_note[0]); } SEQ_LCD_PrintSpaces(2); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_S_OCT_G2 && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(3); } else { SEQ_LCD_PrintNote(seq_midi_in_sect_note[1]); } SEQ_LCD_PrintSpaces(2); SEQ_LCD_CursorSet(0, 5); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_S_OCT_G3 && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(3); } else { SEQ_LCD_PrintNote(seq_midi_in_sect_note[2]); } SEQ_LCD_PrintSpaces(2); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_S_OCT_G4 && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(3); } else { SEQ_LCD_PrintNote(seq_midi_in_sect_note[3]); } SEQ_LCD_PrintSpaces(2); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_S_FWD_PORT && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(4); } else { if( seq_midi_in_sect_fwd_port == 0 ) SEQ_LCD_PrintString("----"); else SEQ_LCD_PrintString(SEQ_MIDI_PORT_OutNameGet(SEQ_MIDI_PORT_OutIxGet(seq_midi_in_sect_fwd_port))); } SEQ_LCD_PrintSpaces(1); SEQ_LCD_PrintString("Stcks"); } break; /////////////////////////////////////////////////////////////////////////// case SUBPAGE_ROUTER: { //<<<<<<< .mine //SEQ_LCD_CursorSet(40, 0); SEQ_LCD_PrintString(" Node IN Port/Chn "); SEQ_LCD_CursorSet(0, 6); SEQ_LCD_PrintString("OUT Port/Chn Def.Port"); SEQ_LCD_CursorSet(0, 5); /* ======= SEQ_LCD_CursorSet(40, 0); SEQ_LCD_PrintString("Node IN P/Chn OUT P/Chn | DefaultPort"); SEQ_LCD_CursorSet(40, 1); >>>>>>> .r1826 */ /////////////////////////////////////////////////////////////////////// SEQ_LCD_PrintSpaces(1); if( ui_selected_item == ITEM_R_NODE && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(3); } else { SEQ_LCD_PrintFormattedString("#%2d", selected_router_node+1); } SEQ_LCD_PrintSpaces(1); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_R_SRC_PORT && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(4); } else { SEQ_LCD_PrintString(SEQ_MIDI_PORT_InNameGet(SEQ_MIDI_PORT_InIxGet(n->src_port))); } SEQ_LCD_PrintSpaces(1); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_R_SRC_CHN && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(3); } else { if( !n->src_chn ) { SEQ_LCD_PrintString("---"); } else if( n->src_chn > 16 ) { SEQ_LCD_PrintString("All"); } else { SEQ_LCD_PrintFormattedString("#%2d", n->src_chn); } } SEQ_LCD_PrintSpaces(2); SEQ_LCD_CursorSet(0, 7); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_R_DST_PORT && ui_cursor_flash ) { if( n->dst_chn >= 18 ) { SEQ_LCD_PrintSpaces(2); } else { SEQ_LCD_PrintSpaces(4); } } else { if( n->dst_chn >= 18 ) { SEQ_LCD_PrintSpaces(2); } else { SEQ_LCD_PrintString(SEQ_MIDI_PORT_OutNameGet(SEQ_MIDI_PORT_OutIxGet(n->dst_port))); } } /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_R_DST_CHN && ui_cursor_flash ) { if( n->dst_chn >= 18 ) { SEQ_LCD_PrintSpaces(7); } else { SEQ_LCD_PrintSpaces(5); } } else { if( !n->dst_chn ) { SEQ_LCD_PrintString(" --- "); } else if( n->dst_chn == 17 ) { SEQ_LCD_PrintString(" All "); } else if( n->dst_chn == 18 ) { SEQ_LCD_PrintString(" Track"); } else if( n->dst_chn >= 19 ) { SEQ_LCD_PrintString("Sel.Trk"); } else { SEQ_LCD_PrintFormattedString(" #%2d ", n->dst_chn); } } SEQ_LCD_PrintSpaces(3); /////////////////////////////////////////////////////////////////////// SEQ_LCD_PrintChar('|'); SEQ_LCD_PrintSpaces(4); if( ui_selected_item == ITEM_DEF_PORT && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(4); } else { SEQ_LCD_PrintString(SEQ_MIDI_PORT_OutNameGet(SEQ_MIDI_PORT_OutIxGet(MIOS32_MIDI_DefaultPortGet()))); } SEQ_LCD_PrintSpaces(4); } break; /////////////////////////////////////////////////////////////////////////// case SUBPAGE_EXT_CTRL: { SEQ_LCD_CursorSet(40, 0); SEQ_LCD_PrintString(" IN OUT Chn.|Function "); if( selected_ext_ctrl < SEQ_MIDI_IN_EXT_CTRL_NUM_IX_CC ) { SEQ_LCD_PrintString("CC# "); } else { SEQ_LCD_PrintSpaces(10); } SEQ_LCD_CursorSet(40, 1); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_EXT_PORT && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(4); } else { if( seq_midi_in_ext_ctrl_port == 0xff ) SEQ_LCD_PrintString(" All"); else if( !seq_midi_in_ext_ctrl_port ) SEQ_LCD_PrintString(" off"); else SEQ_LCD_PrintString(SEQ_MIDI_PORT_InNameGet(SEQ_MIDI_PORT_InIxGet(seq_midi_in_ext_ctrl_port))); } SEQ_LCD_PrintSpaces(1); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_EXT_PORT_OUT && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(4); } else { if( seq_midi_in_ext_ctrl_out_port ) SEQ_LCD_PrintString(SEQ_MIDI_PORT_OutNameGet(SEQ_MIDI_PORT_OutIxGet(seq_midi_in_ext_ctrl_out_port))); else SEQ_LCD_PrintString("off "); } SEQ_LCD_PrintSpaces(1); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_EXT_CHN && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(3); } else { if( seq_midi_in_ext_ctrl_channel ) SEQ_LCD_PrintFormattedString("#%2d", seq_midi_in_ext_ctrl_channel); else SEQ_LCD_PrintString("---"); } SEQ_LCD_PrintString(" |"); /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_EXT_CTRL && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(15); } else { SEQ_LCD_PrintStringPadded((char *)SEQ_MIDI_IN_ExtCtrlStr(selected_ext_ctrl), 15); } /////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_EXT_VALUE && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(10); } else { SEQ_LCD_PrintSpaces(1); if( selected_ext_ctrl == SEQ_MIDI_IN_EXT_CTRL_NRPN_ENABLED ) { SEQ_LCD_PrintStringPadded(seq_midi_in_ext_ctrl_asg[selected_ext_ctrl] ? "enabled" : "disabled", 9); } else if( selected_ext_ctrl == SEQ_MIDI_IN_EXT_CTRL_PC_MODE ) { SEQ_LCD_PrintStringPadded((char *)SEQ_MIDI_IN_ExtCtrlPcModeStr(seq_midi_in_ext_ctrl_asg[selected_ext_ctrl]), 9); } else { u8 cc = seq_midi_in_ext_ctrl_asg[selected_ext_ctrl]; if( cc >= 0x80 ) SEQ_LCD_PrintString("off"); else SEQ_LCD_PrintFormattedString("%3d", cc); SEQ_LCD_PrintSpaces(7); } } } break; /////////////////////////////////////////////////////////////////////////// case SUBPAGE_MISC: { //SEQ_LCD_CursorSet(40, 0); //<<<<<<< .mine SEQ_LCD_PrintString("BLM_SCALAR "); SEQ_LCD_PrintString(blm_timeout_ctr ? "connected " : "not found "); SEQ_LCD_CursorSet(0, 6); SEQ_LCD_PrintString(" MIDI "); SEQ_LCD_CursorSet(0, 5); /* ======= SEQ_LCD_PrintString("BLM_SCALAR MIDI "); SEQ_LCD_CursorSet(40, 1); >>>>>>> .r1826 */ /////////////////////////////////////////////////////////////////////// SEQ_LCD_PrintString("Port: "); if( ui_selected_item == ITEM_BLM_SCALAR_PORT && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(4); } else { if( !seq_blm_port ) SEQ_LCD_PrintString(" off"); else SEQ_LCD_PrintString(SEQ_MIDI_PORT_InNameGet(SEQ_MIDI_PORT_InIxGet(seq_blm_port))); } //<<<<<<< .mine SEQ_LCD_CursorSet(0, 7); //======= SEQ_LCD_PrintString(blm_timeout_ctr ? " (found) " : " "); // free for new parameters SEQ_LCD_PrintSpaces(12); //>>>>>>> .r1826 /////////////////////////////////////////////////////////////////////// SEQ_LCD_PrintString("Monitor "); } break; } return 0; // no error } ///////////////////////////////////////////////////////////////////////////// // Local exit function ///////////////////////////////////////////////////////////////////////////// static s32 EXIT_Handler(void) { s32 status = 0; if( store_file_required ) { // write config files MUTEX_SDCARD_TAKE; if( (status=SEQ_FILE_C_Write(seq_file_session_name)) < 0 ) SEQ_UI_SDCardErrMsg(2000, status); MUTEX_SDCARD_GIVE; MUTEX_SDCARD_TAKE; if( (status=SEQ_FILE_GC_Write()) < 0 ) SEQ_UI_SDCardErrMsg(2000, status); MUTEX_SDCARD_GIVE; } return status; }
///////////////////////////////////////////////////////////////////////////// // Local encoder callback function // Should return: // 1 if value has been changed // 0 if value hasn't been changed // -1 if invalid or unsupported encoder ///////////////////////////////////////////////////////////////////////////// static s32 Encoder_Handler(seq_ui_encoder_t encoder, s32 incrementer) { seq_midi_router_node_t *n = &seq_midi_router_node[selected_router_node]; if( encoder <= SEQ_UI_ENCODER_GP8 ) { switch( encoder ) { case SEQ_UI_ENCODER_GP1: case SEQ_UI_ENCODER_GP2: selected_subpage = SUBPAGE_TRANSPOSE; ui_selected_item = ITEM_IN_BUS; break; case SEQ_UI_ENCODER_GP3: case SEQ_UI_ENCODER_GP4: selected_subpage = SUBPAGE_SECTIONS; ui_selected_item = ITEM_S_PORT; break; case SEQ_UI_ENCODER_GP5: case SEQ_UI_ENCODER_GP6: selected_subpage = SUBPAGE_ROUTER; ui_selected_item = ITEM_R_NODE; break; case SEQ_UI_ENCODER_GP7: selected_subpage = SUBPAGE_EXT_CTRL; ui_selected_item = ITEM_EXT_PORT; break; default: selected_subpage = SUBPAGE_MISC; ui_selected_item = ITEM_BLM_SCALAR_PORT; } return 1; } switch( selected_subpage ) { case SUBPAGE_TRANSPOSE: switch( encoder ) { case SEQ_UI_ENCODER_GP9: ui_selected_item = ITEM_IN_BUS; break; case SEQ_UI_ENCODER_GP10: ui_selected_item = ITEM_IN_PORT; break; case SEQ_UI_ENCODER_GP11: ui_selected_item = ITEM_IN_CHN; break; case SEQ_UI_ENCODER_GP12: ui_selected_item = ITEM_IN_LOWER; break; case SEQ_UI_ENCODER_GP13: ui_selected_item = ITEM_IN_UPPER; break; case SEQ_UI_ENCODER_GP14: ui_selected_item = ITEM_IN_MODE; break; case SEQ_UI_ENCODER_GP15: return -1; // not mapped case SEQ_UI_ENCODER_GP16: ui_selected_item = ITEM_RESET_STACKS; break; } break; case SUBPAGE_SECTIONS: switch( encoder ) { case SEQ_UI_ENCODER_GP9: ui_selected_item = ITEM_S_PORT; break; case SEQ_UI_ENCODER_GP10: ui_selected_item = ITEM_S_CHN; break; case SEQ_UI_ENCODER_GP11: ui_selected_item = ITEM_S_OCT_G1; break; case SEQ_UI_ENCODER_GP12: ui_selected_item = ITEM_S_OCT_G2; break; case SEQ_UI_ENCODER_GP13: ui_selected_item = ITEM_S_OCT_G3; break; case SEQ_UI_ENCODER_GP14: ui_selected_item = ITEM_S_OCT_G4; break; case SEQ_UI_ENCODER_GP15: ui_selected_item = ITEM_S_FWD_PORT; break; case SEQ_UI_ENCODER_GP16: ui_selected_item = ITEM_S_RESET_STACKS; break; } break; case SUBPAGE_ROUTER: switch( encoder ) { case SEQ_UI_ENCODER_GP9: ui_selected_item = ITEM_R_NODE; break; case SEQ_UI_ENCODER_GP10: ui_selected_item = ITEM_R_SRC_PORT; break; case SEQ_UI_ENCODER_GP11: ui_selected_item = ITEM_R_SRC_CHN; break; case SEQ_UI_ENCODER_GP12: ui_selected_item = ITEM_R_DST_PORT; break; case SEQ_UI_ENCODER_GP13: ui_selected_item = ITEM_R_DST_CHN; break; case SEQ_UI_ENCODER_GP14: return -1; // not used (yet) case SEQ_UI_ENCODER_GP15: case SEQ_UI_ENCODER_GP16: ui_selected_item = ITEM_DEF_PORT; break; } break; case SUBPAGE_EXT_CTRL: switch( encoder ) { case SEQ_UI_ENCODER_GP9: ui_selected_item = ITEM_EXT_PORT; break; case SEQ_UI_ENCODER_GP10: ui_selected_item = ITEM_EXT_PORT_OUT; break; case SEQ_UI_ENCODER_GP11: ui_selected_item = ITEM_EXT_CHN; break; case SEQ_UI_ENCODER_GP12: case SEQ_UI_ENCODER_GP13: case SEQ_UI_ENCODER_GP14: ui_selected_item = ITEM_EXT_CTRL; break; case SEQ_UI_ENCODER_GP15: case SEQ_UI_ENCODER_GP16: ui_selected_item = ITEM_EXT_VALUE; break; } break; case SUBPAGE_MISC: switch( encoder ) { case SEQ_UI_ENCODER_GP9: case SEQ_UI_ENCODER_GP10: ui_selected_item = ITEM_BLM_SCALAR_PORT; break; case SEQ_UI_ENCODER_GP11: case SEQ_UI_ENCODER_GP12: case SEQ_UI_ENCODER_GP13: case SEQ_UI_ENCODER_GP14: return -1; // not used (yet) case SEQ_UI_ENCODER_GP15: case SEQ_UI_ENCODER_GP16: // enter midi monitor page SEQ_UI_PageSet(SEQ_UI_PAGE_MIDIMON); return 1; } break; default: return -1; // unsupported subpage } // for GP encoders and Datawheel switch( ui_selected_item ) { case ITEM_IN_BUS: { if( SEQ_UI_Var8_Inc(&selected_bus, 0, SEQ_MIDI_IN_NUM_BUSSES-1, incrementer) >= 0 ) { return 1; // value changed } return 0; // no change } break; case ITEM_IN_PORT: { u8 port_ix = SEQ_MIDI_PORT_InIxGet(seq_midi_in_port[selected_bus]); if( SEQ_UI_Var8_Inc(&port_ix, 0, SEQ_MIDI_PORT_InNumGet()-1-4, incrementer) >= 0 ) { // don't allow selection of Bus1..Bus4 seq_midi_in_port[selected_bus] = SEQ_MIDI_PORT_InPortGet(port_ix); store_file_required = 1; return 1; // value changed } return 0; // no change } break; case ITEM_IN_CHN: if( SEQ_UI_Var8_Inc(&seq_midi_in_channel[selected_bus], 0, 16, incrementer) >= 0 ) { store_file_required = 1; return 1; // value changed } return 0; // no change case ITEM_IN_LOWER: if( SEQ_UI_Var8_Inc(&seq_midi_in_lower[selected_bus], 0, 127, incrementer) >= 0 ) { store_file_required = 1; return 1; // value changed } return 0; // no change case ITEM_IN_UPPER: if( SEQ_UI_Var8_Inc(&seq_midi_in_upper[selected_bus], 0, 127, incrementer) >= 0 ) { store_file_required = 1; return 1; // value changed } return 0; // no change case ITEM_IN_MODE: { u8 fwd = seq_midi_in_options[selected_bus].MODE_PLAY; if( SEQ_UI_Var8_Inc(&fwd, 0, 1, incrementer) >= 0 ) { seq_midi_in_options[selected_bus].MODE_PLAY = fwd; store_file_required = 1; return 1; // value changed } return 0; // no change } break; case ITEM_RESET_STACKS: { SEQ_MIDI_IN_ResetTransArpStacks(); SEQ_UI_Msg(SEQ_UI_MSG_USER_R, 2000, "Transposer/Arp.", "Stacks cleared!"); // send to external SEQ_MIDI_IN_ExtCtrlSend(SEQ_MIDI_IN_EXT_CTRL_ALL_NOTES_OFF, 127, 0); return 1; } break; case ITEM_S_PORT: { u8 port_ix = SEQ_MIDI_PORT_InIxGet(seq_midi_in_sect_port); if( SEQ_UI_Var8_Inc(&port_ix, 0, SEQ_MIDI_PORT_InNumGet()-1, incrementer) >= 0 ) { seq_midi_in_sect_port = SEQ_MIDI_PORT_InPortGet(port_ix); store_file_required = 1; return 1; // value changed } return 0; // no change } break; case ITEM_S_CHN: if( SEQ_UI_Var8_Inc(&seq_midi_in_sect_channel, 0, 16, incrementer) >= 0 ) { store_file_required = 1; return 1; // value changed } return 0; // no change case ITEM_S_OCT_G1: { u8 oct = seq_midi_in_sect_note[0] / 12; if( SEQ_UI_Var8_Inc(&oct, 0, 11, incrementer) >= 0 ) { seq_midi_in_sect_note[0] = 12*oct; store_file_required = 1; return 1; // value changed } return 0; // no change } break; case ITEM_S_OCT_G2: { u8 oct = seq_midi_in_sect_note[1] / 12; if( SEQ_UI_Var8_Inc(&oct, 0, 11, incrementer) >= 0 ) { seq_midi_in_sect_note[1] = 12*oct; store_file_required = 1; return 1; // value changed } return 0; // no change } break; case ITEM_S_OCT_G3: { u8 oct = seq_midi_in_sect_note[2] / 12; if( SEQ_UI_Var8_Inc(&oct, 0, 11, incrementer) >= 0 ) { seq_midi_in_sect_note[2] = 12*oct; store_file_required = 1; return 1; // value changed } return 0; // no change } break; case ITEM_S_OCT_G4: { u8 oct = seq_midi_in_sect_note[3] / 12; if( SEQ_UI_Var8_Inc(&oct, 0, 11, incrementer) >= 0 ) { seq_midi_in_sect_note[3] = 12*oct; store_file_required = 1; return 1; // value changed } return 0; // no change } break; case ITEM_S_FWD_PORT: { u8 port_ix = SEQ_MIDI_PORT_OutIxGet(seq_midi_in_sect_fwd_port); if( SEQ_UI_Var8_Inc(&port_ix, 0, SEQ_MIDI_PORT_OutNumGet()-1, incrementer) >= 0 ) { seq_midi_in_sect_fwd_port = SEQ_MIDI_PORT_OutPortGet(port_ix); store_file_required = 1; return 1; // value changed } return 0; // no change } break; case ITEM_S_RESET_STACKS: { SEQ_MIDI_IN_ResetChangerStacks(); SEQ_UI_Msg(SEQ_UI_MSG_USER_R, 2000, "Section Changer", "Stacks cleared!"); // send to external SEQ_MIDI_IN_ExtCtrlSend(SEQ_MIDI_IN_EXT_CTRL_ALL_NOTES_OFF, 127, 0); return 1; } break; case ITEM_R_NODE: if( SEQ_UI_Var8_Inc(&selected_router_node, 0, SEQ_MIDI_ROUTER_NUM_NODES-1, incrementer) >= 0 ) { store_file_required = 1; return 1; // value changed } return 0; // no change case ITEM_R_SRC_PORT: { u8 port_ix = SEQ_MIDI_PORT_InIxGet(n->src_port); if( SEQ_UI_Var8_Inc(&port_ix, 0, SEQ_MIDI_PORT_InNumGet()-1, incrementer) >= 0 ) { n->src_port = SEQ_MIDI_PORT_InPortGet(port_ix); store_file_required = 1; return 1; // value changed } return 0; // no change } break; case ITEM_R_SRC_CHN: if( SEQ_UI_Var8_Inc(&n->src_chn, 0, 17, incrementer) >= 0 ) { store_file_required = 1; return 1; // value changed } return 0; // no change case ITEM_R_DST_PORT: { u8 port_ix = SEQ_MIDI_PORT_OutIxGet(n->dst_port); if( SEQ_UI_Var8_Inc(&port_ix, 0, SEQ_MIDI_PORT_OutNumGet()-1, incrementer) >= 0 ) { n->dst_port = SEQ_MIDI_PORT_OutPortGet(port_ix); store_file_required = 1; return 1; // value changed } return 0; // no change } break; case ITEM_R_DST_CHN: if( SEQ_UI_Var8_Inc(&n->dst_chn, 0, 19, incrementer) >= 0 ) { store_file_required = 1; return 1; // value changed } return 0; // no change case ITEM_DEF_PORT: { u8 port_ix = SEQ_MIDI_PORT_OutIxGet(MIOS32_MIDI_DefaultPortGet()); if( SEQ_UI_Var8_Inc(&port_ix, 0, SEQ_MIDI_PORT_OutNumGet()-1, incrementer) >= 0 ) { MIOS32_MIDI_DefaultPortSet(SEQ_MIDI_PORT_OutPortGet(port_ix)); store_file_required = 1; return 1; // value changed } return 0; // no change } break; case ITEM_EXT_PORT: { u8 numPorts = SEQ_MIDI_PORT_InNumGet(); u8 port_ix = (seq_midi_in_ext_ctrl_port == 0xff) ? numPorts : SEQ_MIDI_PORT_InIxGet(seq_midi_in_ext_ctrl_port); if( SEQ_UI_Var8_Inc(&port_ix, 0, numPorts, incrementer) >= 0 ) { seq_midi_in_ext_ctrl_port = (port_ix == numPorts) ? 0xff : SEQ_MIDI_PORT_InPortGet(port_ix); store_file_required = 1; return 1; // value changed } return 0; // no change } break; case ITEM_EXT_PORT_OUT: { u8 port_ix = SEQ_MIDI_PORT_OutIxGet(seq_midi_in_ext_ctrl_out_port); if( SEQ_UI_Var8_Inc(&port_ix, 0, SEQ_MIDI_PORT_OutNumGet()-1, incrementer) >= 0 ) { seq_midi_in_ext_ctrl_out_port = SEQ_MIDI_PORT_OutPortGet(port_ix); store_file_required = 1; return 1; // value changed } return 0; // no change } break; case ITEM_EXT_CHN: if( SEQ_UI_Var8_Inc(&seq_midi_in_ext_ctrl_channel, 0, 16, incrementer) >= 0 ) { store_file_required = 1; return 1; // value changed } return 0; // no change case ITEM_EXT_CTRL: if( SEQ_UI_Var8_Inc(&selected_ext_ctrl, 0, SEQ_MIDI_IN_EXT_CTRL_NUM-1, incrementer) >= 0 ) { store_file_required = 1; return 1; // value changed } return 0; // no change case ITEM_EXT_VALUE: if( selected_ext_ctrl == SEQ_MIDI_IN_EXT_CTRL_NRPN_ENABLED ) { if( SEQ_UI_Var8_Inc(&seq_midi_in_ext_ctrl_asg[selected_ext_ctrl], 0, 1, incrementer) >= 0 ) { store_file_required = 1; return 1; // value changed } } else if( selected_ext_ctrl == SEQ_MIDI_IN_EXT_CTRL_PC_MODE ) { if( SEQ_UI_Var8_Inc(&seq_midi_in_ext_ctrl_asg[selected_ext_ctrl], 0, SEQ_MIDI_IN_EXT_CTRL_PC_MODE_NUM-1, incrementer) >= 0 ) { store_file_required = 1; return 1; // value changed } } else if( selected_ext_ctrl <= SEQ_MIDI_IN_EXT_CTRL_NUM ) { if( SEQ_UI_Var8_Inc(&seq_midi_in_ext_ctrl_asg[selected_ext_ctrl], 0, 128, incrementer) >= 0 ) { store_file_required = 1; return 1; // value changed } } return 0; // no change case ITEM_BLM_SCALAR_PORT: { u8 port_ix = SEQ_MIDI_PORT_InIxGet(seq_blm_port); if( SEQ_UI_Var8_Inc(&port_ix, 0, SEQ_MIDI_PORT_InNumGet()-1, incrementer) >= 0 ) { seq_blm_port = SEQ_MIDI_PORT_InPortGet(port_ix); MUTEX_MIDIOUT_TAKE; blm_timeout_ctr = 0; // fake timeout (so that "BLM not found" message will be displayed) SEQ_BLM_SYSEX_SendRequest(0x00); // request layout from BLM_SCALAR MUTEX_MIDIOUT_GIVE; store_file_required = 1; return 1; // value changed } return 0; // no change } break; } return -1; // invalid or unsupported encoder }
///////////////////////////////////////////////////////////////////////////// // Local Display Handler function // IN: <high_prio>: if set, a high-priority LCD update is requested ///////////////////////////////////////////////////////////////////////////// static s32 LCD_Handler(u8 high_prio) { if( high_prio ) return 0; // there are no high-priority updates // layout: // 00000000001111111111222222222233333333330000000000111111111122222222223333333333 // 01234567890123456789012345678901234567890123456789012345678901234567890123456789 // <--------------------------------------><--------------------------------------> // Select MIDI Device with GP Button: 2 Devices found under /SYSEX // MBSID MBFM .... // Select MIDI Device with GP Button: 10 Devices found under /SYSEX // xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx> /////////////////////////////////////////////////////////////////////////// SEQ_LCD_CursorSet(0, 0); SEQ_LCD_PrintSpaces(80); SEQ_LCD_CursorSet(0, 0); if( dir_num_items < 0 ) { if( dir_name[0] != 0 && dir_num_items == FILE_ERR_NO_DIR ) SEQ_LCD_PrintFormattedString("/SYSEX/%s directory not found on SD Card!", dir_name); else if( dir_num_items == FILE_ERR_NO_DIR ) SEQ_LCD_PrintString("/SYSEX directory not found on SD Card!"); else SEQ_LCD_PrintFormattedString("SD Card Access Error: %d", dir_num_items); } else if( dir_num_items == 0 ) { if( dir_name[0] != 0 ) SEQ_LCD_PrintFormattedString("No .SYX files found under /SYSEX/%s!", dir_name); else SEQ_LCD_PrintString("No subdirectories found in /SYSEX directory on SD Card!"); } else { if( dir_name[0] != 0 ) { SEQ_LCD_PrintString("Select .SYX file with GP Button:"); SEQ_LCD_CursorSet(40, 0); SEQ_LCD_PrintFormattedString("%d files found under /SYSEX/%s", dir_num_items, dir_name); } else { SEQ_LCD_PrintString("Select MIDI Device with GP Button:"); SEQ_LCD_CursorSet(40, 0); SEQ_LCD_PrintFormattedString("%d Devices found under /SYSEX", dir_num_items); } } /////////////////////////////////////////////////////////////////////////// SEQ_LCD_CursorSet(0, 1); if( !dir_name[0] ) { SEQ_LCD_PrintList((char *)ui_global_dir_list, LIST_ENTRY_WIDTH, dir_num_items, NUM_LIST_DISPLAYED_ITEMS, ui_selected_item, dir_view_offset); } else { SEQ_LCD_PrintList((char *)ui_global_dir_list, LIST_ENTRY_WIDTH, dir_num_items, NUM_LIST_DISPLAYED_ITEMS-1, ui_selected_item, dir_view_offset); SEQ_LCD_PrintChar(' '); SEQ_LCD_PrintString((char *)SEQ_MIDI_PORT_OutNameGet(SEQ_MIDI_PORT_OutIxGet(sysex_port))); SEQ_LCD_PrintString(" EXIT"); } return 0; // no error }
///////////////////////////////////////////////////////////////////////////// // Local encoder callback function // Should return: // 1 if value has been changed // 0 if value hasn't been changed // -1 if invalid or unsupported encoder ///////////////////////////////////////////////////////////////////////////// static s32 Encoder_Handler(seq_ui_encoder_t encoder, s32 incrementer) { switch( encoder ) { case SEQ_UI_ENCODER_GP1: case SEQ_UI_ENCODER_GP2: ui_selected_item = ITEM_ENABLE; break; case SEQ_UI_ENCODER_GP3: ui_selected_item = ITEM_PORT; break; case SEQ_UI_ENCODER_GP4: ui_selected_item = ITEM_CHANNEL; break; case SEQ_UI_ENCODER_GP5: case SEQ_UI_ENCODER_GP6: ui_selected_item = ITEM_NOTE_M; break; case SEQ_UI_ENCODER_GP7: case SEQ_UI_ENCODER_GP8: ui_selected_item = ITEM_NOTE_B; break; case SEQ_UI_ENCODER_GP9: case SEQ_UI_ENCODER_GP10: case SEQ_UI_ENCODER_GP11: case SEQ_UI_ENCODER_GP12: case SEQ_UI_ENCODER_GP13: case SEQ_UI_ENCODER_GP14: case SEQ_UI_ENCODER_GP15: case SEQ_UI_ENCODER_GP16: return -1; // not used (yet) } // for GP encoders and Datawheel switch( ui_selected_item ) { case ITEM_ENABLE: if( incrementer ) seq_core_state.METRONOME = (incrementer > 0) ? 1 : 0; return 1; case ITEM_PORT: { u8 port_ix = SEQ_MIDI_PORT_OutIxGet(seq_core_metronome_port); if( SEQ_UI_Var8_Inc(&port_ix, 0, SEQ_MIDI_PORT_OutNumGet()-1, incrementer) >= 0 ) { seq_core_metronome_port = SEQ_MIDI_PORT_OutPortGet(port_ix); store_file_required = 1; return 1; // value changed } return 0; // no change } break; case ITEM_CHANNEL: if( SEQ_UI_Var8_Inc(&seq_core_metronome_chn, 0, 16, incrementer) >= 0 ) { store_file_required = 1; return 1; // value changed } return 0; // no change case ITEM_NOTE_M: if( SEQ_UI_Var8_Inc(&seq_core_metronome_note_m, 0, 127, incrementer) >= 0 ) { store_file_required = 1; return 1; // value changed } return 0; // no change case ITEM_NOTE_B: if( SEQ_UI_Var8_Inc(&seq_core_metronome_note_b, 0, 127, incrementer) >= 0 ) { store_file_required = 1; return 1; // value changed } return 0; // no change } return -1; // invalid or unsupported encoder }
///////////////////////////////////////////////////////////////////////////// // Local Display Handler function // IN: <high_prio>: if set, a high-priority LCD update is requested ///////////////////////////////////////////////////////////////////////////// static s32 LCD_Handler(u8 high_prio) { if( high_prio ) return 0; // there are no high-priority updates // layout: // 00000000001111111111222222222233333333330000000000111111111122222222223333333333 // 01234567890123456789012345678901234567890123456789012345678901234567890123456789 // <--------------------------------------><--------------------------------------> // Metronome Port Chn. Meas.Note BeatNote // off Def. #10 C#1 C#1 /////////////////////////////////////////////////////////////////////////// SEQ_LCD_CursorSet(0, 0); SEQ_LCD_PrintString("Metronome Port Chn. Meas.Note BeatNote "); SEQ_LCD_PrintSpaces(40); /////////////////////////////////////////////////////////////////////////// SEQ_LCD_CursorSet(0, 1); SEQ_LCD_PrintSpaces(3); if( ui_selected_item == ITEM_ENABLE && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(3); } else { SEQ_LCD_PrintString(seq_core_state.METRONOME ? "on " : "off"); } SEQ_LCD_PrintSpaces(4); /////////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_PORT && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(4); } else { SEQ_LCD_PrintString(SEQ_MIDI_PORT_OutNameGet(SEQ_MIDI_PORT_OutIxGet(seq_core_metronome_port))); } SEQ_LCD_PrintSpaces(1); /////////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_CHANNEL && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(3); } else { if( !seq_core_metronome_chn ) SEQ_LCD_PrintString("---"); else SEQ_LCD_PrintFormattedString("#%2d", seq_core_metronome_chn); } SEQ_LCD_PrintSpaces(5); /////////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_NOTE_M && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(3); } else { SEQ_LCD_PrintNote(seq_core_metronome_note_m); } SEQ_LCD_PrintSpaces(7); /////////////////////////////////////////////////////////////////////////// if( ui_selected_item == ITEM_NOTE_B && ui_cursor_flash ) { SEQ_LCD_PrintSpaces(3); } else { SEQ_LCD_PrintNote(seq_core_metronome_note_b); } SEQ_LCD_PrintSpaces(4 + 40); return 0; // no error }