📄 ncurs_c.c
字号:
}static void ctl_keysig(int8 k, int ko){ static int8 lastkeysig = CTL_STATUS_UPDATE; static int lastoffset = CTL_STATUS_UPDATE; static const char *keysig_name[] = { "Cb", "Gb", "Db", "Ab", "Eb", "Bb", "F ", "C ", "G ", "D ", "A ", "E ", "B ", "F#", "C#", "G#", "D#", "A#" }; int i, j; if (k == CTL_STATUS_UPDATE) k = lastkeysig; else lastkeysig = k; if (ko == CTL_STATUS_UPDATE) ko = lastoffset; else lastoffset = ko; i = k + ((k < 8) ? 7 : -6); if (ko > 0) for (j = 0; j < ko; j++) i += (i > 10) ? -5 : 7; else for (j = 0; j < abs(ko); j++) i += (i < 7) ? 5 : -7; wmove(dftwin, SEPARATE1_LINE, 43); wattron(dftwin, A_BOLD); wprintw(dftwin, "%s %s (%+03d) ", keysig_name[i], (k < 8) ? "Maj" : "Min", ko); wattroff(dftwin, A_BOLD); N_ctl_refresh();}static void ctl_tempo(int t, int tr){ static int lasttempo = CTL_STATUS_UPDATE; static int lastratio = CTL_STATUS_UPDATE; if (t == CTL_STATUS_UPDATE) t = lasttempo; else lasttempo = t; if (tr == CTL_STATUS_UPDATE) tr = lastratio; else lastratio = tr; t = (int) (500000 / (double) t * 120 * (double) tr / 100 + 0.5); wmove(dftwin, SEPARATE1_LINE, 66); wattron(dftwin, A_BOLD); wprintw(dftwin, "%3d (%03d %%) ", t, tr); wattroff(dftwin, A_BOLD); N_ctl_refresh();}static void ctl_file_name(char *name){ if(name == NULL) { if(current_MFnode != NULL) name = current_MFnode->file; else return; } N_ctl_clrtoeol(FILE_LINE); waddstr(dftwin, "File: "); wattron(dftwin, A_BOLD); waddnstr(dftwin, name, COLS - 8); wattroff(dftwin, A_BOLD);#ifdef MIDI_TITLE /* Display MIDI title */ N_ctl_clrtoeol(FILE_TITLE_LINE); waddstr(dftwin, "Title: "); if(current_MFnode != NULL && current_MFnode->title != NULL) waddnstr(dftwin, current_MFnode->title, COLS - 9);#endif N_ctl_refresh();}static void ctl_current_time(int secs, int v){ int mins; static int last_voices = CTL_STATUS_INIT, last_v = CTL_STATUS_INIT; static int last_secs = CTL_STATUS_INIT; if(secs == CTL_STATUS_INIT) { last_voices = last_v = last_secs = CTL_STATUS_INIT; return; } if(last_secs != secs) { last_secs = secs; mins = secs/60; secs -= mins*60; wmove(dftwin, TIME_LINE, 5); wattron(dftwin, A_BOLD); wprintw(dftwin, "%3d:%02d", mins, secs); wattroff(dftwin, A_BOLD); scr_modified_flag = 1; } if(last_v != v) { last_v = v; wmove(dftwin, VOICE_LINE, 48); wattron(dftwin, A_BOLD); wprintw(dftwin, "%3d", v); wattroff(dftwin, A_BOLD); scr_modified_flag = 1; } if(last_voices != voices) { last_voices = voices; wmove(dftwin, VOICE_LINE, 54); wprintw(dftwin, "%3d", voices); scr_modified_flag = 1; }}static void ctl_note(int status, int ch, int note, int vel){ int n, c; unsigned int onoff = 0, check, prev_check; Bitset *bitset; if(ch >= display_channels || ctl_ncurs_mode != NCURS_MODE_TRACE || selected_channel == ch) return; scr_modified_flag = 1; if(display_velocity_flag) n = '0' + (10 * vel) / 128; else n = note_name_char[note % 12]; c = (COLS - 28) / 12 * 12; if(c <= 0) c = 1; note = note % c; wmove(dftwin, NOTE_LINE + ch, note + 3); bitset = channel_program_flags + ch; switch(status) { case VOICE_DIE: waddch(dftwin, ','); onoff = 0; break; case VOICE_FREE: if(get_bitset1(gs_lcd_bits + ch, note)) waddch(dftwin, GS_LCD_MARK_CHAR); else waddch(dftwin, '.'); onoff = 0; break; case VOICE_ON: wattron(dftwin, A_REVERSE); waddch(dftwin, n); wattroff(dftwin, A_REVERSE); indicator_chan_update(ch); onoff = 1; break; case VOICE_SUSTAINED: wattron(dftwin, A_BOLD); waddch(dftwin, n); wattroff(dftwin, A_BOLD); onoff = 0; break; case VOICE_OFF: waddch(dftwin, n); onoff = 0; break; case GS_LCD_MARK_ON: set_bitset1(gs_lcd_bits + ch, note, 1); if(!get_bitset1(bitset, note)) waddch(dftwin, GS_LCD_MARK_CHAR); return; case GS_LCD_MARK_OFF: set_bitset1(gs_lcd_bits + ch, note, 0); if(!get_bitset1(bitset, note)) waddch(dftwin, '.'); return; } prev_check = has_bitset(bitset); set_bitset1(bitset, note, onoff); if(prev_check == onoff) { /* Not change program mark */ return; } check = has_bitset(bitset); if(prev_check ^ check) { wmove(dftwin, NOTE_LINE + ch, COLS - 21); if(check) { wattron(dftwin, A_BOLD); waddch(dftwin, '*'); wattroff(dftwin, A_BOLD); } else { waddch(dftwin, ' '); } }}static void ctl_temper_keysig(int8 tk, int ko){ static int8 lastkeysig = CTL_STATUS_UPDATE; static int lastoffset = CTL_STATUS_UPDATE; static const char *keysig_name[] = { "Cb", "Gb", "Db", "Ab", "Eb", "Bb", " F", " C", " G", " D", " A", " E", " B", "F#", "C#", "G#", "D#", "A#" }; int adj, i, j; if (tk == CTL_STATUS_UPDATE) tk = lastkeysig; else lastkeysig = tk; if (ko == CTL_STATUS_UPDATE) ko = lastoffset; else lastoffset = ko; if (ctl_ncurs_mode != NCURS_MODE_TRACE) return; adj = (tk + 8) & 0x20, tk = (tk + 8) % 32 - 8; i = tk + ((tk < 8) ? 7 : -6); if (ko > 0) for (j = 0; j < ko; j++) i += (i > 10) ? -5 : 7; else for (j = 0; j < abs(ko); j++) i += (i < 7) ? 5 : -7; wmove(dftwin, TITLE_LINE, COLS - 24); if (adj) wattron(dftwin, A_BOLD); wprintw(dftwin, "%s%c", keysig_name[i], (tk < 8) ? ' ' : 'm'); if (adj) wattroff(dftwin, A_BOLD); N_ctl_refresh();}static void ctl_temper_type(int ch, int8 tt){ if (ch >= display_channels) return; if (tt != CTL_STATUS_UPDATE) { if (ChannelStatus[ch].tt == tt) return; ChannelStatus[ch].tt = tt; } else tt = ChannelStatus[ch].tt; if (ctl_ncurs_mode != NCURS_MODE_TRACE || ch == selected_channel) return; wmove(dftwin, NOTE_LINE + ch, COLS - 23); switch (tt) { case 0: waddch(dftwin, ' '); break; case 1: waddch(dftwin, 'P'); break; case 2: waddch(dftwin, 'm'); break; case 3: wattron(dftwin, A_BOLD); waddch(dftwin, 'p'); wattroff(dftwin, A_BOLD); break; case 64: waddch(dftwin, '0'); break; case 65: waddch(dftwin, '1'); break; case 66: waddch(dftwin, '2'); break; case 67: waddch(dftwin, '3'); break; } scr_modified_flag = 1;}static void ctl_mute(int ch, int mute){ if (ch >= display_channels) return; if (mute != CTL_STATUS_UPDATE) { if (ChannelStatus[ch].mute == mute) return; ChannelStatus[ch].mute = mute; } else mute = ChannelStatus[ch].mute; if (ctl_ncurs_mode != NCURS_MODE_TRACE) return; wmove(dftwin, NOTE_LINE + ch, 0); if (ch != selected_channel) { wattron(dftwin, (mute) ? A_REVERSE : 0); wprintw(dftwin, "%02d", ch + 1); wattroff(dftwin, (mute) ? A_REVERSE : 0); } else { wattron(dftwin, A_BOLD | ((mute) ? A_REVERSE : 0)); wprintw(dftwin, "%02d", ch + 1); wattroff(dftwin, A_BOLD | ((mute) ? A_REVERSE : 0)); } scr_modified_flag = 1;}static void ctl_drumpart(int ch, int is_drum){ if(ch >= display_channels) return; ChannelStatus[ch].is_drum = is_drum;}static void ctl_program(int ch, int prog, char *comm, unsigned int banks){ int val; int bank; if(ch >= display_channels) return; if(prog != CTL_STATUS_UPDATE) { bank = banks & 0xff; ChannelStatus[ch].prog = prog; ChannelStatus[ch].bank = bank; ChannelStatus[ch].bank_lsb = (banks >> 8) & 0xff; ChannelStatus[ch].bank_msb = (banks >> 16) & 0xff; ChannelStatus[ch].comm = (comm ? comm : ""); } else { prog = ChannelStatus[ch].prog; bank = ChannelStatus[ch].bank; } ChannelStatus[ch].last_note_on = 0.0; /* reset */ if(ctl_ncurs_mode != NCURS_MODE_TRACE) return; if(selected_channel == ch) { init_trace_window_chan(ch); return; } if(ChannelStatus[ch].is_drum) val = bank; else val = prog; if(!IS_CURRENT_MOD_FILE) val += progbase; wmove(dftwin, NOTE_LINE + ch, COLS - 21); if(ChannelStatus[ch].is_drum) { wattron(dftwin, A_BOLD); wprintw(dftwin, " %03d", val); wattroff(dftwin, A_BOLD); } else wprintw(dftwin, " %03d", val); scr_modified_flag = 1;}static void ctl_volume(int ch, int vol){ if(ch >= display_channels) return; if(vol != CTL_STATUS_UPDATE) { if(ChannelStatus[ch].vol == vol) return; ChannelStatus[ch].vol = vol; } else vol = ChannelStatus[ch].vol; if(ctl_ncurs_mode != NCURS_MODE_TRACE || selected_channel == ch) return; wmove(dftwin, NOTE_LINE + ch, COLS - 16); wprintw(dftwin, "%3d", vol); scr_modified_flag = 1;}static void ctl_expression(int ch, int exp){ if(ch >= display_channels) return; if(exp != CTL_STATUS_UPDATE) { if(ChannelStatus[ch].exp == exp) return; ChannelStatus[ch].exp = exp; } else exp = ChannelStatus[ch].exp; if(ctl_ncurs_mode != NCURS_MODE_TRACE || selected_channel == ch) return; wmove(dftwin, NOTE_LINE + ch, COLS - 12); wprintw(dftwin, "%3d", exp); scr_modified_flag = 1;}static void ctl_panning(int ch, int pan){ if(ch >= display_channels) return; if(pan != CTL_STATUS_UPDATE) { if(pan == NO_PANNING) ; else if(pan < 5) pan = 0; else if(pan > 123) pan = 127; else if(pan > 60 && pan < 68) pan = 64; if(ChannelStatus[ch].pan == pan) return; ChannelStatus[ch].pan = pan; } else pan = ChannelStatus[ch].pan; if(ctl_ncurs_mode != NCURS_MODE_TRACE || selected_channel == ch) return; wmove(dftwin, NOTE_LINE + ch, COLS - 8); switch(pan) { case NO_PANNING: waddstr(dftwin, " "); break; case 0: waddstr(dftwin, " L "); break; case 64: waddstr(dftwin, " C "); break; case 127: waddstr(dftwin, " R "); break; default: pan -= 64; if(pan < 0) { waddch(dftwin, '-'); pan = -pan; } else waddch(dftwin, '+'); wprintw(dftwin, "%02d", pan); break; } scr_modified_flag = 1;}static void ctl_sustain(int ch, int sus){ if(ch >= display_channels) return; if(sus != CTL_STATUS_UPDATE) { if(ChannelStatus[ch].sus == sus) return; ChannelStatus[ch].sus = sus; } else sus = ChannelStatus[ch].sus; if(ctl_ncurs_mode != NCURS_MODE_TRACE || selected_channel == ch) return; wmove(dftwin, NOTE_LINE + ch, COLS - 4); if(sus) waddch(dftwin, 'S'); else waddch(dftwin, ' '); scr_modified_flag = 1;}static void update_bend_mark(int ch){ wmove(dftwin, NOTE_LINE + ch, COLS - 2); waddch(dftwin, ChannelStatus[ch].bend_mark); scr_modified_flag = 1;}static void ctl_pitch_bend(int ch, int pitch){ int mark; if(ch >= display_channels) return; ChannelStatus[ch].pitch = pitch; if(ctl_ncurs_mode != NCURS_MODE_TRACE || selected_channel == ch) return; if(ChannelStatus[ch].wheel) mark = '='; else if(pitch > 0x2000) mark = '>'; else if(pitch < 0x2000) mark = '<'; else mark = ' '; if(ChannelStatus[ch].bend_mark == mark) return; ChannelStatus[ch].bend_mark = mark; update_bend_mark(ch);}static void ctl_mod_wheel(int ch, int wheel){ int mark; if(ch >= display_channels) return; ChannelStatus[ch].wheel = wheel; if(ctl_ncurs_mode != NCURS_MODE_TRACE || selected_channel == ch) return; if(wheel) mark = '='; else { /* restore pitch bend mark */ if(ChannelStatus[ch].pitch > 0x2000) mark = '>'; else if(ChannelStatus[ch].pitch < 0x2000) mark = '<'; else mark = ' '; } if(ChannelStatus[ch].bend_mark == mark) return; ChannelStatus[ch].bend_mark = mark; update_bend_mark(ch);}static void ctl_lyric(int lyricid){ char *lyric; lyric = event2string(lyricid); if(lyric != NULL) { /* EAW -- if not a true KAR lyric, ignore \r, treat \n as \r */ if (*lyric != ME_KARAOKE_LYRIC) { while (strchr(lyric, '\r')) { *(strchr(lyric, '\r')) = ' '; } if (ctl.trace_playing) { while (strchr(lyric, '\n')) { *(strchr(lyric, '\n')) = '\r'; } } } if(ctl.trace_playing) { if(*lyric == ME_KARAOKE_LYRIC) { if(lyric[1] == '/') { display_lyric(" / ", LYRIC_WORD_NOSEP); display_lyric(lyric + 2, LYRIC_WORD_NOSEP); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -