void VPiano::slotController() { int index = m_comboControl->currentIndex(); int controller = m_comboControl->itemData(index).toInt(); int value = m_Control->value(); sendController( controller, value ); m_ctlState[ controller ] = value; }
void VPiano::resetAllControllers() { sendController(CTL_RESET_ALL_CTL, 0); int index = m_comboControl->currentIndex(); int ctl = m_comboControl->itemData(index).toInt(); initControllers(); m_comboControl->setCurrentIndex(index); m_Control->setValue(m_ctlState[ctl]); }
void VPiano::bankChange(const int bank) { int method = (m_ins != NULL) ? m_ins->bankSelMethod() : 0; int lsb, msb; switch (method) { case 0: lsb = CALC_LSB(bank); msb = CALC_MSB(bank); sendController(CTL_MSB, msb); sendController(CTL_LSB, lsb); break; case 1: sendController(CTL_MSB, bank); break; case 2: sendController(CTL_LSB, bank); break; default: /* if method is 3 or above, do nothing */ break; } }
void *handleResetRebootTimerThread(void * arg) { while(true){ sleep(25); //cout << "Сброс таймера перезагрузки устройства...\n"; sendController(xmlStringToTag("command", "resetRebootDeviceTimer")); } return 0; }
/** * @short Gets the audio signals for both channels (actually a copy) */ void Polybase::getAudio(float *audio[2], unsigned int nsamples, const MidiEventList &list){ if (nsamples>chunksize){ if (chunk){ delete chunk; } chunk=new float[nsamples]; } unsigned int uptoSample=0; unsigned int i; foreach(MidiEvent ev, list){ if (ev.sampleOffset>uptoSample){ calculateChunk(&audio[0][uptoSample], ev.sampleOffset-uptoSample); uptoSample=ev.sampleOffset; } switch (ev.type){ case MidiEvent::noteOn: noteOn(ev.data[0], ev.data[1]); break; case MidiEvent::noteOff: noteOff(ev.data[0], ev.data[1]); break; case MidiEvent::controller: controller(ev.data[0], ev.data[1]); break; default: break; } } calculateChunk(&audio[0][uptoSample], nsamples-uptoSample); for (i=0;i<nsamples;i++){ float s=audio[0][i]*volume; if (s>1.0 || s<-1.0){ volume*=0.9; if (s<0.0) s=-1.0; else s=1.0; WARNING("Clip %f! lowering volume to %f", s, volume); emit sendController(0, volume*127); } audio[0][i]=s; } // no stereo by the moment memcpy(audio[1],audio[0],sizeof(float)*nsamples); }
void VPiano::customEvent ( QEvent *event ) { if (event->type() == NoteOnEventType ) { NoteOnEvent *ev = static_cast<NoteOnEvent*>(event); ui.pianokeybd->showNoteOn(ev->getNote()); if (m_midiThru) noteOn(ev->getNote()); event->accept(); } else if (event->type() == NoteOffEventType ) { NoteOffEvent *ev = static_cast<NoteOffEvent*>(event); ui.pianokeybd->showNoteOff(ev->getNote()); if (m_midiThru) noteOff(ev->getNote()); event->accept(); } else if (event->type() == ControllerEventType ) { ControllerEvent *ev = static_cast<ControllerEvent*>(event); updateController(ev->getController(), ev->getValue()); if (m_midiThru) sendController(ev->getController(), ev->getValue()); event->accept(); } }
void FluidSynthGui::changeChorusSpeed(int val) { sendController(0, FS_CHORUS_SPEED, val); }
void Polybase::sendStatus(){ DEBUG("Sending initial status"); emit sendController(0,volume*127); emit sendController(1,oscillatorForm[0]); emit sendController(2,oscillatorLevel[0]); emit sendController(3,oscillatorForm[1]); emit sendController(4,oscillatorLevel[1]); emit sendController(5,oscillatorForm[2]); emit sendController(6,oscillatorLevel[2]); emit sendController(7,oscillatorForm[3]); emit sendController(8,oscillatorLevel[3]); emit sendController(9,filter.tofreq/10.0); emit sendController(10,filter.q*64.0); emit sendController(11,filter.dist*64.0); }
void FluidSynthGui::changeReverbLevel(int val) { sendController(0, FS_REVERB_LEVEL, val); }
//--------------------------------------------------------- // changeGain //--------------------------------------------------------- void FluidSynthGui::changeGain(int value) { sendController(0, FS_GAIN, value); }
void VPiano::allNotesOff() { sendController(CTL_ALL_NOTES_OFF, 0); ui.pianokeybd->allKeysOff(); }
void FluidSynthGui::changeReverbRoomSize(int val) { sendController(0, FS_REVERB_ROOMSIZE, val); }
void FluidSynthGui::changeChorusType(int val) { sendController(0, FS_CHORUS_TYPE, val); }
void FluidSynthGui::changeChorusNumber(int val) { sendController(0, FS_CHORUS_NUM, val); }
void FluidSynthGui::toggleChorus(bool val) { sendController(0, FS_CHORUS_ON, val); }
void FluidSynthGui::changeReverbDamping(int val) { sendController(0, FS_REVERB_DAMPING, val); }
void FluidSynthGui::changeReverbWidth(int val) { sendController(0, FS_REVERB_WIDTH, val); }
void FluidSynthGui::changeChorusDepth(int val) { sendController(0, FS_CHORUS_DEPTH, val); }
void FluidSynthGui::changeChorusLevel(int val) { sendController(0, FS_CHORUS_LEVEL, val); }
bool Engine::eventCallback(MidiEvent inEv) { bool unmatched = true; bool no_collision = false; int l1; int tick = driver->getCurrentTick(); if (sendLogEvents) { logEventBuffer.replace(logEventCount, inEv); logTickBuffer.replace(logEventCount, tick); logEventCount++; } /* from here on we handle Note Off events as Note On / Vel 0 events */ if (inEv.type == EV_NOTEOFF) { inEv.type = EV_NOTEON; inEv.value = 0; } if (useMidiClock){ if (inEv.type == EV_START) { setStatus(true); return(false); } if (inEv.type == EV_STOP) { setStatus(false); return(false); } } if (midiLearnFlag && inEv.type == EV_NOTEON) { //input range midi learn if (midiLearnWindowID > 0) { if (midiLearnID == 10) { ((InOutBox *)moduleWindow(midiLearnModuleID)->widget()) ->indexIn[0]->setValue(inEv.data); } else if (midiLearnID == 11) { ((InOutBox *)moduleWindow(midiLearnModuleID)->widget()) ->indexIn[1]->setValue(inEv.data); } midiLearnFlag = false; } } for (l1 = 0; l1 < midiLfoCount(); l1++) { unmatched = midiLfo(l1)->handleEvent(inEv, tick); if (midiLfo(l1)->gotKbdTrig) { nextMinLfoTick = midiLfo(l1)->nextTick; no_collision = driver->requestEchoAt(nextMinLfoTick, true); if (!no_collision) midiLfo(l1)->gotKbdTrig = false; } } for (l1 = 0; l1 < midiSeqCount(); l1++) { unmatched = midiSeq(l1)->handleEvent(inEv, tick); if (midiSeq(l1)->gotKbdTrig) { nextMinSeqTick = midiSeq(l1)->nextTick; no_collision = driver->requestEchoAt(nextMinSeqTick, true); if (!no_collision) midiSeq(l1)->gotKbdTrig = false; } } for (l1 = 0; l1 < midiArpCount(); l1++) { /* In case transport is stopped we cause note off events * to remove the note from the buffer (ignoring the Release * time */ if (!status) { unmatched = midiArp(l1)->handleEvent(inEv, tick, 0); } else { unmatched = midiArp(l1)->handleEvent(inEv, tick, 1); } if (midiArp(l1)->gotKbdTrig) { nextMinArpTick = midiArp(l1)->nextTick; no_collision = driver->requestEchoAt(nextMinArpTick, true); if (!no_collision) midiArp(l1)->gotKbdTrig = false; } } if (inEv.type == EV_CONTROLLER) { if (midiControllable) { if (!midiLearnFlag) sendController(inEv.data, inEv.channel, inEv.value); else learnController(inEv.data, inEv.channel); unmatched = false; } } return unmatched; }
void FluidSynthGui::toggleReverb(bool on) { sendController(0, FS_REVERB_ON, on); }