int glue_startInputRec() { if (G_audio_status == false) return -1; if (G_Mixer.chanInput != -1) // if there's another recording active return 1; if (!G_Mixer.running) { glue_startSeq(); mainWin->beat_stop->value(1); } int ch = mh_startInputRec(); if (ch == -1) // no chans available return 0; glue_setVol(ch, 1.0f); gu_trim_label(G_Mixer.chan[ch]->name.c_str(), 28, mainWin->keyboard->sampleButton[ch]); mainWin->input_rec->value(1); mainWin->input_rec->redraw(); mainWin->beat_stop->redraw(); return 1; }
int glue_loadChannel(int c, const char *fname, const char *fpath) { /* save the patch and take the last browser's dir in order to re-use it * the next time */ G_Conf.setPath(G_Conf.samplePath, fpath); int result = mh_loadChan(fname, c); if (result == SAMPLE_LOADED_OK) gu_trim_label(G_Mixer.chan[c]->name.c_str(), 28, mainWin->keyboard->sampleButton[c]); return result; }
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 gu_update_controls() { for (unsigned i=0; i<MAX_NUM_CHAN; i++) { /* update status box and sampleButton */ gu_resetChannel(i); switch (G_Mixer.chanStatus[i]) { case STATUS_EMPTY: mainWin->keyboard->sampleButton[i]->label("-- no sample --"); break; case STATUS_MISSING: case STATUS_WRONG: mainWin->keyboard->sampleButton[i]->label("* file not found! *"); break; default: gu_trim_label(G_Mixer.chan[i]->name.c_str(), 28, mainWin->keyboard->sampleButton[i]); break; } mainWin->keyboard->sampleButton[i]->redraw(); /* update volumes+mute */ mainWin->keyboard->vol[i]->value(G_Mixer.chanVolume[i]); mainWin->keyboard->mute[i]->value(G_Mixer.chanMuteVol[i] == 1.0f ? 0 : 1); /* updates modebox */ mainWin->keyboard->modeBoxes[i]->value(G_Mixer.chanMode[i]); mainWin->keyboard->modeBoxes[i]->redraw(); /* upate 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 (recorder::chanEvents[i]) mainWin->keyboard->addActionButton(i, recorder::chanActive[i]); else mainWin->keyboard->remActionButton(i); } mainWin->outVol->value(G_Mixer.outVol); mainWin->inVol->value(G_Mixer.inVol); /* if you reset to init state while the seq is in play: it's better to * update the button status */ mainWin->beat_stop->value(G_Mixer.running); /* update bpm and beats. If bpm < 99.9 show just 4 digits (+ escape), * otherwise a bad looking 0 remains */ int size = G_Mixer.bpm < 100.0f ? 5 : 6; char buf_bpm[6]; snprintf(buf_bpm, size, "%f", G_Mixer.bpm); mainWin->bpm->copy_label(buf_bpm); char buf_batt[8]; sprintf(buf_batt, "%d/%d", G_Mixer.beats, G_Mixer.bars); mainWin->beats->copy_label(buf_batt); if (G_Mixer.quantize == 6) mainWin->quantize->value(5); else if (G_Mixer.quantize == 8) mainWin->quantize->value(6); else mainWin->quantize->value(G_Mixer.quantize); mainWin->metronome->value(0); mainWin->metronome->redraw(); }
void gu_update_controls() { for (unsigned i=0; i<G_Mixer.channels.size; i++) { /* update status box and sampleButton */ channel *ch = G_Mixer.channels.at(i); ch->guiChannel->reset(); /** FIXME - move this to gChannel */ if (ch->type == CHANNEL_SAMPLE) { switch (ch->status) { case STATUS_EMPTY: ch->guiChannel->sampleButton->label("-- no sample --"); break; case STATUS_MISSING: case STATUS_WRONG: ch->guiChannel->sampleButton->label("* file not found! *"); break; default: gu_trim_label(ch->wave->name.c_str(), 28, ch->guiChannel->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) ch->guiChannel->addActionButton(ch->readActions); else ch->guiChannel->remActionButton(); } char k[4]; sprintf(k, "%c", ch->key); ch->guiChannel->button->copy_label(k); ch->guiChannel->button->redraw(); ch->guiChannel->sampleButton->redraw(); /* update volumes+mute+solo */ ch->guiChannel->vol->value(ch->volume); ch->guiChannel->mute->value(ch->mute); ch->guiChannel->solo->value(ch->solo); /* updates modebox */ if (ch->type == CHANNEL_SAMPLE) { ch->guiChannel->modeBox->value(ch->mode); ch->guiChannel->modeBox->redraw(); } } mainWin->outVol->value(G_Mixer.outVol); mainWin->inVol->value(G_Mixer.inVol); /* if you reset to init state while the seq is in play: it's better to * update the button status */ mainWin->beat_stop->value(G_Mixer.running); /* update bpm and beats. If bpm < 99.9 show just 4 digits (+ escape), * otherwise a bad looking 0 remains */ int size = G_Mixer.bpm < 100.0f ? 5 : 6; char buf_bpm[6]; snprintf(buf_bpm, size, "%f", G_Mixer.bpm); mainWin->bpm->copy_label(buf_bpm); char buf_batt[8]; sprintf(buf_batt, "%d/%d", G_Mixer.beats, G_Mixer.bars); mainWin->beats->copy_label(buf_batt); if (G_Mixer.quantize == 6) mainWin->quantize->value(5); else if (G_Mixer.quantize == 8) mainWin->quantize->value(6); else mainWin->quantize->value(G_Mixer.quantize); mainWin->metronome->value(0); mainWin->metronome->redraw(); }