void gSampleChannel::reset() { delActionButton(true); mainButton->setDefaultMode("-- no sample --"); mainButton->redraw(); status->redraw(); }
void gSampleChannel::reset() { sampleButton->bgColor0 = COLOR_BG_0; sampleButton->bdColor = COLOR_BD_0; sampleButton->txtColor = COLOR_TEXT_0; sampleButton->label("-- no sample --"); delActionButton(true); // force==true, don't check, just remove it sampleButton->redraw(); status->redraw(); }
void gSampleChannel::update() { /* update sample button's label */ switch (ch->status) { case STATUS_EMPTY: sampleButton->label("-- no sample --"); break; case STATUS_MISSING: case STATUS_WRONG: sampleButton->label("* file not found! *"); break; default: gu_trim_label(ch->wave->name.c_str(), 28, sampleButton); break; } /* update channels. If you load a patch with recorded actions, the 'R' * button must be shown. Moreover if the actions are active, the 'R' * button must be activated accordingly. */ if (ch->hasActions) addActionButton(); else delActionButton(); /* update key box */ char k[4]; sprintf(k, "%c", ch->key); button->copy_label(k); button->redraw(); /* updates modebox */ modeBox->value(ch->mode); modeBox->redraw(); /* update volumes+mute+solo */ vol->value(ch->volume); mute->value(ch->mute); solo->value(ch->solo); }
void gSampleChannel::update() { switch (ch->status) { case STATUS_EMPTY: mainButton->label("-- no sample --"); break; case STATUS_MISSING: case STATUS_WRONG: mainButton->label("* file not found! *"); break; default: mainButton->label(ch->wave->name.c_str()); break; } if (ch->hasActions) addActionButton(); else delActionButton(); modeBox->value(ch->mode); modeBox->redraw(); vol->value(ch->volume); mute->value(ch->mute); solo->value(ch->solo); mainButton->setKey(ch->key); #ifdef WITH_VST fx->full = ch->plugins_DEPR_.size() > 0; fx->redraw(); #endif }
void gSampleChannel::__cb_openMenu() { /* if you're recording (actions or input) no menu is allowed; you can't * do anything, especially deallocate the channel */ if (G_Mixer.chanInput == ch || recorder::active) return; /* the following is a trash workaround for a FLTK menu. We need a gMenu * widget asap */ Fl_Menu_Item rclick_menu[] = { {"Load new sample..."}, // 0 {"Export sample to file..."}, // 1 {"Set key..."}, // 2 {"Setup MIDI input..."}, // 3 {"Edit sample..."}, // 4 {"Edit actions..."}, // 5 {"Clear actions", 0, 0, 0, FL_SUBMENU}, // 6 {"All"}, // 7 {"Mute"}, // 8 {"Volume"}, // 9 {"Start/Stop"}, // 10 {0}, // 11 {"Free channel"}, // 12 {"Delete channel"}, // 13 {0} }; if (ch->status & (STATUS_EMPTY | STATUS_MISSING)) { rclick_menu[1].deactivate(); rclick_menu[4].deactivate(); rclick_menu[12].deactivate(); } /* no 'clear actions' if there are no actions */ if (!ch->hasActions) rclick_menu[6].deactivate(); /* no 'clear start/stop actions' for those channels in loop mode: * they cannot have start/stop actions. */ if (ch->mode & LOOP_ANY) rclick_menu[10].deactivate(); Fl_Menu_Button *b = new Fl_Menu_Button(0, 0, 100, 50); b->box(G_BOX); b->textsize(11); b->textcolor(COLOR_TEXT_0); b->color(COLOR_BG_0); const Fl_Menu_Item *m = rclick_menu->popup(Fl::event_x(), Fl::event_y(), 0, 0, b); if (!m) return; if (strcmp(m->label(), "Load new sample...") == 0) { openBrowser(BROWSER_LOAD_SAMPLE); return; } if (strcmp(m->label(), "Set key...") == 0) { new gdKeyGrabber(ch); /// FIXME - use gu_openSubWindow return; } if (strcmp(m->label(), "Setup MIDI input...") == 0) { gu_openSubWindow(mainWin, new gdMidiGrabberChannel(ch), 0); return; } if (strcmp(m->label(), "Edit sample...") == 0) { gu_openSubWindow(mainWin, new gdEditor(ch), WID_SAMPLE_EDITOR); /// FIXME title it's up to gdEditor return; } if (strcmp(m->label(), "Export sample to file...") == 0) { openBrowser(BROWSER_SAVE_SAMPLE); return; } if (strcmp(m->label(), "Delete channel") == 0) { if (!gdConfirmWin("Warning", "Delete channel: are you sure?")) return; glue_deleteChannel(ch); return; } if (strcmp(m->label(), "Free channel") == 0) { if (ch->status == STATUS_PLAY) { if (!gdConfirmWin("Warning", "This action will stop the channel: are you sure?")) return; } else if (!gdConfirmWin("Warning", "Free channel: are you sure?")) return; glue_freeChannel(ch); /* delete any related subwindow */ /** FIXME - use gu_closeAllSubwindows() */ mainWin->delSubWindow(WID_FILE_BROWSER); mainWin->delSubWindow(WID_ACTION_EDITOR); mainWin->delSubWindow(WID_SAMPLE_EDITOR); mainWin->delSubWindow(WID_FX_LIST); return; } if (strcmp(m->label(), "Mute") == 0) { if (!gdConfirmWin("Warning", "Clear all mute actions: are you sure?")) return; recorder::clearAction(ch->index, ACTION_MUTEON | ACTION_MUTEOFF); if (!ch->hasActions) delActionButton(); /* TODO - set mute=false */ gu_refreshActionEditor(); // refresh a.editor window, it could be open return; } if (strcmp(m->label(), "Start/Stop") == 0) { if (!gdConfirmWin("Warning", "Clear all start/stop actions: are you sure?")) return; recorder::clearAction(ch->index, ACTION_KEYPRESS | ACTION_KEYREL | ACTION_KILLCHAN); if (!ch->hasActions) delActionButton(); gu_refreshActionEditor(); // refresh a.editor window, it could be open return; } if (strcmp(m->label(), "Volume") == 0) { if (!gdConfirmWin("Warning", "Clear all volume actions: are you sure?")) return; recorder::clearAction(ch->index, ACTION_VOLUME); if (!ch->hasActions) delActionButton(); gu_refreshActionEditor(); // refresh a.editor window, it could be open return; } if (strcmp(m->label(), "All") == 0) { if (!gdConfirmWin("Warning", "Clear all actions: are you sure?")) return; recorder::clearChan(ch->index); delActionButton(); gu_refreshActionEditor(); // refresh a.editor window, it could be open return; } if (strcmp(m->label(), "Edit actions...") == 0) { gu_openSubWindow(mainWin, new gdActionEditor(ch), WID_ACTION_EDITOR); return; } }
void gSampleChannel::__cb_openMenu() { if (G_Mixer.chanInput == ch || recorder::active) return; Fl_Menu_Item rclick_menu[] = { {"Load new sample..."}, {"Export sample to file..."}, {"Setup keyboard input..."}, {"Setup MIDI input..."}, {"Setup MIDI output..."}, {"Edit sample..."}, {"Edit actions..."}, {"Clear actions", 0, 0, 0, FL_SUBMENU}, {"All"}, {"Mute"}, {"Volume"}, {"Start/Stop"}, {0}, {"Clone channel"}, {"Free channel"}, {"Delete channel"}, {0} }; if (ch->status & (STATUS_EMPTY | STATUS_MISSING)) { rclick_menu[1].deactivate(); rclick_menu[5].deactivate(); rclick_menu[14].deactivate(); } if (!ch->hasActions) rclick_menu[7].deactivate(); if (ch->mode & LOOP_ANY) rclick_menu[11].deactivate(); Fl_Menu_Button *b = new Fl_Menu_Button(0, 0, 100, 50); b->box(G_BOX); b->textsize(GUI_FONT_SIZE_BASE); b->textcolor(COLOR_TEXT_0); b->color(COLOR_BG_0); const Fl_Menu_Item *m = rclick_menu->popup(Fl::event_x(), Fl::event_y(), 0, 0, b); if (!m) return; if (strcmp(m->label(), "Load new sample...") == 0) { openBrowser(BROWSER_LOAD_SAMPLE); return; } if (strcmp(m->label(), "Setup keyboard input...") == 0) { new gdKeyGrabber(ch); return; } if (strcmp(m->label(), "Setup MIDI input...") == 0) { gu_openSubWindow(mainWin, new gdMidiInputChannel(ch), 0); return; } if (strcmp(m->label(), "Setup MIDI output...") == 0) { gu_openSubWindow(mainWin, new gdMidiOutputSampleCh(ch), 0); return; } if (strcmp(m->label(), "Edit sample...") == 0) { gu_openSubWindow(mainWin, new gdEditor(ch), WID_SAMPLE_EDITOR); return; } if (strcmp(m->label(), "Export sample to file...") == 0) { openBrowser(BROWSER_SAVE_SAMPLE); return; } if (strcmp(m->label(), "Delete channel") == 0) { if (!gdConfirmWin("Warning", "Delete channel: are you sure?")) return; glue_deleteChannel(ch); return; } if (strcmp(m->label(), "Free channel") == 0) { if (ch->status == STATUS_PLAY) { if (!gdConfirmWin("Warning", "This action will stop the channel: are you sure?")) return; } else if (!gdConfirmWin("Warning", "Free channel: are you sure?")) return; glue_freeChannel(ch); mainWin->delSubWindow(WID_FILE_BROWSER); mainWin->delSubWindow(WID_ACTION_EDITOR); mainWin->delSubWindow(WID_SAMPLE_EDITOR); mainWin->delSubWindow(WID_FX_LIST); return; } if (strcmp(m->label(), "Clone channel") == 0) { glue_cloneChannel(ch); return; } if (strcmp(m->label(), "Mute") == 0) { if (!gdConfirmWin("Warning", "Clear all mute actions: are you sure?")) return; recorder::clearAction(ch->index, ACTION_MUTEON | ACTION_MUTEOFF); if (!ch->hasActions) delActionButton(); gu_refreshActionEditor(); return; } if (strcmp(m->label(), "Start/Stop") == 0) { if (!gdConfirmWin("Warning", "Clear all start/stop actions: are you sure?")) return; recorder::clearAction(ch->index, ACTION_KEYPRESS | ACTION_KEYREL | ACTION_KILLCHAN); if (!ch->hasActions) delActionButton(); gu_refreshActionEditor(); return; } if (strcmp(m->label(), "Volume") == 0) { if (!gdConfirmWin("Warning", "Clear all volume actions: are you sure?")) return; recorder::clearAction(ch->index, ACTION_VOLUME); if (!ch->hasActions) delActionButton(); gu_refreshActionEditor(); return; } if (strcmp(m->label(), "All") == 0) { if (!gdConfirmWin("Warning", "Clear all actions: are you sure?")) return; recorder::clearChan(ch->index); delActionButton(); gu_refreshActionEditor(); return; } if (strcmp(m->label(), "Edit actions...") == 0) { gu_openSubWindow(mainWin, new gdActionEditor(ch), WID_ACTION_EDITOR); return; } }