From 74d4e83e5eaf2df9bd2b23fb2bc1067d3a941f2c Mon Sep 17 00:00:00 2001 From: Nil Geisweiller Date: Mon, 4 Dec 2006 15:37:25 +0000 Subject: see ChangeLog --- muse/ChangeLog | 6 + muse/awl/aslider.cpp | 43 +- muse/awl/aslider.h | 10 +- muse/awl/volslider.cpp | 33 +- muse/awl/volslider.h | 5 + muse/muse/plugingui.cpp | 2 +- muse/synti/deicsonze/TODO | 2 - muse/synti/deicsonze/deicsonze.cpp | 236 +++++----- muse/synti/deicsonze/deicsonze.h | 15 +- muse/synti/deicsonze/deicsonzegui.cpp | 22 + muse/synti/deicsonze/deicsonzegui.h | 1 + muse/synti/deicsonze/deicsonzegui.ui | 747 ++++++++++++++++++++++++++----- muse/synti/deicsonze/deicsonzeplugin.cpp | 71 +-- 13 files changed, 927 insertions(+), 266 deletions(-) diff --git a/muse/ChangeLog b/muse/ChangeLog index cfce1e38..dc332931 100644 --- a/muse/ChangeLog +++ b/muse/ChangeLog @@ -1,3 +1,9 @@ +04.12 (ng) + - fix deicsonze FX plugin bugs + - add AbstractSlider::setMinLogValue(), AbstractSlider::setMaxLogValue() + - modify AbstractSlider::value() so that it returns min instead of 0 + - and VolSlider::value() still returns 0 for min + - add reset Ctrl button in DeicsOnze 29.11 (ws) - shift+mouse wheel changes horizontal magnification while current position stays at cursor position diff --git a/muse/awl/aslider.cpp b/muse/awl/aslider.cpp index 3c5b1780..95151f18 100644 --- a/muse/awl/aslider.cpp +++ b/muse/awl/aslider.cpp @@ -191,8 +191,47 @@ void AbstractSlider::valueChange() double AbstractSlider::value() const { - return _log ? (_value <= _minValue) ? 0.0f : pow(10.0, _value*0.05f) - : _value; + return _log ? pow(10.0, _value*0.05f) : _value; } + + +//--------------------------------------------------------- +// minLogValue +//--------------------------------------------------------- + +//double AbstractSlider::minValue() const { +// return _log ? pow(10.0, _minValue*0.05f) : _minValue; +//} + +//--------------------------------------------------------- +// setMinLogValue +//--------------------------------------------------------- + +void AbstractSlider::setMinLogValue(double val) { + if (_log) { + if (val == 0.0f) _minValue = -100; + else _minValue = fast_log10(val) * 20.0f; + } + else _minValue = val; } +//--------------------------------------------------------- +// maxLogValue +//--------------------------------------------------------- + +//double AbstractSlider::maxValue() const { +// return _log ? pow(10.0, _maxValue*0.05f) : _maxValue; +//} + +//--------------------------------------------------------- +// setMaxLogValue +//--------------------------------------------------------- + +void AbstractSlider::setMaxLogValue(double val) { + if (_log) { + _maxValue = fast_log10(val) * 20.0f; + } + else _maxValue = val; +} + +} diff --git a/muse/awl/aslider.h b/muse/awl/aslider.h index 058114e3..6650aece 100644 --- a/muse/awl/aslider.h +++ b/muse/awl/aslider.h @@ -104,14 +104,20 @@ class AbstractSlider : public QWidget { virtual double value() const; - double minValue() const { return _minValue; } + double minValue() const { return _minValue; } void setMinValue(double v) { _minValue = v; } - double maxValue() const { return _maxValue; } + void setMinLogValue(double v); + double maxValue() const {return _maxValue; } void setMaxValue(double v) { _maxValue = v; } + void setMaxLogValue(double v); void setRange(double a, double b) { setMinValue(a); setMaxValue(b); } + void setLogRange(double a, double b) { + setMinLogValue(a); + setMaxLogValue(b); + } bool log() const { return _log; } void setLog(bool v) { _log = v; } double lineStep() const { return _lineStep; } diff --git a/muse/awl/volslider.cpp b/muse/awl/volslider.cpp index dc4eddac..59f1b8cf 100644 --- a/muse/awl/volslider.cpp +++ b/muse/awl/volslider.cpp @@ -50,5 +50,36 @@ void VolSlider::mouseDoubleClickEvent(QMouseEvent* ev) valueChange(); update(); } -} + +//--------------------------------------------------------- +// setValue +//--------------------------------------------------------- + +void VolSlider::setValue(double val) + { + if (_log) { + if (val == 0.0f) + _value = _minValue; + else { + _value = fast_log10(val) * 20.0f; + if (_value < _minValue) + _value = _minValue; + } + } + else + _value = val; + update(); + } + +//--------------------------------------------------------- +// value +//--------------------------------------------------------- + +double VolSlider::value() const + { + return _log ? (_value <= _minValue) ? 0.0f : pow(10.0, _value*0.05f) + : _value; + } + +} diff --git a/muse/awl/volslider.h b/muse/awl/volslider.h index cbea8ca9..22b4000f 100644 --- a/muse/awl/volslider.h +++ b/muse/awl/volslider.h @@ -42,8 +42,13 @@ class VolSlider : public Slider { protected: virtual void mouseDoubleClickEvent(QMouseEvent*); + public slots: + virtual void setValue(double v); + public: VolSlider(QWidget* parent = 0); + + virtual double value() const; }; } diff --git a/muse/muse/plugingui.cpp b/muse/muse/plugingui.cpp index 4b8ef920..9f0d1d32 100644 --- a/muse/muse/plugingui.cpp +++ b/muse/muse/plugingui.cpp @@ -475,7 +475,7 @@ printf("build gui from ui <%s>\n", path.toLatin1().data()); l->setText(p); grid->addWidget(l, i, 2); } - grid->addWidget(s, i, 3); + grid->addWidget(s, i, 3); connect(s, SIGNAL(valueChanged(double,int)), SLOT(setController(double,int))); connect(e, SIGNAL(valueChanged(double,int)), SLOT(setController(double,int))); } diff --git a/muse/synti/deicsonze/TODO b/muse/synti/deicsonze/TODO index 8583778f..34a75f67 100644 --- a/muse/synti/deicsonze/TODO +++ b/muse/synti/deicsonze/TODO @@ -12,5 +12,3 @@ - Pan per voices - Load BUMP preset - calibrate portamento and pitch envelope to fit real DX11 -- record plugin parameters with song -- fix bug plugin control change not working diff --git a/muse/synti/deicsonze/deicsonze.cpp b/muse/synti/deicsonze/deicsonze.cpp index 369a02a3..7ae25453 100644 --- a/muse/synti/deicsonze/deicsonze.cpp +++ b/muse/synti/deicsonze/deicsonze.cpp @@ -157,6 +157,12 @@ DeicsOnze::DeicsOnze() : Mess(2) { (const unsigned char*)dataMasterVol, 2); _gui->writeEvent(evSysexMasterVol); + //update font size + unsigned char *dataFontSize = new unsigned char[2]; + dataFontSize[0]=SYSEX_FONTSIZE; + dataFontSize[1]=(unsigned char)_global.fontSize; + MidiEvent evFontSize(0, ME_SYSEX, (const unsigned char*)dataFontSize, 2); + _gui->writeEvent(evFontSize); //display load preset unsigned char dataUpdateGuiSet[1]; dataUpdateGuiSet[0]=SYSEX_UPDATESETGUI; @@ -503,7 +509,7 @@ void DeicsOnze::initChannels() { void DeicsOnze::initChannel(int c) { _global.channel[c].isEnable = false; _global.channel[c].sustain = false; - _global.channel[c].volume = 200; + _global.channel[c].volume = DEFAULTVOL; _global.channel[c].pan = 0; _global.channel[c].modulation = 0; _global.channel[c].detune = 0; @@ -1427,7 +1433,8 @@ inline double pitch2freq(double p) { //--------------------------------------------------------- // lfoUpdate -// update the coefficent which multiplies the current inct in order to +// update the coefficent which multiplies the current inct +// in order to // get the right current frequency with respect to the lfo // update the coefficent which multiplies the amplitude. //--------------------------------------------------------- @@ -1563,8 +1570,7 @@ inline void pitchEnvelopeUpdate(Voice* v, PitchEg* pe, double sr) { if(v->pitchEnvState != OFF_PE) { switch(v->pitchEnvState) { case PHASE1 : - //printf("PHASE1 %f\n", v->pitchEnvCoefInctInct); - if( //to change to phase2 + if( //change to phase2 (v->pitchEnvCoefInctInct == 1.0) || (v->pitchEnvCoefInctInct > 1.0 && v->pitchEnvCoefInct > v->pitchEnvCoefInctPhase2) @@ -1579,8 +1585,7 @@ inline void pitchEnvelopeUpdate(Voice* v, PitchEg* pe, double sr) { else v->pitchEnvCoefInct *= v->pitchEnvCoefInctInct; break; case PHASE2 : - //printf("PHASE2\n"); - if( //to change to off (temporarely) + if( //change to off (temporarely) (v->pitchEnvCoefInctInct == 1.0) || (v->pitchEnvCoefInctInct > 1.0 && v->pitchEnvCoefInct > v->pitchEnvCoefInctPhase3) @@ -1594,7 +1599,7 @@ inline void pitchEnvelopeUpdate(Voice* v, PitchEg* pe, double sr) { else v->pitchEnvCoefInct *= v->pitchEnvCoefInctInct; break; case RELEASE_PE : - if( //to change to release2 + if( //change to release2 (v->pitchEnvCoefInctInct == 1.0) || (v->pitchEnvCoefInctInct > 1.0 && v->pitchEnvCoefInct > v->pitchEnvCoefInctPhase1) @@ -1723,67 +1728,55 @@ inline double coefAttack(unsigned char attack) { // sr is the sample rate and st the sine_table //--------------------------------------------------------- inline double env2AmpR(double sr, float* wt, Eg eg, OpVoice* p_opVoice) { - switch(p_opVoice->envState) - { - case ATTACK: - p_opVoice->envIndex+=p_opVoice->envInct; - if (p_opVoice->envIndex<(RESOLUTION/4)) - { - p_opVoice->envLevel=wt[(int)p_opVoice->envIndex]; - } - else - { - //printf("DECAY\n"); - p_opVoice->envState=DECAY; - p_opVoice->envLevel=1.0; - p_opVoice->coefVLevel=envD1R2coef(eg.d1r, sr); - } - return p_opVoice->envLevel; - break; - case DECAY: - if (p_opVoice->envLevel>((double)eg.d1l/(double)MAXD1L)+COEFERRDECSUS) - { - p_opVoice->envLevel*=p_opVoice->coefVLevel; - } - else - { - //printf("SUSTAIN\n"); - p_opVoice->envState=SUSTAIN; - p_opVoice->envLevel=((double)eg.d1l/(double)MAXD1L); - p_opVoice->coefVLevel=envD1R2coef(eg.d2r, sr);//probably the same - } - return p_opVoice->envLevel; - break; - case SUSTAIN: - if (p_opVoice->envLevel>COEFERRSUSREL) - { - p_opVoice->envLevel*=p_opVoice->coefVLevel; - } - else - { - //printf("OFF\n"); - p_opVoice->envState=OFF; - p_opVoice->envLevel=0.0; - } - return p_opVoice->envLevel; - break; - case RELEASE: - if (p_opVoice->envLevel > COEFERRSUSREL) - { + switch(p_opVoice->envState) { + case ATTACK: + p_opVoice->envIndex+=p_opVoice->envInct; + if (p_opVoice->envIndex<(RESOLUTION/4)) { + p_opVoice->envLevel=wt[(int)p_opVoice->envIndex]; + } + else { + p_opVoice->envState=DECAY; + p_opVoice->envLevel=1.0; + p_opVoice->coefVLevel=envD1R2coef(eg.d1r, sr); + } + return p_opVoice->envLevel; + break; + case DECAY: + if (p_opVoice->envLevel>((double)eg.d1l/(double)MAXD1L)+COEFERRDECSUS) { + p_opVoice->envLevel*=p_opVoice->coefVLevel; + } + else { + p_opVoice->envState=SUSTAIN; + p_opVoice->envLevel=((double)eg.d1l/(double)MAXD1L); + p_opVoice->coefVLevel=envD1R2coef(eg.d2r, sr);//probably the same + } + return p_opVoice->envLevel; + break; + case SUSTAIN: + if (p_opVoice->envLevel>COEFERRSUSREL) { + p_opVoice->envLevel*=p_opVoice->coefVLevel; + } + else { + p_opVoice->envState=OFF; + p_opVoice->envLevel=0.0; + } + return p_opVoice->envLevel; + break; + case RELEASE: + if (p_opVoice->envLevel > COEFERRSUSREL) { p_opVoice->envLevel*=p_opVoice->coefVLevel; - } - else - { - p_opVoice->envState=OFF; - p_opVoice->envLevel=0.0; - } - return p_opVoice->envLevel; - break; - case OFF: return 0.0; - break; - default: printf("Error case envelopeState"); - break; } + else { + p_opVoice->envState=OFF; + p_opVoice->envLevel=0.0; + } + return p_opVoice->envLevel; + break; + case OFF: return 0.0; + break; + default: printf("Error case envelopeState"); + break; + } return p_opVoice->envLevel; } @@ -2066,7 +2059,6 @@ void DeicsOnze::writeConfiguration(AL::Xml* xml) { xml->tag(EDITBACKGROUNDCOLORSTR, reinterpret_cast(*_gui->ebColor)); xml->tag(ISINITSETSTR, (_isInitSet?YESSTRDEI:NOSTRDEI)); - //printf("initSetPath : %s\n", _initSetPath.toAscii().data()); xml->tag(INITSETPATHSTR, _initSetPath.toAscii().data()); xml->tag(ISBACKGROUNDPIXSTR, (_isBackgroundPix?YESSTRDEI:NOSTRDEI)); xml->tag(BACKGROUNDPIXPATHSTR, _backgroundPixPath.toAscii().data()); @@ -2121,6 +2113,8 @@ void DeicsOnze::getInitData(int* length, const unsigned char** data) { (unsigned char) getChannelDetune(c) + MAXCHANNELDETUNE; buffer[NUM_CHANNEL_ATTACK + c] = (unsigned char) getChannelAttack(c); buffer[NUM_CHANNEL_RELEASE + c] = (unsigned char) getChannelRelease(c); + buffer[NUM_CHANNEL_REVERB + c] = (unsigned char) getChannelReverb(c); + buffer[NUM_CHANNEL_CHORUS + c] = (unsigned char) getChannelChorus(c); buffer[NUM_CURRENTPROG + c] = (unsigned char) _preset[c]->prog; buffer[NUM_CURRENTLBANK + c] = (unsigned char) _preset[c]->_subcategory->_lbank; @@ -2165,7 +2159,7 @@ void DeicsOnze::getInitData(int* length, const unsigned char** data) { strncpy((char*)&buffer[NUM_REVERB_LABEL], _pluginIReverb->plugin()->label().toLatin1().data(), MAXSTRLENGTHFXLABEL); - buffer[NUM_IS_CHORUS_ON]=(unsigned char)_global.isReverbActivated; + buffer[NUM_IS_CHORUS_ON]=(unsigned char)_global.isChorusActivated; buffer[NUM_CHORUS_RETURN]=(unsigned char)getChorusReturn(); buffer[NUM_CHORUS_PARAM_NBR]= (unsigned char)_pluginIChorus->plugin()->parameter(); @@ -2177,14 +2171,18 @@ void DeicsOnze::getInitData(int* length, const unsigned char** data) { MAXSTRLENGTHFXLABEL); //save FX parameters //reverb + printf("SAVE REVERB\n"); for(int i = 0; i < _pluginIReverb->plugin()->parameter(); i++) { - float val = (float)_pluginIReverb->param(i); - memcpy(&buffer[NUM_CONFIGLENGTH + i], &val, sizeof(float)); + float val = (float)getReverbParam(i); + memcpy(&buffer[NUM_CONFIGLENGTH + sizeof(float)*i], &val, sizeof(float)); } + //chorus + printf("SAVE CHORUS\n"); for(int i = 0; i < _pluginIChorus->plugin()->parameter(); i++) { - float val = (float)_pluginIChorus->param(i); - memcpy(&buffer[NUM_CONFIGLENGTH + _pluginIReverb->plugin()->parameter() - + i], &val, sizeof(float)); + float val = (float)getChorusParam(i); + memcpy(&buffer[NUM_CONFIGLENGTH + + sizeof(float)*_pluginIReverb->plugin()->parameter() + + sizeof(float)*i], &val, sizeof(float)); } //save set data for(int i = NUM_CONFIGLENGTH @@ -2196,8 +2194,6 @@ void DeicsOnze::getInitData(int* length, const unsigned char** data) { rmcmd+=comptmp; system(rmcmd.toAscii().data()); free(comptmp); - //printf("Taille en save : %d\n", *length); - //for(int i=0; i<*length; i++) printf("%x ", buffer[i]); *data=buffer; } //--------------------------------------------------------- @@ -2270,8 +2266,20 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { setChannelRelease(c, data[NUM_CHANNEL_RELEASE + c]); MidiEvent evChRelease(0, c, ME_CONTROLLER, - CTRL_RELEASE_TIME, data[NUM_CHANNEL_RELEASE + c]); + CTRL_RELEASE_TIME, data[NUM_CHANNEL_RELEASE + c]); _gui->writeEvent(evChRelease); + //channel reverb + setChannelReverb(c, data[NUM_CHANNEL_REVERB + c]); + MidiEvent + evChReverb(0, c, ME_CONTROLLER, + CTRL_REVERB_SEND, data[NUM_CHANNEL_REVERB + c]); + _gui->writeEvent(evChReverb); + //channel chorus + setChannelChorus(c, data[NUM_CHANNEL_CHORUS + c]); + MidiEvent + evChChorus(0, c, ME_CONTROLLER, + CTRL_CHORUS_SEND, data[NUM_CHANNEL_CHORUS + c]); + _gui->writeEvent(evChChorus); } //load configuration _saveConfig = (bool)data[NUM_SAVECONFIG]; @@ -2320,7 +2328,8 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { _gui->writeEvent(evIsInitSet); unsigned char dataInitSetPath[1+MAXSTRLENGTHINITSETPATH]; dataInitSetPath[0]=SYSEX_INITSETPATH; - dataInitSetPath[1]=data[NUM_INITSETPATH]; + for(int a = 0; a < MAXSTRLENGTHINITSETPATH; a++) + dataInitSetPath[a+1] = data[a+NUM_INITSETPATH]; MidiEvent evInitSetPath(0,ME_SYSEX,(const unsigned char*)dataInitSetPath, 1+MAXSTRLENGTHINITSETPATH); _gui->writeEvent(evInitSetPath); @@ -2344,13 +2353,24 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { //load FX //reverb _global.isReverbActivated = (bool)data[NUM_IS_REVERB_ON]; + unsigned char *dataReverbAct = new unsigned char[2]; + dataReverbAct[0]=SYSEX_REVERBACTIV; + dataReverbAct[1]=(unsigned char)_global.isReverbActivated; + MidiEvent evReverbAct(0,ME_SYSEX,(const unsigned char*)dataReverbAct, 2); + _gui->writeEvent(evReverbAct); setReverbReturn((int)data[NUM_REVERB_RETURN]); + unsigned char *dataReverbRet = new unsigned char[2]; + dataReverbRet[0]=SYSEX_REVERBRETURN; + dataReverbRet[1]=(unsigned char)getReverbReturn(); + MidiEvent evReverbRet(0,ME_SYSEX,(const unsigned char*)dataReverbRet, 2); + _gui->writeEvent(evReverbRet); initPluginReverb(plugins.find((const char*)&data[NUM_REVERB_LIB], (const char*)&data[NUM_REVERB_LABEL])); + printf("LOAD REVERB\n"); for(int i = 0; i < _pluginIReverb->plugin()->parameter(); i++) { float val; - memcpy(&val, &data[NUM_CONFIGLENGTH + i], sizeof(float)); - _pluginIReverb->setParam(i, (double)val); + memcpy(&val, &data[NUM_CONFIGLENGTH + sizeof(float)*i], sizeof(float)); + setReverbParam(i, (double)val); } char dataBuildRev; dataBuildRev = SYSEX_BUILDGUIREVERB; @@ -2359,15 +2379,26 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { _gui->writeEvent(evSysexBuildRev); //chorus _global.isChorusActivated = (bool)data[NUM_IS_CHORUS_ON]; + unsigned char *dataChorusAct = new unsigned char[2]; + dataChorusAct[0]=SYSEX_CHORUSACTIV; + dataChorusAct[1]=(unsigned char)_global.isChorusActivated; + MidiEvent evChorusAct(0,ME_SYSEX,(const unsigned char*)dataChorusAct, 2); + _gui->writeEvent(evChorusAct); setChorusReturn((int)data[NUM_CHORUS_RETURN]); + unsigned char *dataChorusRet = new unsigned char[2]; + dataChorusRet[0]=SYSEX_CHORUSRETURN; + dataChorusRet[1]=(unsigned char)getChorusReturn(); + MidiEvent evChorusRet(0,ME_SYSEX,(const unsigned char*)dataChorusRet, 2); + _gui->writeEvent(evChorusRet); initPluginChorus(plugins.find((const char*)&data[NUM_CHORUS_LIB], (const char*)&data[NUM_CHORUS_LABEL])); for(int i = 0; i < _pluginIChorus->plugin()->parameter(); i++) { float val; memcpy(&val, &data[NUM_CONFIGLENGTH + - _pluginIReverb->plugin()->parameter() + i], + sizeof(float)*_pluginIReverb->plugin()->parameter() + + sizeof(float)*i], sizeof(float)); - _pluginIChorus->setParam(i, (double)val); + setChorusParam(i, (double)val); } char dataBuildCho; dataBuildCho = SYSEX_BUILDGUICHORUS; @@ -2408,7 +2439,6 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { deicsonzeFile.close(); QDomNode node = domTree.documentElement(); - //printf("After XML\n"); while (!node.isNull()) { QDomElement e = node.toElement(); if (e.isNull()) @@ -2563,8 +2593,7 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { case SYSEX_CHORUSPARAM: index = (int)data[1]; memcpy(&f, &data[2], sizeof(float)); - printf("Chorus, param %d, value %f\n", index, f); - _pluginIChorus->setParam(index, (double)f); + setChorusParam(index, (double)f); if(!fromGui) { MidiEvent evSysex(0, ME_SYSEX, data, length); _gui->writeEvent(evSysex); @@ -2580,9 +2609,7 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { case SYSEX_REVERBPARAM: index = (int)data[1]; memcpy(&f, &data[2], sizeof(float)); - printf("Reverb, param %d, value %f\n", index, f); - _pluginIReverb->setParam(index, (double)f); - printf("param value %f\n", _pluginIReverb->param(index)); + setReverbParam(index, (double)f); if(!fromGui) { MidiEvent evSysex(0, ME_SYSEX, data, length); _gui->writeEvent(evSysex); @@ -3545,10 +3572,10 @@ void DeicsOnze::process(float** buffer, int offset, int n) { if(_global.qualityCounter == 0) { tempLeftOutput = 0.0; tempRightOutput = 0.0; - tempInputChorus[0][i] = 0.0; - tempInputChorus[1][i] = 0.0; - tempInputReverb[0][i] = 0.0; - tempInputReverb[1][i] = 0.0; + _global.lastInputLeftChorusSample = 0.0; + _global.lastInputRightChorusSample = 0.0; + _global.lastInputLeftReverbSample = 0.0; + _global.lastInputRightReverbSample = 0.0; //per channel for(int c = 0; c < NBRCHANNELS; c++) { tempChannelOutput = 0.0; @@ -3800,27 +3827,36 @@ void DeicsOnze::process(float** buffer, int offset, int n) { tempChannelRightOutput=tempChannelOutput*_global.channel[c].ampRight; if(_global.isChorusActivated) { - tempInputChorus[0][i] += tempChannelLeftOutput * + _global.lastInputLeftChorusSample += tempChannelLeftOutput * _global.channel[c].chorusAmount; - tempInputChorus[1][i] += tempChannelRightOutput * + _global.lastInputRightChorusSample += tempChannelRightOutput * _global.channel[c].chorusAmount; } if(_global.isReverbActivated) { - tempInputReverb[0][i] += tempChannelLeftOutput * + _global.lastInputLeftReverbSample += tempChannelLeftOutput * _global.channel[c].reverbAmount; - tempInputReverb[0][i] += tempChannelRightOutput * + _global.lastInputRightReverbSample += tempChannelRightOutput * _global.channel[c].reverbAmount; } tempLeftOutput += tempChannelLeftOutput; tempRightOutput += tempChannelRightOutput; } } - _global.lastLeftSample = tempLeftOutput; - _global.lastRightSample = tempRightOutput; + _global.lastLeftSample = tempLeftOutput * _global.masterVolume; + _global.lastRightSample = tempRightOutput * _global.masterVolume; } - leftOutput[i] += _global.lastLeftSample * _global.masterVolume; - rightOutput[i] += _global.lastRightSample * _global.masterVolume; - + leftOutput[i] += _global.lastLeftSample; + rightOutput[i] += _global.lastRightSample; + + if(_global.isChorusActivated) { + tempInputChorus[0][i] = _global.lastInputLeftChorusSample; + tempInputChorus[1][i] = _global.lastInputRightChorusSample; + } + if(_global.isReverbActivated) { + tempInputReverb[0][i] = _global.lastInputLeftReverbSample; + tempInputReverb[1][i] = _global.lastInputRightReverbSample; + } + _global.qualityCounter++; _global.qualityCounter %= _global.qualityCounterTop; } diff --git a/muse/synti/deicsonze/deicsonze.h b/muse/synti/deicsonze/deicsonze.h index 1075a05b..646eb930 100644 --- a/muse/synti/deicsonze/deicsonze.h +++ b/muse/synti/deicsonze/deicsonze.h @@ -147,6 +147,8 @@ #define SYSEX_BUILDGUICHORUS 85 //REVERB PARAMETERS +#define DEFAULTVOL 200 + enum { NUM_MASTERVOL = SAVEINITLENGTH, NUM_CHANNEL_ENABLE, @@ -157,7 +159,9 @@ enum { NUM_CHANNEL_DETUNE = NUM_CHANNEL_MODULATION + NBRCHANNELS + 1, NUM_CHANNEL_ATTACK = NUM_CHANNEL_DETUNE + NBRCHANNELS + 1, NUM_CHANNEL_RELEASE = NUM_CHANNEL_ATTACK + NBRCHANNELS + 1, - NUM_CURRENTPROG = NUM_CHANNEL_RELEASE + NBRCHANNELS + 1, + NUM_CHANNEL_REVERB = NUM_CHANNEL_RELEASE + NBRCHANNELS + 1, + NUM_CHANNEL_CHORUS = NUM_CHANNEL_REVERB + NBRCHANNELS + 1, + NUM_CURRENTPROG = NUM_CHANNEL_CHORUS + NBRCHANNELS + 1, NUM_CURRENTLBANK = NUM_CURRENTPROG + NBRCHANNELS + 1, NUM_CURRENTHBANK = NUM_CURRENTLBANK + NBRCHANNELS + 1, NUM_NBRVOICES = NUM_CURRENTHBANK + NBRCHANNELS + 1, @@ -358,6 +362,10 @@ struct Global { int fontSize; float lastLeftSample; float lastRightSample; + float lastInputLeftChorusSample; + float lastInputRightChorusSample; + float lastInputLeftReverbSample; + float lastInputRightReverbSample; Channel channel[NBRCHANNELS]; bool isChorusActivated; float chorusReturn; @@ -407,6 +415,11 @@ class DeicsOnze : public Mess { void initPluginReverb(Plugin*); void initPluginChorus(Plugin*); + void setReverbParam(int i, double val); + void setChorusParam(int i, double val); + double getReverbParam(int i); + double getChorusParam(int i); + mutable MidiPatch _patch; int _numPatch; //what is this? TODO diff --git a/muse/synti/deicsonze/deicsonzegui.cpp b/muse/synti/deicsonze/deicsonzegui.cpp index ad2508d5..0abafb4c 100644 --- a/muse/synti/deicsonze/deicsonzegui.cpp +++ b/muse/synti/deicsonze/deicsonzegui.cpp @@ -74,6 +74,8 @@ DeicsOnzeGui::DeicsOnzeGui(DeicsOnze* deicsOnze) this, SLOT(setMasterVolKnob(double))); //Panic connect(panicButton, SIGNAL(pressed()), this, SLOT(setPanic())); + //reset Ctrls + connect(resCtrlButton, SIGNAL(pressed()), this, SLOT(setResCtrl())); //FX connect(chorusActivCheckBox, SIGNAL(toggled(bool)), this, SLOT(setChorusActiv(bool))); @@ -443,6 +445,24 @@ void DeicsOnzeGui::setPanic() { sendSysex(message, 1); } +//----------------------------------------------------------- +// setResCtrl +//----------------------------------------------------------- +void DeicsOnzeGui::setResCtrl() { + //Detune + updateChannelDetune(0); + sendController(_currentChannel, CTRL_CHANNELDETUNE, 0); + //Brightness + updateBrightness(MIDFINEBRIGHTNESS); + sendController(_currentChannel, CTRL_FINEBRIGHTNESS, MIDFINEBRIGHTNESS); + //Attack + updateAttack(MIDATTACK); + sendController(_currentChannel, CTRL_ATTACK_TIME, MIDATTACK); + //Release + updateRelease(MIDRELEASE); + sendController(_currentChannel, CTRL_RELEASE_TIME, MIDRELEASE); +} + //----------------------------------------------------------- // setNbrVoices //----------------------------------------------------------- @@ -771,7 +791,9 @@ void DeicsOnzeGui::setTextColor(const QColor & c) { selectLadspaChorusGroupBox->setPalette(p); channelChorusGroupBox->setPalette(p); parametersChorusGroupBox->setPalette(p); + fontSizeGroupBox->setPalette(p); } + void DeicsOnzeGui::setBackgroundColor(const QColor & c) { if(imageCheckBox->checkState()==Qt::Unchecked) { QPalette p = this->palette(); diff --git a/muse/synti/deicsonze/deicsonzegui.h b/muse/synti/deicsonze/deicsonzegui.h index 44f04da9..b3f5eeb0 100644 --- a/muse/synti/deicsonze/deicsonzegui.h +++ b/muse/synti/deicsonze/deicsonzegui.h @@ -137,6 +137,7 @@ class DeicsOnzeGui : public QDialog, public Ui::DeicsOnzeGuiBase, public MessGui void setEnabledChannel(bool); void setChangeChannel(int); void setPanic(); + void setResCtrl(); void setNbrVoices(int); void setSaveOnlyUsed(bool); void setSaveOnlyUsedComp(bool); diff --git a/muse/synti/deicsonze/deicsonzegui.ui b/muse/synti/deicsonze/deicsonzegui.ui index fd3784b8..7f350d30 100644 --- a/muse/synti/deicsonze/deicsonzegui.ui +++ b/muse/synti/deicsonze/deicsonzegui.ui @@ -26,7 +26,503 @@ 6 - + + + + + 1000 + 20 + + + + + + + + + 0 + 0 + 0 + + + + + + + 207 + 207 + 207 + + + + + + + 237 + 237 + 237 + + + + + + + 231 + 231 + 231 + + + + + + + 121 + 125 + 121 + + + + + + + 166 + 166 + 166 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 207 + 207 + 207 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + 0 + 0 + 0 + + + + + + + 207 + 207 + 207 + + + + + + + 237 + 237 + 237 + + + + + + + 231 + 231 + 231 + + + + + + + 121 + 125 + 121 + + + + + + + 166 + 166 + 166 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 207 + 207 + 207 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + 121 + 125 + 121 + + + + + + + 207 + 207 + 207 + + + + + + + 237 + 237 + 237 + + + + + + + 231 + 231 + 231 + + + + + + + 121 + 125 + 121 + + + + + + + 166 + 166 + 166 + + + + + + + 121 + 125 + 121 + + + + + + + 255 + 255 + 255 + + + + + + + 121 + 125 + 121 + + + + + + + 207 + 207 + 207 + + + + + + + 207 + 207 + 207 + + + + + + + 0 + 0 + 0 + + + + + + + 121 + 125 + 121 + + + + + + + 207 + 207 + 207 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + Sans Serif + 10 + 75 + false + true + false + false + + + + Set Brightness, Detune, Attack and Release of the current channel to default + + + Res. Ctrl + + + + @@ -5679,133 +6175,12 @@ Wave form 8 = <i>if <b>t</b>&#060 pi then sin(2*<b>t</b>)*sin - - - - - 40 - 40 - - - - 0.000000000000000 - - - 0.000000000000000 - - - 1.000000000000000 - - - 0.100000000000000 - - - 0.200000000000000 - - - false - - - - - - - QFrame::StyledPanel - - - Vol - - - Qt::AlignCenter - - - - - - - - - - - 9 - - - 6 - - - - - true - - - Number of Voices - - - 64 - - - 1 - - - 8 - - - - - - - QFrame::StyledPanel - - - Number of voices - - - Qt::AlignCenter - - - - - - - Enable - - - true - - - - - - - 16 - - - 1 - - - - - - - QFrame::StyledPanel - - - Channel - - - Qt::AlignCenter - - - - - - 1000 - 1000 + 20 @@ -6288,12 +6663,15 @@ Wave form 8 = <i>if <b>t</b>&#060 pi then sin(2*<b>t</b>)*sin false + + Cut all notes off + Panic! - + @@ -6520,6 +6898,127 @@ Wave form 8 = <i>if <b>t</b>&#060 pi then sin(2*<b>t</b>)*sin + + + + + + + + 9 + + + 6 + + + + + true + + + Number of Voices + + + 64 + + + 1 + + + 8 + + + + + + + QFrame::StyledPanel + + + Number of voices + + + Qt::AlignCenter + + + + + + + Enable + + + true + + + + + + + 16 + + + 1 + + + + + + + QFrame::StyledPanel + + + Channel + + + Qt::AlignCenter + + + + + + + + + + QFrame::StyledPanel + + + Vol + + + Qt::AlignCenter + + + + + + + + 40 + 40 + + + + -9.591195299377981 + + + 0.000000000000000 + + + 1.000000000000000 + + + 0.100000000000000 + + + 0.200000000000000 + + + false + + + diff --git a/muse/synti/deicsonze/deicsonzeplugin.cpp b/muse/synti/deicsonze/deicsonzeplugin.cpp index 196777fa..e8a453fe 100644 --- a/muse/synti/deicsonze/deicsonzeplugin.cpp +++ b/muse/synti/deicsonze/deicsonzeplugin.cpp @@ -55,6 +55,7 @@ void DeicsOnze::initPluginReverb(Plugin* pluginReverb) { Ctrl* c = new Ctrl(); c->setCurVal((float)pluginReverb->defaultValue(i)); _pluginIReverb->setControllerList(c); + //setReverbParam(i, pluginReverb->defaultValue(i)); } //send build gui to the gui @@ -74,7 +75,8 @@ void DeicsOnze::initPluginChorus(Plugin* pluginChorus) { Ctrl* c = new Ctrl(); c->setCurVal((float)pluginChorus->defaultValue(i)); _pluginIChorus->setControllerList(c); - } + //setChorusParam(i, pluginChorus->defaultValue(i)); +} //send build gui to the gui char data; @@ -83,6 +85,29 @@ void DeicsOnze::initPluginChorus(Plugin* pluginChorus) { _gui->writeEvent(evSysex); } +void DeicsOnze::setReverbParam(int index, double val) { + printf("SET REVERB PARAM index = %d, val = %f\n", index, val); + _pluginIReverb->controller(index)->setCurVal((float)val); + getReverbParam(index); +} +void DeicsOnze::setChorusParam(int index, double val) { + printf("SET CHORUS PARAM index = %d, val = %f\n", index, val); + _pluginIChorus->controller(index)->setCurVal((float)val); + getChorusParam(index); +} + +double DeicsOnze::getReverbParam(int index) { + printf("GET REVERB PARAM index = %d, val = %f\n", + index, _pluginIReverb->controller(index)->curVal().f); + return _pluginIReverb->controller(index)->curVal().f; +} + +double DeicsOnze::getChorusParam(int index) { + printf("GET CHORUS PARAM index = %d, val = %f\n", + index, _pluginIChorus->controller(index)->curVal().f); + return _pluginIChorus->controller(index)->curVal().f; +} + void DeicsOnzeGui::addPluginCheckBox(int index, QString text, bool toggled, QWidget* parent, QGridLayout* grid, bool isReverb) { @@ -134,10 +159,10 @@ void DeicsOnzeGui::addPluginSlider(int index, QString text, bool isLog, Slider* s = new Slider(parent); s->setId(index); s->setLog(isLog); + s->setLogRange(min, max); s->setValue(val); s->setOrientation(Qt::Horizontal); //s->setFixedHeight(h); - s->setRange(min, max); s->setLineStep((min-max)/100.0); s->setPageStep((min-max)/10.0); grid->addWidget(s, index, 2); @@ -168,6 +193,7 @@ void DeicsOnzeGui::addPluginSlider(int index, QString text, bool isLog, } void DeicsOnzeGui::buildGuiReverb() { + printf("BUILD\n"); PluginI* plugI = _deicsOnze->_pluginIReverb; QString name = plugI->name(); name.resize(name.size()-2); @@ -181,10 +207,6 @@ void DeicsOnzeGui::buildGuiReverb() { if(_reverbSuperWidget) delete(_reverbSuperWidget); _reverbSuperWidget = new QWidget(parametersReverbGroupBox); superLayout->addWidget(_reverbSuperWidget); - //build scroll area - //QScrollArea* scrollArea = new QScrollArea; - //scrollArea->setBackgroundRole(QPalette::Dark); - //scrollArea->setWidget(_reverbSuperWidget); //build grid QGridLayout* grid = new QGridLayout(_reverbSuperWidget); _reverbSuperWidget->setLayout(grid); @@ -197,26 +219,18 @@ void DeicsOnzeGui::buildGuiReverb() { for(int i = 0; i < plugI->plugin()->parameter(); i++) { double min, max, val; plugI->range(i, &min, &max); - val = plugI->param(i); + val = _deicsOnze->getReverbParam(i); + printf("BUILD REVERB %d, %f\n", i, val); if(plugI->isBool(i)) addPluginCheckBox(i, plugI->getParameterName(i), val > 0.0, _reverbSuperWidget, grid, true); else if(plugI->isInt(i)) { addPluginIntSlider(i, plugI->getParameterName(i), rint(min), rint(max), - rint(val), _reverbSuperWidget, grid, - true); + rint(val), _reverbSuperWidget, grid, true); } else { - if(plugI->isLog(i)) { - if (min == 0.0) min = 0.001; - min = fast_log10(min)*20.0; - max = fast_log10(max)*20.0; - if (val == 0.0f) val = min; - else val = fast_log10(val) * 20.0; - } addPluginSlider(i, plugI->getParameterName(i), plugI->isLog(i), - min, max, plugI->param(i), _reverbSuperWidget, grid, - true); + min, max, val, _reverbSuperWidget, grid, true); } } //update colors of the new sliders (and the whole gui actually) @@ -250,26 +264,17 @@ void DeicsOnzeGui::buildGuiChorus() { for(int i = 0; i < plugI->plugin()->parameter(); i++) { double min, max, val; plugI->range(i, &min, &max); - val = plugI->param(i); + val = _deicsOnze->getChorusParam(i); if(plugI->isBool(i)) addPluginCheckBox(i, plugI->getParameterName(i), val > 0.0, _chorusSuperWidget, grid, false); else if(plugI->isInt(i)) { addPluginIntSlider(i, plugI->getParameterName(i), rint(min), rint(max), - rint(val), _chorusSuperWidget, grid, - false); + rint(val), _chorusSuperWidget, grid, false); } else { - if(plugI->isLog(i)) { - if (min == 0.0) min = 0.001; - min = fast_log10(min)*20.0; - max = fast_log10(max)*20.0; - if (val == 0.0f) val = min; - else val = fast_log10(val) * 20.0; - } addPluginSlider(i, plugI->getParameterName(i), plugI->isLog(i), - min, max, plugI->param(i), _chorusSuperWidget, grid, - false); + min, max, val, _chorusSuperWidget, grid, false); } } //update colors of the new sliders (and the whole gui actually) @@ -353,9 +358,9 @@ void DeicsOnzeGui::updateReverbFloatEntry(double v, int i) { void DeicsOnzeGui::updateChorusSlider(double v, int i) { printf("updateChorusSlider(%f, %i)\n", v, i); if(i < (int)_reverbSliderVector.size() && _reverbSliderVector[i]) { - _reverbSliderVector[i]->blockSignals(true); - _reverbSliderVector[i]->setValue(v); - _reverbSliderVector[i]->blockSignals(false); + _chorusSliderVector[i]->blockSignals(true); + _chorusSliderVector[i]->setValue(v); + _chorusSliderVector[i]->blockSignals(false); } } void DeicsOnzeGui::updateChorusFloatEntry(double v, int i) { -- cgit v1.2.3