| @@ -1071,8 +1071,9 @@ static rtosc::Ports middlewareReplyPorts = { | |||
| rEnd}, | |||
| {"setprogram:cc:ii", 0, 0, | |||
| rBegin; | |||
| Bank &bank = impl.master->bank; | |||
| const int part = rtosc_argument(msg, 0).i; | |||
| const int program = rtosc_argument(msg, 1).i; | |||
| const int program = rtosc_argument(msg, 1).i + 128*bank.bank_lsb; | |||
| impl.loadPart(part, impl.master->bank.ins[program].filename.c_str(), impl.master); | |||
| impl.uToB->write(("/part"+to_s(part)+"/Pname").c_str(), "s", impl.master->bank.ins[program].name.c_str()); | |||
| rEnd}, | |||
| @@ -93,6 +93,8 @@ static const Ports voicePorts = { | |||
| //Freq Stuff | |||
| rToggle(Pfixedfreq, "If frequency is fixed"), | |||
| rParamZyn(PfixedfreqET, "Equal Tempermant Parameter"), | |||
| rParamZyn(PBendAdjust, "Pitch bend adjustment"), | |||
| rParamZyn(POffsetHz, "Voice constant offset"), | |||
| rParamI(PDetune, "Fine Detune"), | |||
| rParamI(PCoarseDetune, "Coarse Detune"), | |||
| rParamZyn(PDetuneType, "Magnitude of Detune"), | |||
| @@ -125,6 +127,7 @@ static const Ports voicePorts = { | |||
| rParamI(PFMDetune, "Modulator Fine Detune"), | |||
| rParamI(PFMCoarseDetune, "Modulator Coarse Detune"), | |||
| rParamZyn(PFMDetuneType, "Modulator Detune Magnitude"), | |||
| rToggle(PFMFixedFreq, "Modulator Frequency Fixed"), | |||
| rToggle(PFMFreqEnvelopeEnabled, "Modulator Frequency Envelope"), | |||
| rToggle(PFMAmpEnvelopeEnabled, "Modulator Amplitude Envelope"), | |||
| @@ -256,7 +259,7 @@ static const Ports globalPorts = { | |||
| //Resonance | |||
| rParamZyn(Hrandgrouping, "How randomness is applied to multiple voices using the same oscil"), | |||
| rToggle(Hrandgrouping, "How randomness is applied to multiple voices using the same oscil"), | |||
| //weird stuff for PCoarseDetune | |||
| {"detunevalue:", rMap(unit,cents) rDoc("Get detune in cents"), NULL, | |||
| @@ -409,6 +412,8 @@ void ADnoteVoiceParam::defaults() | |||
| Type = 0; | |||
| Pfixedfreq = 0; | |||
| PfixedfreqET = 0; | |||
| PBendAdjust = 88; // 64 + 24 | |||
| POffsetHz = 64; | |||
| Presonance = 1; | |||
| Pfilterbypass = 0; | |||
| Pextoscil = -1; | |||
| @@ -433,6 +438,7 @@ void ADnoteVoiceParam::defaults() | |||
| PFilterVelocityScale = 0; | |||
| PFilterVelocityScaleFunction = 64; | |||
| PFMEnabled = 0; | |||
| PFMFixedFreq = false; | |||
| //I use the internal oscillator (-1) | |||
| PFMVoice = -1; | |||
| @@ -646,6 +652,8 @@ void ADnoteVoiceParam::add2XML(XMLwrapper& xml, bool fmoscilused) | |||
| xml.beginbranch("FREQUENCY_PARAMETERS"); | |||
| xml.addparbool("fixed_freq", Pfixedfreq); | |||
| xml.addpar("fixed_freq_et", PfixedfreqET); | |||
| xml.addpar("bend_adjust", PBendAdjust); | |||
| xml.addpar("offset_hz", POffsetHz); | |||
| xml.addpar("detune", PDetune); | |||
| xml.addpar("coarse_detune", PCoarseDetune); | |||
| xml.addpar("detune_type", PDetuneType); | |||
| @@ -716,6 +724,7 @@ void ADnoteVoiceParam::add2XML(XMLwrapper& xml, bool fmoscilused) | |||
| xml.addparbool("freq_envelope_enabled", | |||
| PFMFreqEnvelopeEnabled); | |||
| xml.addparbool("fixed_freq", PFMFixedFreq); | |||
| if((PFMFreqEnvelopeEnabled != 0) || (!xml.minimal)) { | |||
| xml.beginbranch("FREQUENCY_ENVELOPE"); | |||
| FMFreqEnvelope->add2XML(xml); | |||
| @@ -944,6 +953,7 @@ void ADnoteVoiceParam::paste(ADnoteVoiceParam &a) | |||
| copy(PFilterEnabled); | |||
| copy(Pfilterbypass); | |||
| copy(PFMEnabled); | |||
| copy(PFMFixedFreq); | |||
| RCopy(OscilSmp); | |||
| @@ -965,6 +975,8 @@ void ADnoteVoiceParam::paste(ADnoteVoiceParam &a) | |||
| copy(PDetune); | |||
| copy(PCoarseDetune); | |||
| copy(PDetuneType); | |||
| copy(PBendAdjust); | |||
| copy(POffsetHz); | |||
| copy(PFreqEnvelopeEnabled); | |||
| RCopy(FreqEnvelope); | |||
| @@ -1102,6 +1114,8 @@ void ADnoteVoiceParam::getfromXML(XMLwrapper& xml, unsigned nvoice) | |||
| if(xml.enterbranch("FREQUENCY_PARAMETERS")) { | |||
| Pfixedfreq = xml.getparbool("fixed_freq", Pfixedfreq); | |||
| PfixedfreqET = xml.getpar127("fixed_freq_et", PfixedfreqET); | |||
| PBendAdjust = xml.getpar127("bend_adjust", PBendAdjust); | |||
| POffsetHz = xml.getpar127("offset_hz", POffsetHz); | |||
| PDetune = xml.getpar("detune", PDetune, 0, 16383); | |||
| PCoarseDetune = xml.getpar("coarse_detune", PCoarseDetune, 0, 16383); | |||
| PDetuneType = xml.getpar127("detune_type", PDetuneType); | |||
| @@ -1173,6 +1187,8 @@ void ADnoteVoiceParam::getfromXML(XMLwrapper& xml, unsigned nvoice) | |||
| PFMFreqEnvelopeEnabled = xml.getparbool("freq_envelope_enabled", | |||
| PFMFreqEnvelopeEnabled); | |||
| PFMFixedFreq = xml.getparbool("fixed_freq", | |||
| PFMFixedFreq); | |||
| if(xml.enterbranch("FREQUENCY_ENVELOPE")) { | |||
| FMFreqEnvelope->getfromXML(xml); | |||
| xml.exitbranch(); | |||
| @@ -27,7 +27,7 @@ | |||
| #include "PresetsArray.h" | |||
| enum FMTYPE { | |||
| NONE, MORPH, RING_MOD, PHASE_MOD, FREQ_MOD, PITCH_MOD | |||
| NONE, MORPH, RING_MOD, PHASE_MOD, FREQ_MOD, PW_MOD | |||
| }; | |||
| /*****************************************************************/ | |||
| @@ -189,6 +189,12 @@ struct ADnoteVoiceParam { | |||
| /** Detune type */ | |||
| unsigned char PDetuneType; | |||
| /** Pitch bend adjustment */ | |||
| unsigned char PBendAdjust; | |||
| /** Pitch offset Hz */ | |||
| unsigned char POffsetHz; | |||
| /* Frequency Envelope */ | |||
| unsigned char PFreqEnvelopeEnabled; | |||
| EnvelopeParams *FreqEnvelope; | |||
| @@ -283,6 +289,9 @@ struct ADnoteVoiceParam { | |||
| /* The detune type */ | |||
| unsigned char PFMDetuneType; | |||
| /* FM base freq fixed at 440Hz */ | |||
| unsigned char PFMFixedFreq; | |||
| /* Frequency Envelope of the Modullator */ | |||
| unsigned char PFMFreqEnvelopeEnabled; | |||
| EnvelopeParams *FMFreqEnvelope; | |||
| @@ -39,7 +39,7 @@ const rtosc::Ports Controller::ports = { | |||
| rToggle(bandwidth.exponential, "Bandwidth Exponential Mode"), | |||
| rParamZyn(modwheel.depth, "Depth of Modwheel MIDI Control"), | |||
| rToggle(modwheel.exponential, "Modwheel Exponential Mode"), | |||
| rToggle(pitchwheel.is_split, "If PitchWheel Has unified blendrange or not"), | |||
| rToggle(pitchwheel.is_split, "If PitchWheel Has unified bendrange or not"), | |||
| rParamI(pitchwheel.bendrange, "Range of MIDI Pitch Wheel"), | |||
| rParamI(pitchwheel.bendrange_down, "Lower Range of MIDI Pitch Wheel"), | |||
| rToggle(expression.receive, "Expression MIDI Receive"), | |||
| @@ -35,6 +35,7 @@ class XMLwrapper; | |||
| #define LFO_RAMPDOWN 4 | |||
| #define LFO_EXP_DOWN1 5 | |||
| #define LFO_EXP_DOWN2 6 | |||
| #define LFO_RANDOM 7 | |||
| class LFOParams:public Presets | |||
| { | |||
| @@ -66,7 +66,8 @@ static const rtosc::Ports realtime_ports = | |||
| //Freq | |||
| rToggle(Pfixedfreq, "Base frequency fixed frequency enable"), | |||
| rParamZyn(PfixedfreqET, "Equal temeperate control for fixed frequency operation"), | |||
| rParamZyn(PBendAdjust, "Pitch bend adjustment"), | |||
| rParamZyn(POffsetHz, "Voice constant offset"), | |||
| rParamI(PDetune, "Fine Detune"), | |||
| rParamI(PCoarseDetune, "Coarse Detune"), | |||
| rParamZyn(PDetuneType, "Magnitude of Detune"), | |||
| @@ -233,6 +234,8 @@ static const rtosc::Ports non_realtime_ports = | |||
| d.reply(d.loc, "b", n*sizeof(float), tmp); | |||
| d.reply(d.loc, "i", realbw); | |||
| delete[] tmp;}}, | |||
| {"needPrepare:", rDoc("Unimplemented Stub"), | |||
| NULL, [](const char *, rtosc::RtData&) {}}, | |||
| }; | |||
| const rtosc::Ports &PADnoteParameters::non_realtime_ports = ::non_realtime_ports; | |||
| @@ -327,6 +330,8 @@ void PADnoteParameters::defaults() | |||
| /* Frequency Global Parameters */ | |||
| Pfixedfreq = 0; | |||
| PfixedfreqET = 0; | |||
| PBendAdjust = 88; // 64 + 24 | |||
| POffsetHz = 64; | |||
| PDetune = 8192; //zero | |||
| PCoarseDetune = 0; | |||
| PDetuneType = 1; | |||
| @@ -984,6 +989,8 @@ void PADnoteParameters::add2XML(XMLwrapper& xml) | |||
| xml.beginbranch("FREQUENCY_PARAMETERS"); | |||
| xml.addpar("fixed_freq", Pfixedfreq); | |||
| xml.addpar("fixed_freq_et", PfixedfreqET); | |||
| xml.addpar("bend_adjust", PBendAdjust); | |||
| xml.addpar("offset_hz", POffsetHz); | |||
| xml.addpar("detune", PDetune); | |||
| xml.addpar("coarse_detune", PCoarseDetune); | |||
| xml.addpar("detune_type", PDetuneType); | |||
| @@ -1098,6 +1105,8 @@ void PADnoteParameters::getfromXML(XMLwrapper& xml) | |||
| if(xml.enterbranch("FREQUENCY_PARAMETERS")) { | |||
| Pfixedfreq = xml.getpar127("fixed_freq", Pfixedfreq); | |||
| PfixedfreqET = xml.getpar127("fixed_freq_et", PfixedfreqET); | |||
| PBendAdjust = xml.getpar127("bend_adjust", PBendAdjust); | |||
| POffsetHz = xml.getpar127("offset_hz", POffsetHz); | |||
| PDetune = xml.getpar("detune", PDetune, 0, 16383); | |||
| PCoarseDetune = xml.getpar("coarse_detune", PCoarseDetune, 0, 16383); | |||
| PDetuneType = xml.getpar127("detune_type", PDetuneType); | |||
| @@ -1176,6 +1185,8 @@ void PADnoteParameters::pasteRT(PADnoteParameters &x) | |||
| COPY(Pfixedfreq); | |||
| COPY(PfixedfreqET); | |||
| COPY(PBendAdjust); | |||
| COPY(POffsetHz); | |||
| COPY(PDetune); | |||
| COPY(PCoarseDetune); | |||
| COPY(PDetuneType); | |||
| @@ -106,6 +106,8 @@ class PADnoteParameters:public Presets | |||
| If this parameter is 0, the frequency is fixed (to 440 Hz); | |||
| if this parameter is 64, 1 MIDI halftone -> 1 frequency halftone */ | |||
| unsigned char PfixedfreqET; | |||
| unsigned char PBendAdjust; | |||
| unsigned char POffsetHz; | |||
| unsigned short int PDetune; //fine detune | |||
| unsigned short int PCoarseDetune; //coarse detune+octave | |||
| unsigned char PDetuneType; //detune type | |||
| @@ -53,6 +53,8 @@ static const rtosc::Ports SUBnotePorts = { | |||
| //rToggle(),//continue | |||
| rToggle(Pfixedfreq, "Base frequency fixed frequency enable"), | |||
| rParamZyn(PfixedfreqET, "Equal temeperate control for fixed frequency operation"), | |||
| rParamZyn(PBendAdjust, "Pitch bend adjustment"), | |||
| rParamZyn(POffsetHz, "Voice constant offset"), | |||
| #undef rChangeCb | |||
| #define rChangeCb obj->updateFrequencyMultipliers(); | |||
| rParamI(POvertoneSpread.type, rMap(min, 0), rMap(max, 7), | |||
| @@ -152,6 +154,8 @@ void SUBnoteParameters::defaults() | |||
| Pfixedfreq = 0; | |||
| PfixedfreqET = 0; | |||
| PBendAdjust = 88; // 64 + 24 | |||
| POffsetHz = 64; | |||
| Pnumstages = 2; | |||
| Pbandwidth = 40; | |||
| Phmagtype = 0; | |||
| @@ -232,6 +236,8 @@ void SUBnoteParameters::add2XML(XMLwrapper& xml) | |||
| xml.beginbranch("FREQUENCY_PARAMETERS"); | |||
| xml.addparbool("fixed_freq", Pfixedfreq); | |||
| xml.addpar("fixed_freq_et", PfixedfreqET); | |||
| xml.addpar("bend_adjust", PBendAdjust); | |||
| xml.addpar("offset_hz", POffsetHz); | |||
| xml.addpar("detune", PDetune); | |||
| xml.addpar("coarse_detune", PCoarseDetune); | |||
| @@ -352,6 +358,8 @@ void SUBnoteParameters::paste(SUBnoteParameters &sub) | |||
| doPaste(PDetune); | |||
| doPaste(PCoarseDetune); | |||
| doPaste(PDetuneType); | |||
| doPaste(PBendAdjust); | |||
| doPaste(POffsetHz); | |||
| doPaste(PFreqEnvelopeEnabled); | |||
| doPPaste(FreqEnvelope); | |||
| doPaste(PBandWidthEnvelopeEnabled); | |||
| @@ -423,6 +431,8 @@ void SUBnoteParameters::getfromXML(XMLwrapper& xml) | |||
| if(xml.enterbranch("FREQUENCY_PARAMETERS")) { | |||
| Pfixedfreq = xml.getparbool("fixed_freq", Pfixedfreq); | |||
| PfixedfreqET = xml.getpar127("fixed_freq_et", PfixedfreqET); | |||
| PBendAdjust = xml.getpar127("bend_adjust", PBendAdjust); | |||
| POffsetHz = xml.getpar127("offset_hz", POffsetHz); | |||
| PDetune = xml.getpar("detune", PDetune, 0, 16383); | |||
| PCoarseDetune = xml.getpar("coarse_detune", PCoarseDetune, 0, 16383); | |||
| @@ -54,6 +54,8 @@ class SUBnoteParameters:public Presets | |||
| EnvelopeParams *FreqEnvelope; | |||
| unsigned char PBandWidthEnvelopeEnabled; | |||
| EnvelopeParams *BandWidthEnvelope; | |||
| unsigned char PBendAdjust; | |||
| unsigned char POffsetHz; | |||
| //Filter Parameters (Global) | |||
| unsigned char PGlobalFilterEnabled; | |||
| @@ -105,15 +105,36 @@ ADnote::ADnote(ADnoteParameters *pars_, SynthParams &spars) | |||
| continue; //the voice is disabled | |||
| } | |||
| int BendAdj = pars.VoicePar[nvoice].PBendAdjust - 64; | |||
| if (BendAdj % 24 == 0) | |||
| NoteVoicePar[nvoice].BendAdjust = BendAdj / 24; | |||
| else | |||
| NoteVoicePar[nvoice].BendAdjust = BendAdj / 24.0f; | |||
| float offset_val = (pars.VoicePar[nvoice].POffsetHz - 64)/64.0f; | |||
| NoteVoicePar[nvoice].OffsetHz = | |||
| 15.0f*(offset_val * sqrtf(fabsf(offset_val))); | |||
| unison_stereo_spread[nvoice] = | |||
| pars.VoicePar[nvoice].Unison_stereo_spread / 127.0f; | |||
| int unison = pars.VoicePar[nvoice].Unison_size; | |||
| if(unison < 1) | |||
| unison = 1; | |||
| // Since noise unison of greater than two is touch goofy... | |||
| if (pars.VoicePar[nvoice].Type != 0 && unison > 2) | |||
| unison = 2; | |||
| bool is_pwm = pars.VoicePar[nvoice].PFMEnabled == PW_MOD; | |||
| if (pars.VoicePar[nvoice].Type != 0) { | |||
| // Since noise unison of greater than two is touch goofy... | |||
| if (unison > 2) | |||
| unison = 2; | |||
| } else if (is_pwm) { | |||
| /* Pulse width mod uses pairs of subvoices. */ | |||
| unison *= 2; | |||
| // This many is likely to sound like noise anyhow. | |||
| if (unison > 64) | |||
| unison = 64; | |||
| } | |||
| //compute unison | |||
| unison_size[nvoice] = unison; | |||
| @@ -127,8 +148,8 @@ ADnote::ADnote(ADnoteParameters *pars_, SynthParams &spars) | |||
| float unison_vibratto_a = | |||
| pars.VoicePar[nvoice].Unison_vibratto / 127.0f; //0.0f .. 1.0f | |||
| switch(unison) { | |||
| int true_unison = unison / (is_pwm ? 2 : 1); | |||
| switch(true_unison) { | |||
| case 1: | |||
| unison_base_freq_rap[nvoice][0] = 1.0f; //if the unison is not used, always make the only subvoice to have the default note | |||
| break; | |||
| @@ -138,11 +159,11 @@ ADnote::ADnote(ADnoteParameters *pars_, SynthParams &spars) | |||
| }; | |||
| break; | |||
| default: { //unison for more than 2 subvoices | |||
| float unison_values[unison]; | |||
| float unison_values[true_unison]; | |||
| float min = -1e-6, max = 1e-6; | |||
| for(int k = 0; k < unison; ++k) { | |||
| float step = (k / (float) (unison - 1)) * 2.0f - 1.0f; //this makes the unison spread more uniform | |||
| float val = step + (RND * 2.0f - 1.0f) / (unison - 1); | |||
| for(int k = 0; k < true_unison; ++k) { | |||
| float step = (k / (float) (true_unison - 1)) * 2.0f - 1.0f; //this makes the unison spread more uniform | |||
| float val = step + (RND * 2.0f - 1.0f) / (true_unison - 1); | |||
| unison_values[k] = val; | |||
| if (min > val) { | |||
| min = val; | |||
| @@ -152,7 +173,7 @@ ADnote::ADnote(ADnoteParameters *pars_, SynthParams &spars) | |||
| } | |||
| } | |||
| float diff = max - min; | |||
| for(int k = 0; k < unison; ++k) { | |||
| for(int k = 0; k < true_unison; ++k) { | |||
| unison_values[k] = | |||
| (unison_values[k] - (max + min) * 0.5f) / diff; //the lowest value will be -1 and the highest will be 1 | |||
| unison_base_freq_rap[nvoice][k] = | |||
| @@ -160,9 +181,16 @@ ADnote::ADnote(ADnoteParameters *pars_, SynthParams &spars) | |||
| } | |||
| }; | |||
| } | |||
| if (is_pwm) | |||
| for (int i = true_unison - 1; i >= 0; i--) { | |||
| unison_base_freq_rap[nvoice][2*i + 1] = | |||
| unison_base_freq_rap[nvoice][i]; | |||
| unison_base_freq_rap[nvoice][2*i] = | |||
| unison_base_freq_rap[nvoice][i]; | |||
| } | |||
| //unison vibrattos | |||
| if(unison > 1) | |||
| if(unison > 2 || (!is_pwm && unison > 1)) | |||
| for(int k = 0; k < unison; ++k) //reduce the frequency difference for larger vibrattos | |||
| unison_base_freq_rap[nvoice][k] = 1.0f | |||
| + (unison_base_freq_rap[ | |||
| @@ -186,12 +214,27 @@ ADnote::ADnote(ADnoteParameters *pars_, SynthParams &spars) | |||
| if(RND < 0.5f) | |||
| m = -m; | |||
| unison_vibratto[nvoice].step[k] = m; | |||
| // Ugly, but the alternative is likely uglier. | |||
| if (is_pwm) | |||
| for (int i = 0; i < unison; i += 2) { | |||
| unison_vibratto[nvoice].step[i+1] = | |||
| unison_vibratto[nvoice].step[i]; | |||
| unison_vibratto[nvoice].position[i+1] = | |||
| unison_vibratto[nvoice].position[i]; | |||
| } | |||
| } | |||
| if(unison == 1) { //no vibratto for a single voice | |||
| unison_vibratto[nvoice].step[0] = 0.0f; | |||
| unison_vibratto[nvoice].position[0] = 0.0f; | |||
| unison_vibratto[nvoice].amplitude = 0.0f; | |||
| if(unison <= 2) { //no vibratto for a single voice | |||
| if (is_pwm) { | |||
| unison_vibratto[nvoice].step[1] = 0.0f; | |||
| unison_vibratto[nvoice].position[1] = 0.0f; | |||
| } | |||
| if (is_pwm || unison == 1) { | |||
| unison_vibratto[nvoice].step[0] = 0.0f; | |||
| unison_vibratto[nvoice].position[0] = 0.0f; | |||
| unison_vibratto[nvoice].amplitude = 0.0f; | |||
| } | |||
| } | |||
| //phase invert for unison | |||
| @@ -286,17 +329,21 @@ ADnote::ADnote(ADnoteParameters *pars_, SynthParams &spars) | |||
| getvoicebasefreq(nvoice), | |||
| pars.VoicePar[nvoice].Presonance); | |||
| //Find range of generated wave | |||
| float min = NoteVoicePar[nvoice].OscilSmp[0]; | |||
| float max = min; | |||
| float *smpls = &(NoteVoicePar[nvoice].OscilSmp[1]); | |||
| for (int i = synth.oscilsize-1; i--; smpls++) | |||
| if (*smpls > max) | |||
| max = *smpls; | |||
| else if (*smpls < min) | |||
| min = *smpls; | |||
| NoteVoicePar[nvoice].OscilSmpMin = min; | |||
| NoteVoicePar[nvoice].OscilSmpMax = max; | |||
| // This code was planned for biasing the carrier in MOD_RING | |||
| // but that's on hold for the moment. Disabled 'cos small | |||
| // machines run this stuff too. | |||
| // | |||
| // //Find range of generated wave | |||
| // float min = NoteVoicePar[nvoice].OscilSmp[0]; | |||
| // float max = min; | |||
| // float *smpls = &(NoteVoicePar[nvoice].OscilSmp[1]); | |||
| // for (int i = synth.oscilsize-1; i--; smpls++) | |||
| // if (*smpls > max) | |||
| // max = *smpls; | |||
| // else if (*smpls < min) | |||
| // min = *smpls; | |||
| // NoteVoicePar[nvoice].OscilSmpMin = min; | |||
| // NoteVoicePar[nvoice].OscilSmpMax = max; | |||
| //I store the first elments to the last position for speedups | |||
| for(int i = 0; i < OSCIL_SMP_EXTRA_SAMPLES; ++i) | |||
| @@ -304,9 +351,11 @@ ADnote::ADnote(ADnoteParameters *pars_, SynthParams &spars) | |||
| + i] = | |||
| NoteVoicePar[nvoice].OscilSmp[i]; | |||
| oscposhi_start += | |||
| NoteVoicePar[nvoice].phase_offset = | |||
| (int)((pars.VoicePar[nvoice].Poscilphase | |||
| - 64.0f) / 128.0f * synth.oscilsize + synth.oscilsize * 4); | |||
| - 64.0f) / 128.0f * synth.oscilsize | |||
| + synth.oscilsize * 4); | |||
| oscposhi_start += NoteVoicePar[nvoice].phase_offset; | |||
| int kth_start = oscposhi_start; | |||
| for(int k = 0; k < unison; ++k) { | |||
| @@ -337,29 +386,34 @@ ADnote::ADnote(ADnoteParameters *pars_, SynthParams &spars) | |||
| NoteVoicePar[nvoice].filterbypass = | |||
| pars.VoicePar[nvoice].Pfilterbypass; | |||
| switch(pars.VoicePar[nvoice].PFMEnabled) { | |||
| case 1: | |||
| NoteVoicePar[nvoice].FMEnabled = MORPH; | |||
| break; | |||
| case 2: | |||
| NoteVoicePar[nvoice].FMEnabled = RING_MOD; | |||
| break; | |||
| case 3: | |||
| NoteVoicePar[nvoice].FMEnabled = PHASE_MOD; | |||
| break; | |||
| case 4: | |||
| NoteVoicePar[nvoice].FMEnabled = FREQ_MOD; | |||
| break; | |||
| case 5: | |||
| NoteVoicePar[nvoice].FMEnabled = PITCH_MOD; | |||
| break; | |||
| default: | |||
| NoteVoicePar[nvoice].FMEnabled = NONE; | |||
| } | |||
| if (pars.VoicePar[nvoice].Type != 0) | |||
| NoteVoicePar[nvoice].FMEnabled = NONE; | |||
| else | |||
| switch(pars.VoicePar[nvoice].PFMEnabled) { | |||
| case 1: | |||
| NoteVoicePar[nvoice].FMEnabled = MORPH; | |||
| break; | |||
| case 2: | |||
| NoteVoicePar[nvoice].FMEnabled = RING_MOD; | |||
| break; | |||
| case 3: | |||
| NoteVoicePar[nvoice].FMEnabled = PHASE_MOD; | |||
| break; | |||
| case 4: | |||
| NoteVoicePar[nvoice].FMEnabled = FREQ_MOD; | |||
| break; | |||
| case 5: | |||
| NoteVoicePar[nvoice].FMEnabled = PW_MOD; | |||
| break; | |||
| default: | |||
| NoteVoicePar[nvoice].FMEnabled = NONE; | |||
| } | |||
| NoteVoicePar[nvoice].FMVoice = pars.VoicePar[nvoice].PFMVoice; | |||
| NoteVoicePar[nvoice].FMFreqEnvelope = NULL; | |||
| NoteVoicePar[nvoice].FMAmpEnvelope = NULL; | |||
| NoteVoicePar[nvoice].FMFreqFixed = pars.VoicePar[nvoice].PFMFixedFreq; | |||
| //Compute the Voice's modulator volume (incl. damping) | |||
| float fmvoldamp = powf(440.0f / getvoicebasefreq( | |||
| @@ -368,6 +422,7 @@ ADnote::ADnote(ADnoteParameters *pars_, SynthParams &spars) | |||
| - 1.0f); | |||
| switch(NoteVoicePar[nvoice].FMEnabled) { | |||
| case PHASE_MOD: | |||
| case PW_MOD: | |||
| fmvoldamp = | |||
| powf(440.0f / getvoicebasefreq( | |||
| nvoice), pars.VoicePar[nvoice].PFMVolumeDamp | |||
| @@ -381,8 +436,6 @@ ADnote::ADnote(ADnoteParameters *pars_, SynthParams &spars) | |||
| (expf(pars.VoicePar[nvoice].PFMVolume / 127.0f | |||
| * FM_AMP_MULTIPLIER) - 1.0f) * fmvoldamp * 4.0f; | |||
| break; | |||
| // case PITCH_MOD:NoteVoicePar[nvoice].FMVolume=(pars.VoicePar[nvoice].PFMVolume/127.0f*8.0f)*fmvoldamp;//??????????? | |||
| // break; | |||
| default: | |||
| if(fmvoldamp > 1.0f) | |||
| fmvoldamp = 1.0f; | |||
| @@ -546,6 +599,7 @@ void ADnote::legatonote(LegatoParams lpars) | |||
| switch(NoteVoicePar[nvoice].FMEnabled) { | |||
| case PHASE_MOD: | |||
| case PW_MOD: | |||
| fmvoldamp = | |||
| powf(440.0f / getvoicebasefreq( | |||
| nvoice), pars.VoicePar[nvoice].PFMVolumeDamp | |||
| @@ -559,8 +613,6 @@ void ADnote::legatonote(LegatoParams lpars) | |||
| (expf(pars.VoicePar[nvoice].PFMVolume / 127.0f | |||
| * FM_AMP_MULTIPLIER) - 1.0f) * fmvoldamp * 4.0f; | |||
| break; | |||
| // case PITCH_MOD:NoteVoicePar[nvoice].FMVolume=(pars.VoicePar[nvoice].PFMVolume/127.0f*8.0f)*fmvoldamp;//??????????? | |||
| // break; | |||
| default: | |||
| if(fmvoldamp > 1.0f) | |||
| fmvoldamp = 1.0f; | |||
| @@ -1084,20 +1136,28 @@ void ADnote::computecurrentparameters() | |||
| / 100.0f; | |||
| voicefreq = getvoicebasefreq(nvoice) | |||
| * powf(2, (voicepitch + globalpitch) / 12.0f); //Hz frequency | |||
| voicefreq *= ctl.pitchwheel.relfreq; //change the frequency by the controller | |||
| setfreq(nvoice, voicefreq * portamentofreqrap); | |||
| voicefreq *= | |||
| powf(ctl.pitchwheel.relfreq, NoteVoicePar[nvoice].BendAdjust); //change the frequency by the controller | |||
| setfreq(nvoice, voicefreq * portamentofreqrap + NoteVoicePar[nvoice].OffsetHz); | |||
| /***************/ | |||
| /* Modulator */ | |||
| /***************/ | |||
| if(NoteVoicePar[nvoice].FMEnabled != NONE) { | |||
| FMrelativepitch = NoteVoicePar[nvoice].FMDetune / 100.0f; | |||
| if(NoteVoicePar[nvoice].FMFreqEnvelope) | |||
| FMrelativepitch += | |||
| NoteVoicePar[nvoice].FMFreqEnvelope->envout() / 100; | |||
| FMfreq = | |||
| powf(2.0f, FMrelativepitch | |||
| / 12.0f) * voicefreq * portamentofreqrap; | |||
| if (NoteVoicePar[nvoice].FMFreqFixed) | |||
| FMfreq = | |||
| powf(2.0f, FMrelativepitch | |||
| / 12.0f) * 440.0f; | |||
| else | |||
| FMfreq = | |||
| powf(2.0f, FMrelativepitch | |||
| / 12.0f) * voicefreq * portamentofreqrap; | |||
| setfreqFM(nvoice, FMfreq); | |||
| FMoldamplitude[nvoice] = FMnewamplitude[nvoice]; | |||
| @@ -1332,7 +1392,11 @@ inline void ADnote::ComputeVoiceOscillatorFrequencyModulation(int nvoice, | |||
| for(int k = 0; k < unison_size[nvoice]; ++k) { | |||
| float *tw = tmpwave_unison[k]; | |||
| const float *smps = NoteVoicePar[NoteVoicePar[nvoice].FMVoice].VoiceOut; | |||
| memcpy(tw, smps, synth.bufferbytes); | |||
| if (FMmode == PW_MOD && (k & 1)) | |||
| for (int i = 0; i < synth.buffersize; ++i) | |||
| tw[i] = -smps[i]; | |||
| else | |||
| memcpy(tw, smps, synth.bufferbytes); | |||
| } | |||
| } else { | |||
| //Compute the modulator and store it in tmpwave_unison[][] | |||
| @@ -1346,7 +1410,10 @@ inline void ADnote::ComputeVoiceOscillatorFrequencyModulation(int nvoice, | |||
| for(int i = 0; i < synth.buffersize; ++i) { | |||
| tw[i] = (smps[poshiFM] * ((1<<24) - posloFM) | |||
| + smps[poshiFM + 1] * posloFM) / (1.0f*(1<<24)); | |||
| + smps[poshiFM + 1] * posloFM) / (1.0f*(1<<24)); | |||
| if (FMmode == PW_MOD && (k & 1)) | |||
| tw[i] = -tw[i]; | |||
| posloFM += freqloFM; | |||
| if(posloFM >= (1<<24)) { | |||
| posloFM &= 0xffffff;//fmod(posloFM, 1.0f); | |||
| @@ -1380,7 +1447,7 @@ inline void ADnote::ComputeVoiceOscillatorFrequencyModulation(int nvoice, | |||
| //normalize: makes all sample-rates, oscil_sizes to produce same sound | |||
| if(FMmode != 0) { //Frequency modulation | |||
| if(FMmode == FREQ_MOD) { //Frequency modulation | |||
| const float normalize = synth.oscilsize_f / 262144.0f * 44100.0f | |||
| / synth.samplerate_f; | |||
| for(int k = 0; k < unison_size[nvoice]; ++k) { | |||
| @@ -1393,7 +1460,7 @@ inline void ADnote::ComputeVoiceOscillatorFrequencyModulation(int nvoice, | |||
| FMoldsmp[nvoice][k] = fmold; | |||
| } | |||
| } | |||
| else { //Phase modulation | |||
| else { //Phase or PWM modulation | |||
| const float normalize = synth.oscilsize_f / 262144.0f; | |||
| for(int k = 0; k < unison_size[nvoice]; ++k) { | |||
| float *tw = tmpwave_unison[k]; | |||
| @@ -1421,6 +1488,8 @@ inline void ADnote::ComputeVoiceOscillatorFrequencyModulation(int nvoice, | |||
| //carrier | |||
| int carposhi = poshi + FMmodfreqhi; | |||
| int carposlo = poslo + FMmodfreqlo; | |||
| if (FMmode == PW_MOD && (k & 1)) | |||
| carposhi += NoteVoicePar[nvoice].phase_offset; | |||
| if(carposlo >= (1<<24)) { | |||
| carposhi++; | |||
| @@ -1446,12 +1515,6 @@ inline void ADnote::ComputeVoiceOscillatorFrequencyModulation(int nvoice, | |||
| } | |||
| /*Calculeaza Oscilatorul cu PITCH MODULATION*/ | |||
| inline void ADnote::ComputeVoiceOscillatorPitchModulation(int /*nvoice*/) | |||
| { | |||
| //TODO | |||
| } | |||
| /* | |||
| * Computes the Noise | |||
| */ | |||
| @@ -1514,13 +1577,12 @@ int ADnote::noteout(float *outl, float *outr) | |||
| case RING_MOD: | |||
| ComputeVoiceOscillatorRingModulation(nvoice); | |||
| break; | |||
| case PHASE_MOD: | |||
| ComputeVoiceOscillatorFrequencyModulation(nvoice, 0); | |||
| break; | |||
| case FREQ_MOD: | |||
| ComputeVoiceOscillatorFrequencyModulation(nvoice, 1); | |||
| case PHASE_MOD: | |||
| case PW_MOD: | |||
| ComputeVoiceOscillatorFrequencyModulation(nvoice, | |||
| NoteVoicePar[nvoice].FMEnabled); | |||
| break; | |||
| //case PITCH_MOD:ComputeVoiceOscillatorPitchModulation(nvoice);break; | |||
| default: | |||
| ComputeVoiceOscillator_LinearInterpolation(nvoice); | |||
| //if (config.cfg.Interpolation) ComputeVoiceOscillator_CubicInterpolation(nvoice); | |||
| @@ -1544,10 +1606,17 @@ int ADnote::noteout(float *outl, float *outr) | |||
| float *tw = tmpwave_unison[k]; | |||
| if(stereo) { | |||
| float stereo_pos = 0; | |||
| if(unison_size[nvoice] > 1) | |||
| bool is_pwm = NoteVoicePar[nvoice].FMEnabled == PW_MOD; | |||
| if (is_pwm) { | |||
| if(unison_size[nvoice] > 2) | |||
| stereo_pos = k/2 | |||
| / (float)(unison_size[nvoice]/2 | |||
| - 1) * 2.0f - 1.0f; | |||
| } else if(unison_size[nvoice] > 1) { | |||
| stereo_pos = k | |||
| / (float)(unison_size[nvoice] | |||
| - 1) * 2.0f - 1.0f; | |||
| / (float)(unison_size[nvoice] | |||
| - 1) * 2.0f - 1.0f; | |||
| } | |||
| float stereo_spread = unison_stereo_spread[nvoice] * 2.0f; //between 0 and 2.0f | |||
| if(stereo_spread > 1.0f) { | |||
| float stereo_pos_1 = (stereo_pos >= 0.0f) ? 1.0f : -1.0f; | |||
| @@ -1559,7 +1628,8 @@ int ADnote::noteout(float *outl, float *outr) | |||
| else | |||
| stereo_pos *= stereo_spread; | |||
| if(unison_size[nvoice] == 1) | |||
| if(unison_size[nvoice] == 1 || | |||
| (is_pwm && unison_size[nvoice] == 2)) | |||
| stereo_pos = 0.0f; | |||
| float panning = (stereo_pos + 1.0f) * 0.5f; | |||
| @@ -105,7 +105,6 @@ class ADnote:public SynthNote | |||
| /**Fadein in a way that removes clicks but keep sound "punchy"*/ | |||
| inline void fadein(float *smps) const; | |||
| //GLOBALS | |||
| ADnoteParameters &pars; | |||
| unsigned char stereo; //if the note is stereo (allows note Panning) | |||
| @@ -187,6 +186,9 @@ class ADnote:public SynthNote | |||
| /* Waveform of the Voice */ | |||
| float *OscilSmp; | |||
| /* preserved for phase mod PWM emulation. */ | |||
| int phase_offset; | |||
| /* Range of waveform */ | |||
| float OscilSmpMin, OscilSmpMax; | |||
| @@ -199,6 +201,11 @@ class ADnote:public SynthNote | |||
| // cents = basefreq*VoiceDetune | |||
| float Detune, FineDetune; | |||
| // Bend adjustment | |||
| float BendAdjust; | |||
| float OffsetHz; | |||
| Envelope *FreqEnvelope; | |||
| LFO *FreqLfo; | |||
| @@ -234,6 +241,8 @@ class ADnote:public SynthNote | |||
| FMTYPE FMEnabled; | |||
| unsigned char FMFreqFixed; | |||
| int FMVoice; | |||
| // Voice Output used by other voices if use this as modullator | |||
| @@ -29,7 +29,8 @@ | |||
| #include <cmath> | |||
| LFO::LFO(const LFOParams &lfopars, float basefreq, const AbsTime &t) | |||
| :delayTime(t, lfopars.Pdelay / 127.0f * 4.0f), //0..4 sec | |||
| :first_half(-1), | |||
| delayTime(t, lfopars.Pdelay / 127.0f * 4.0f), //0..4 sec | |||
| waveShape(lfopars.PLFOtype), | |||
| deterministic(!lfopars.Pfreqrand), | |||
| dt_(t.dt()), | |||
| @@ -88,7 +89,7 @@ LFO::LFO(const LFOParams &lfopars, float basefreq, const AbsTime &t) | |||
| LFO::~LFO() | |||
| {} | |||
| float LFO::baseOut(const char waveShape, const float phase) const | |||
| float LFO::baseOut(const char waveShape, const float phase) | |||
| { | |||
| switch(waveShape) { | |||
| case LFO_TRIANGLE: | |||
| @@ -109,6 +110,12 @@ float LFO::baseOut(const char waveShape, const float phase) const | |||
| case LFO_RAMPDOWN: return (0.5f - phase) * 2.0f; | |||
| case LFO_EXP_DOWN1: return powf(0.05f, phase) * 2.0f - 1.0f; | |||
| case LFO_EXP_DOWN2: return powf(0.001f, phase) * 2.0f - 1.0f; | |||
| case LFO_RANDOM: | |||
| if ((phase < 0.5) != first_half) { | |||
| first_half = phase < 0.5; | |||
| last_random = 2*RND-1; | |||
| } | |||
| return last_random; | |||
| default: return cosf(phase * 2.0f * PI); //LFO_SINE | |||
| } | |||
| } | |||
| @@ -41,7 +41,7 @@ class LFO | |||
| float lfoout(); | |||
| float amplfoout(); | |||
| private: | |||
| float baseOut(const char waveShape, const float phase) const; | |||
| float baseOut(const char waveShape, const float phase); | |||
| //Phase of Oscillator | |||
| float phase; | |||
| //Phase Increment Per Frame | |||
| @@ -51,6 +51,10 @@ class LFO | |||
| //Amplitude Randomness | |||
| float amp1, amp2; | |||
| // RND mode | |||
| int first_half; | |||
| float last_random; | |||
| //Intensity of the wave | |||
| float lfointensity; | |||
| //Amount Randomness | |||
| @@ -171,6 +171,7 @@ const rtosc::Ports OscilGen::non_realtime_ports = { | |||
| printf("fowarding...\n"); d.forward();} | |||
| const rtosc::Ports OscilGen::realtime_ports{ | |||
| rSelf(OscilGen), | |||
| rPresetType, | |||
| rParamZyn(Prand, "Oscilator Phase Randomness: smaller than 0 is \"" | |||
| "group\", larger than 0 is for each harmonic"), | |||
| rParamZyn(Pamprandpower, | |||
| @@ -63,7 +63,13 @@ void PADnote::setup(float freq, | |||
| basefreq *= powf(3.0f, tmp); | |||
| } | |||
| } | |||
| int BendAdj = pars.PBendAdjust - 64; | |||
| if (BendAdj % 24 == 0) | |||
| BendAdjust = BendAdj / 24; | |||
| else | |||
| BendAdjust = BendAdj / 24.0f; | |||
| float offset_val = (pars.POffsetHz - 64)/64.0f; | |||
| OffsetHz = 15.0f*(offset_val * sqrtf(fabsf(offset_val))); | |||
| firsttime = true; | |||
| realfreq = basefreq; | |||
| if(!legato) | |||
| @@ -255,7 +261,8 @@ void PADnote::computecurrentparameters() | |||
| } | |||
| realfreq = basefreq * portamentofreqrap | |||
| * powf(2.0f, globalpitch / 12.0f) * ctl.pitchwheel.relfreq; | |||
| * powf(2.0f, globalpitch / 12.0f) | |||
| * powf(ctl.pitchwheel.relfreq, BendAdjust) + OffsetHz; | |||
| } | |||
| @@ -52,6 +52,8 @@ class PADnote:public SynthNote | |||
| float poslo; | |||
| float basefreq; | |||
| float BendAdjust; | |||
| float OffsetHz; | |||
| bool firsttime; | |||
| int nsample, portamento; | |||
| @@ -78,6 +78,13 @@ void SUBnote::setup(float freq, | |||
| basefreq *= powf(3.0f, tmp); | |||
| } | |||
| } | |||
| int BendAdj = pars.PBendAdjust - 64; | |||
| if (BendAdj % 24 == 0) | |||
| BendAdjust = BendAdj / 24; | |||
| else | |||
| BendAdjust = BendAdj / 24.0f; | |||
| float offset_val = (pars.POffsetHz - 64)/64.0f; | |||
| OffsetHz = 15.0f*(offset_val * sqrtf(fabsf(offset_val))); | |||
| float detune = getdetune(pars.PDetuneType, | |||
| pars.PCoarseDetune, | |||
| pars.PDetune); | |||
| @@ -178,9 +185,11 @@ void SUBnote::setup(float freq, | |||
| float amp = 1.0f; | |||
| if(nph == 0) | |||
| amp = gain; | |||
| initfilter(lfilter[nph + n * numstages], freq, bw, amp, hgain); | |||
| initfilter(lfilter[nph + n * numstages], freq + OffsetHz, bw, | |||
| amp, hgain); | |||
| if(stereo) | |||
| initfilter(rfilter[nph + n * numstages], freq, bw, amp, hgain); | |||
| initfilter(rfilter[nph + n * numstages], freq + OffsetHz, bw, | |||
| amp, hgain); | |||
| } | |||
| } | |||
| @@ -432,7 +441,8 @@ void SUBnote::computecurrentparameters() | |||
| envfreq = FreqEnvelope->envout() / 1200; | |||
| envfreq = powf(2.0f, envfreq); | |||
| } | |||
| envfreq *= ctl.pitchwheel.relfreq; //pitch wheel | |||
| envfreq *= | |||
| powf(ctl.pitchwheel.relfreq, BendAdjust); //pitch wheel | |||
| if(portamento) { //portamento is used | |||
| envfreq *= ctl.portamento.freqrap; | |||
| if(!ctl.portamento.used) //the portamento has finished | |||
| @@ -59,6 +59,8 @@ class SUBnote:public SynthNote | |||
| int firstnumharmonics; //To keep track of the first note's numharmonics value, useful in legato mode. | |||
| int start; //how the harmonics start | |||
| float basefreq; | |||
| float BendAdjust; | |||
| float OffsetHz; | |||
| float panning; | |||
| Envelope *AmpEnvelope; | |||
| Envelope *FreqEnvelope; | |||
| @@ -87,9 +87,9 @@ class PhaseSlider {: {public Fl_Osc_TSlider} | |||
| Function {PhaseSlider(int x,int y, int w, int h, const char *label=0) | |||
| :Fl_Osc_TSlider(x,y,w,h,label)} {open | |||
| } { code { | |||
| setRounding(1); | |||
| set_rounding(1); | |||
| reset_value=0; | |||
| setTransform(180.0/64, 0); | |||
| set_transform([](float x){return 180.0f*x/64.0f;}); | |||
| } {}} | |||
| Function {set_scope(Fl_Oscilloscope *newscope)} { | |||
| } { code { oscope = newscope; } {} } | |||
| @@ -127,7 +127,7 @@ class ADvoicelistitem {open : {public Fl_Osc_Group} | |||
| } { | |||
| Fl_Value_Slider voicevolume { | |||
| tooltip Volume xywh {132 5 115 20} type {Horz Knob} box NO_BOX labelsize 8 align 5 maximum 127 step 1 | |||
| code1 {o->init("PVolume");} | |||
| code1 {o->init("PVolume"); o->reset_value=100;} | |||
| class Fl_Osc_VSlider | |||
| } | |||
| Fl_Check_Button voiceresonanceenabled { | |||
| @@ -137,12 +137,12 @@ class ADvoicelistitem {open : {public Fl_Osc_Group} | |||
| } | |||
| Fl_Value_Slider voicelfofreq { | |||
| tooltip {Frequency LFO amount} xywh {542 5 115 20} type {Horz Knob} box NO_BOX labelsize 8 align 5 maximum 127 step 1 | |||
| code0 {o->init("FreqLfo/Pintensity", 'i');} | |||
| code0 {o->init("FreqLfo/Pintensity", 'i');o->reset_value=40;} | |||
| class Fl_Osc_VSlider | |||
| } | |||
| Fl_Dial voicepanning { | |||
| tooltip {Panning (leftmost is Random)} xywh {257 5 20 20} box ROUND_UP_BOX labelsize 10 align 4 maximum 127 step 1 | |||
| code0 {o->init("PPanning");} | |||
| code0 {o->init("PPanning");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Group voiceoscil {open | |||
| @@ -214,6 +214,7 @@ else | |||
| case 0: | |||
| whitenoiselabel->hide(); | |||
| pinknoiselabel->hide(); | |||
| oscil->Overlay = NULL; | |||
| voiceresonanceenabled->activate(); | |||
| detunevalueoutput->activate(); | |||
| voicedetune->activate(); | |||
| @@ -223,10 +224,12 @@ else | |||
| case 1: | |||
| whitenoiselabel->show(); | |||
| pinknoiselabel->hide(); | |||
| oscil->Overlay = whitenoiselabel; | |||
| break; | |||
| default: | |||
| pinknoiselabel->show(); | |||
| whitenoiselabel->hide(); | |||
| oscil->Overlay = pinknoiselabel; | |||
| } | |||
| voiceresonanceenabled->deactivate(); | |||
| @@ -310,15 +313,15 @@ class ADvoiceUI {open : {public Fl_Group} | |||
| } { | |||
| Fl_Group voiceFMparametersgroup { | |||
| label MODULATOR open | |||
| xywh {530 5 230 580} box UP_FRAME color 48 labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 | |||
| xywh {530 5 230 585} box UP_FRAME color 48 labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 | |||
| } { | |||
| Fl_Group modfrequency { | |||
| label {Mod.FREQUENCY} | |||
| xywh {535 220 220 155} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 | |||
| xywh {535 219 220 174} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17 | |||
| } { | |||
| Fl_Group voiceFMfreqenvgroup { | |||
| label {ADSynth Modulator - Frequency Envelope} | |||
| xywh {540 300 210 70} box FLAT_BOX color 51 align 144 | |||
| xywh {540 315 210 70} box FLAT_BOX color 51 align 144 | |||
| code0 {o->init(ENV_ASR, osc_i, loc, "FMFreqEnvelope/");} | |||
| class EnvelopeUI | |||
| } {} | |||
| @@ -327,20 +330,20 @@ class ADvoiceUI {open : {public Fl_Group} | |||
| callback {if (o->value()==0) voiceFMfreqenvgroup->deactivate(); | |||
| else voiceFMfreqenvgroup->activate(); | |||
| o->redraw();} | |||
| tooltip {Forced Release} xywh {545 305 50 10} down_box DOWN_BOX labelfont 1 labelsize 11 | |||
| tooltip {Forced Release} xywh {545 322 50 10} down_box DOWN_BOX labelfont 1 labelsize 11 | |||
| code0 {o->init("PFMFreqEnvelopeEnabled");} | |||
| class Fl_Osc_Check | |||
| } | |||
| Fl_Counter {} { | |||
| label {Coarse Det.} | |||
| tooltip {Coarse Detune} xywh {685 280 60 15} labelsize 10 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 11 | |||
| tooltip {Coarse Detune} xywh {685 295 60 15} labelsize 10 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 11 | |||
| code0 {o->init("FMcoarsedetune");} | |||
| code3 {o->lstep(10);} | |||
| class Fl_Osc_Counter | |||
| } | |||
| Fl_Counter {} { | |||
| label Octave | |||
| tooltip Octave xywh {625 280 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11 | |||
| tooltip Octave xywh {625 295 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11 | |||
| code0 {o->init("FMoctave");} | |||
| class Fl_Osc_Counter | |||
| } | |||
| @@ -352,18 +355,26 @@ o->redraw();} | |||
| } | |||
| Fl_Value_Output fmdetunevalueoutput { | |||
| label Detune | |||
| xywh {540 245 45 18} labelsize 8 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 8 | |||
| xywh {540 247 45 18} labelsize 8 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 8 | |||
| code0 {o->init("FMdetunevalue");} | |||
| class Fl_Osc_Output | |||
| } | |||
| Fl_Choice {} { | |||
| label {Detune Type} | |||
| callback {fmdetunevalueoutput->update();} open | |||
| xywh {540 280 75 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 | |||
| xywh {540 294 75 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10 | |||
| code0 {o->add("Default");o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");} | |||
| code1 {o->init("PFMDetuneType");} | |||
| class Fl_Osc_Choice | |||
| } {} | |||
| Fl_Check_Button {} { | |||
| label 440Hz | |||
| callback {if (o->value()==0) fixedfreqetdial->deactivate(); | |||
| else fixedfreqetdial->activate();} selected | |||
| tooltip {Set the modulator base frequency to 440Hz} xywh {683 266 55 15} down_box DOWN_BOX labelfont 1 labelsize 11 | |||
| code0 {o->init("PFMFixedFreq");} | |||
| class Fl_Osc_Check | |||
| } | |||
| } | |||
| Fl_Group {} { | |||
| label {Mod.AMPLITUDE} | |||
| @@ -371,19 +382,19 @@ o->redraw();} | |||
| } { | |||
| Fl_Value_Slider {} { | |||
| label Vol | |||
| tooltip Volume xywh {540 80 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1 | |||
| code0 {o->init("PFMVolume", 'i');} | |||
| tooltip Volume xywh {540 80 155 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1 | |||
| code0 {o->init("PFMVolume", 'i');o->reset_value=90;} | |||
| class Fl_Osc_VSlider | |||
| } | |||
| Fl_Value_Slider {} { | |||
| label {V.Sns} | |||
| tooltip {Velocity Sensing Function (rightmost to disable)} xywh {540 100 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1 | |||
| code0 {o->init("PFMVelocityScaleFunction");} | |||
| code0 {o->init("PFMVelocityScaleFunction");o->reset_value=64;} | |||
| class Fl_Osc_VSlider | |||
| } | |||
| Fl_Group voiceFMampenvgroup { | |||
| label {ADSynth Modulator - Amplitude Envelope} open | |||
| xywh {540 145 205 70} box FLAT_BOX color 51 align 144 | |||
| xywh {540 140 205 70} box FLAT_BOX color 51 align 144 | |||
| code0 {o->init(//pars->VoicePar[nvoice].FMAmpEnvelope, | |||
| ENV_ADSR, osc_i, loc, "FMAmpEnvelope/");} | |||
| class EnvelopeUI | |||
| @@ -405,10 +416,10 @@ o->redraw();} | |||
| } | |||
| } | |||
| Fl_Group modoscil {open | |||
| xywh {535 365 220 220} | |||
| xywh {535 390 220 195} | |||
| } { | |||
| Fl_Group fmoscil {open | |||
| xywh {535 440 220 140} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 | |||
| xywh {535 445 220 140} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 | |||
| code0 {fmoscil->base = loc; fmoscil->ext="FMSmp/";fmoscil->osc = osc_i;fmoscil->begin();} | |||
| code1 {oscFM=new Fl_Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");} | |||
| code2 {//int nv=nvoice; if (pars->VoicePar[nvoice].PextFMoscil>=0) nv=pars->VoicePar[nvoice].PextFMoscil;} | |||
| @@ -417,7 +428,7 @@ o->redraw();} | |||
| } {} | |||
| Fl_Box {} { | |||
| label {Mod.Oscillator} | |||
| xywh {535 375 155 20} labelfont 1 align 20 | |||
| xywh {535 393 155 20} labelfont 1 align 20 | |||
| } | |||
| Fl_Button changeFMoscilbutton { | |||
| label Change | |||
| @@ -428,13 +439,13 @@ o->redraw();} | |||
| oscedit=new OscilEditor(true,loc+"FMSmp/", osc_i); | |||
| else | |||
| oscedit=new OscilEditor(true,loc+"../VoicePar"+to_s(extFMoscil->value()-1)+"/FMSmp/", osc_i);} | |||
| xywh {700 380 55 15} box THIN_UP_BOX labelfont 1 labelsize 11 | |||
| xywh {700 398 55 15} box THIN_UP_BOX labelfont 1 labelsize 11 | |||
| code0 {(void)o;/*if (extFMoscil->value()>=0) o->labelcolor(FL_BLUE);*/} | |||
| } | |||
| Fl_Slider {} { | |||
| label Phase | |||
| xywh {645 415 105 15} type {Horz Knob} box NO_BOX labelsize 10 align 5 minimum -63 maximum 64 step 1 | |||
| code0 { o->init("PFMoscilphase", 'i'); o->set_scope(oscFM); } | |||
| xywh {645 425 105 15} type {Horz Knob} box NO_BOX labelsize 10 align 5 minimum -63 maximum 64 step 1 | |||
| code0 {o->init("PFMoscilphase", 'i'); o->set_scope(oscFM);} | |||
| class PhaseSlider | |||
| } | |||
| Fl_Choice extFMoscil { | |||
| @@ -451,7 +462,7 @@ fmoscil->rebase(loc); | |||
| else | |||
| fmoscil->rebase(loc+"../VoicePar"+to_s(o->value()-1)+"/"); | |||
| voiceFMparametersgroup->redraw();} open | |||
| xywh {560 410 75 20} down_box BORDER_BOX labelsize 10 textfont 1 textsize 10 | |||
| xywh {560 420 75 20} down_box BORDER_BOX labelsize 10 textfont 1 textsize 10 | |||
| code0 {o->add("Internal");} | |||
| code1 {char tmp[50]; for (int i=0;i<nvoice;i++) {sprintf(tmp,"ExtM.%2d",i+1);o->add(tmp);};} | |||
| code3 {o->init("PextFMoscil",-1);} | |||
| @@ -506,8 +517,8 @@ o->redraw();} | |||
| xywh {80 80 100 20} labelfont 1 | |||
| } | |||
| MenuItem {} { | |||
| label PITCH | |||
| xywh {90 90 100 20} labelfont 1 deactivate | |||
| label PWM | |||
| xywh {80 80 100 20} labelfont 1 | |||
| } | |||
| } | |||
| Fl_Group {} { | |||
| @@ -558,6 +569,18 @@ o->redraw();} | |||
| code3 {o->lstep(10);} | |||
| class Fl_Osc_Counter | |||
| } | |||
| Fl_Dial bendadjdial { | |||
| label Bend | |||
| tooltip {How the frequency varies according to the pitch wheel} xywh {60 270 15 15} box ROUND_UP_BOX labelsize 10 align 8 minimum -64 maximum 63 step 1 | |||
| code0 {o->init("PBendAdjust");o->reset_value=24;o->set_transform([](float x){return x/24.0f;});o->set_rounding(2);} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial offsethzdial { | |||
| label Offset | |||
| tooltip {Offset of frequency in Hz} xywh {110 270 15 15} box ROUND_UP_BOX labelsize 10 align 8 minimum -64 maximum 63 step 1 | |||
| code0 {o->init("POffsetHz"); o->set_rounding(2); o->set_transform([](float x){x/=64; return 15*(x*sqrtf(fabsf(x)));});} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Slider {} { | |||
| callback {detunevalueoutput->update();} | |||
| tooltip {Fine Detune (cents)} xywh {58 287 392 13} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1 | |||
| @@ -580,7 +603,7 @@ o->redraw();} | |||
| } | |||
| Fl_Dial fixedfreqetdial { | |||
| label {Eq.T.} | |||
| tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {405 270 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1 | |||
| tooltip {How the frequency varies according to the keyboard (leftmost for fixed frequency)} xywh {405 270 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1 | |||
| code0 {o->init("PfixedfreqET");} | |||
| class Fl_Osc_Dial | |||
| } | |||
| @@ -654,7 +677,7 @@ voiceonbutton->redraw();} open | |||
| Fl_Dial {} { | |||
| label Vibrato | |||
| tooltip Vibrato xywh {364 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("Unison_vibratto");} | |||
| code0 {o->init("Unison_vibratto");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Choice {} { | |||
| @@ -668,7 +691,7 @@ voiceonbutton->redraw();} open | |||
| label {Frequency Spread} | |||
| callback {unisonspreadoutput->update();} | |||
| tooltip {Frequency Spread of the Unison} xywh {95 562 125 13} type {Horz Knob} box NO_BOX labelsize 12 align 1 maximum 127 step 1 value 64 | |||
| code0 {o->init("Unison_frequency_spread", 'i');} | |||
| code0 {o->init("Unison_frequency_spread", 'i');o->reset_value=60;} | |||
| class Fl_Osc_Slider | |||
| } | |||
| Fl_Value_Output unisonspreadoutput { | |||
| @@ -680,19 +703,19 @@ voiceonbutton->redraw();} open | |||
| Fl_Dial {} { | |||
| label {V.speed} | |||
| tooltip {Vibrato Average Speed} xywh {406 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("Unison_vibratto_speed");} | |||
| code0 {o->init("Unison_vibratto_speed");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial {} { | |||
| label {Ph.rand} | |||
| tooltip {Phase randomness} xywh {280 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("Unison_phase_randomness");} | |||
| code0 {o->init("Unison_phase_randomness");o->reset_value=127;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial {} { | |||
| label Stereo | |||
| tooltip {Stereo Spread} xywh {322 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("Unison_stereo_spread");} | |||
| code0 {o->init("Unison_stereo_spread");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| } | |||
| @@ -704,13 +727,13 @@ voiceonbutton->redraw();} open | |||
| Fl_Value_Slider {} { | |||
| label Vol | |||
| tooltip Volume xywh {10 60 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1 | |||
| code0 {o->init("PVolume");} | |||
| code0 {o->init("PVolume");o->reset_value=100;} | |||
| class Fl_Osc_VSlider | |||
| } | |||
| Fl_Value_Slider {} { | |||
| label {V.Sns} | |||
| tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 80 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1 | |||
| code0 {o->init("PAmpVelocityScaleFunction");} | |||
| code0 {o->init("PAmpVelocityScaleFunction");o->reset_value=127;} | |||
| class Fl_Osc_VSlider | |||
| } | |||
| Fl_Group voiceampenvgroup { | |||
| @@ -723,7 +746,7 @@ voiceonbutton->redraw();} open | |||
| Fl_Dial {} { | |||
| label Pan | |||
| tooltip {Panning (leftmost is Random)} xywh {212 65 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("PPanning");} | |||
| code0 {o->init("PPanning");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Check_Button {} { | |||
| @@ -806,9 +829,9 @@ o->redraw();} | |||
| } {} | |||
| Fl_Choice {} { | |||
| callback {switch (o->value()) { | |||
| case 0: voicemodegroup->activate(); whitenoiselabel->hide(); pinknoiselabel->hide(); break; | |||
| case 1: voicemodegroup->deactivate(); whitenoiselabel->show(); pinknoiselabel->hide(); break; | |||
| default: voicemodegroup->deactivate(); whitenoiselabel->hide(); pinknoiselabel->show(); break; | |||
| case 0: voicemodegroup->activate(); whitenoiselabel->hide(); pinknoiselabel->hide(); osc->Overlay=NULL; break; | |||
| case 1: voicemodegroup->deactivate(); whitenoiselabel->show(); pinknoiselabel->hide(); osc->Overlay=whitenoiselabel; break; | |||
| default: voicemodegroup->deactivate(); whitenoiselabel->hide(); pinknoiselabel->show(); osc->Overlay=pinknoiselabel; break; | |||
| }} open | |||
| tooltip {Oscillator Type (sound/noise)} xywh {5 515 65 20} down_box BORDER_BOX labelsize 10 textfont 1 textsize 10 | |||
| code0 {o->init("Type");} | |||
| @@ -820,11 +843,11 @@ o->redraw();} | |||
| } | |||
| MenuItem {} { | |||
| label White | |||
| xywh {15 15 100 20} labelfont 1 labelsize 11 labelcolor 55 | |||
| xywh {15 15 100 20} labelfont 1 labelsize 11 | |||
| } | |||
| MenuItem {} { | |||
| label Pink | |||
| xywh {25 25 100 20} labelfont 1 labelsize 11 labelcolor 212 | |||
| xywh {25 25 100 20} labelfont 1 labelsize 11 | |||
| } | |||
| } | |||
| Fl_Check_Button bypassfiltercheckbutton { | |||
| @@ -1019,7 +1042,7 @@ class ADnoteUI {open : {public PresetsUI_} | |||
| voicelistitem[i]->refreshlist(); | |||
| };} | |||
| tooltip {Bandwidth - how the relative fine detune of the voice are changed} xywh {505 295 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("PBandwidth");} | |||
| code0 {o->init("PBandwidth");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| } | |||
| @@ -1030,25 +1053,25 @@ class ADnoteUI {open : {public PresetsUI_} | |||
| Fl_Value_Slider volume { | |||
| label Vol | |||
| tooltip Volume xywh {10 30 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1 | |||
| code0 {o->init("PVolume");} | |||
| code0 {o->init("PVolume");o->reset_value=90;} | |||
| class Fl_Osc_VSlider | |||
| } | |||
| Fl_Value_Slider vsns { | |||
| label {V.Sns} | |||
| tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 50 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1 | |||
| code0 {o->init("PAmpVelocityScaleFunction");} | |||
| code0 {o->init("PAmpVelocityScaleFunction");o->reset_value=64;} | |||
| class Fl_Osc_VSlider | |||
| } | |||
| Fl_Dial pan { | |||
| label Pan | |||
| tooltip {Panning (leftmost is Random)} xywh {210 25 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("PPanning");} | |||
| code0 {o->init("PPanning");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial {} { | |||
| label De-pop selected | |||
| tooltip {Pop suppression} xywh {208 228 20 20} type Float labelsize 10 maximum 127 step 1 textfont 1 textsize 11 | |||
| code0 {o->init("Fadein_adjustment");} | |||
| code0 {o->init("Fadein_adjustment");o->reset_value=20;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| @@ -1061,19 +1084,19 @@ class ADnoteUI {open : {public PresetsUI_} | |||
| Fl_Dial pt { | |||
| label {P.t.} | |||
| tooltip {Punch Time (duration)} xywh {108 237 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("PPunchTime");} | |||
| code0 {o->init("PPunchTime");o->reset_value=60;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial pstc { | |||
| label {P.Stc.} | |||
| tooltip {Punch Stretch} xywh {138 237 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("PPunchStretch");} | |||
| code0 {o->init("PPunchStretch");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial pvel { | |||
| label {P.Vel.} | |||
| tooltip {Punch Velocity Sensing} xywh {168 237 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("PPunchVelocitySensing");} | |||
| code0 {o->init("PPunchVelocitySensing");o->reset_value=72;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Group ampenv { | |||
| @@ -103,6 +103,7 @@ int Fl_Osc_Slider::handle(int ev, int X, int Y, int W, int H) | |||
| just_pushed = true; | |||
| mod_state = Fl::event_state() & MOD_MASK; | |||
| slow_state = 0; | |||
| start_pos = horizontal() ? Fl::event_x() : Fl::event_y(); | |||
| handled = mod_state ? 1 : Fl_Slider::handle(ev, X, Y, W, H); | |||
| break; | |||
| case FL_MOUSEWHEEL: | |||
| @@ -146,8 +147,13 @@ int Fl_Osc_Slider::handle(int ev, int X, int Y, int W, int H) | |||
| case FL_DRAG: { | |||
| old_mod_state = mod_state; | |||
| mod_state = Fl::event_state() & MOD_MASK; | |||
| if (slow_state == 0 && mod_state == 0) | |||
| if (slow_state == 0 && mod_state == 0) { | |||
| int delta = (horizontal() ? Fl::event_x() : Fl::event_y()) | |||
| - start_pos; | |||
| if (delta < -1 || delta > 1) | |||
| Fl::event_clicks(0); | |||
| return Fl_Slider::handle(ev, X, Y, W, H); | |||
| } | |||
| if (mod_state != 0) { | |||
| slow_state = 1; | |||
| @@ -185,6 +191,8 @@ int Fl_Osc_Slider::handle(int ev, int X, int Y, int W, int H) | |||
| int delta = (horizontal() ? Fl::event_x() : Fl::event_y()) | |||
| - start_pos; | |||
| if (delta < -1 || delta > 1) | |||
| Fl::event_clicks(0); | |||
| float new_value; | |||
| if (slow_state == 1) { | |||
| new_value = old_value + delta / denominator; | |||
| @@ -10,12 +10,10 @@ class Fl_Osc_TSlider:public Fl_Osc_Slider | |||
| Fl_Osc_TSlider(int x, int y, int w, int h, const char *label = 0); | |||
| ~Fl_Osc_TSlider(); | |||
| int handle(int event); | |||
| void setTransform(float scale = 1.0, float offset = 0.0); | |||
| float transform(float x); | |||
| void setRounding(unsigned int digits = 0); | |||
| void set_transform(float (*transformer)(float)); | |||
| void set_rounding(unsigned int digits = 0); | |||
| private: | |||
| class TipWin * tipwin; | |||
| float value_offset; | |||
| float value_scale; | |||
| float (*transform)(float); | |||
| }; | |||
| #endif | |||
| @@ -3,15 +3,19 @@ | |||
| //Copyright (c) 2015 Christopher Oliver | |||
| //License: GNU GPL version 2 or later | |||
| static float identity(float value) | |||
| { | |||
| return value; | |||
| } | |||
| Fl_Osc_TSlider::Fl_Osc_TSlider(int x, int y, int w, int h, const char *label) | |||
| :Fl_Osc_Slider(x, y, w, h, label), value_offset(0.0), value_scale(1.0) | |||
| :Fl_Osc_Slider(x, y, w, h, label), transform(identity) | |||
| { | |||
| Fl_Group *save = Fl_Group::current(); | |||
| tipwin = new TipWin(); | |||
| tipwin->hide(); | |||
| Fl_Group::current(save); | |||
| tipwin->setRounding(); | |||
| tipwin->set_rounding(); | |||
| } | |||
| Fl_Osc_TSlider::~Fl_Osc_TSlider() | |||
| @@ -20,9 +24,9 @@ Fl_Osc_TSlider::~Fl_Osc_TSlider() | |||
| delete tipwin; | |||
| } | |||
| void Fl_Osc_TSlider::setRounding(unsigned int digits) | |||
| void Fl_Osc_TSlider::set_rounding(unsigned int digits) | |||
| { | |||
| tipwin->setRounding(digits); | |||
| tipwin->set_rounding(digits); | |||
| } | |||
| @@ -53,13 +57,7 @@ int Fl_Osc_TSlider::handle(int event) | |||
| return super; | |||
| } | |||
| void Fl_Osc_TSlider::setTransform(float scale, float offset) | |||
| { | |||
| value_offset = offset; | |||
| value_scale = scale; | |||
| } | |||
| float Fl_Osc_TSlider::transform(float x) | |||
| void Fl_Osc_TSlider::set_transform(float (*transformer)(float)) | |||
| { | |||
| return value_scale * x + value_offset; | |||
| transform = transformer; | |||
| } | |||
| @@ -17,7 +17,8 @@ class Fl_Oscilloscope : public Fl_Box, public Fl_Osc_Widget | |||
| { | |||
| public: | |||
| Fl_Oscilloscope(int x,int y, int w, int h, const char *label=0) | |||
| :Fl_Box(x,y,w,h,label), Fl_Osc_Widget(this), smps(0), oscilsize(0) | |||
| :Fl_Box(x,y,w,h,label), Fl_Osc_Widget(this), smps(0), oscilsize(0), | |||
| Overlay(NULL) | |||
| { | |||
| phase=64; | |||
| box(FL_FLAT_BOX); | |||
| @@ -129,6 +130,8 @@ class Fl_Oscilloscope : public Fl_Box, public Fl_Osc_Widget | |||
| fl_rect(ox-1,oy-1,lx+2,ly+2); | |||
| fl_line_style(FL_SOLID,0); | |||
| if (Overlay) | |||
| Overlay->redraw(); | |||
| } | |||
| //allows UI to manipuate phase of displayed waveform | |||
| @@ -149,4 +152,6 @@ class Fl_Oscilloscope : public Fl_Box, public Fl_Osc_Widget | |||
| float *smps; | |||
| int oscilsize; | |||
| Fl_Color bkgnd; | |||
| public: | |||
| Fl_Box *Overlay; | |||
| }; | |||
| @@ -131,10 +131,14 @@ hide();} {} | |||
| label E2dn | |||
| xywh {70 70 100 20} labelfont 1 labelsize 10 | |||
| } | |||
| MenuItem {} { | |||
| label RND | |||
| xywh {80 80 100 20} labelfont 1 labelsize 10 | |||
| } | |||
| } | |||
| Fl_Check_Button continous { | |||
| label {C.} | |||
| tooltip {Continous LFO} xywh {165 35 15 15} down_box DOWN_BOX labelsize 10 align 2 | |||
| tooltip {Continuous LFO} xywh {165 35 15 15} down_box DOWN_BOX labelsize 10 align 2 | |||
| code0 {o->init("Pcontinous");} | |||
| class Fl_Osc_Check | |||
| } | |||
| @@ -148,7 +148,7 @@ bankui->show();} | |||
| } | |||
| Fl_Slider partvolume { | |||
| xywh {10 65 30 110} type {Vert Knob} box NO_BOX minimum 127 maximum 0 step 1 value 127 | |||
| code0 {o->init("Pvolume", 'i');} | |||
| code0 {o->init("Pvolume", 'i');o->reset_value=96;} | |||
| class Fl_Osc_TSlider | |||
| } | |||
| Fl_Dial partpanning { | |||
| @@ -508,7 +508,7 @@ if (fl_choice("The file *might* exist. \\nOverwrite it?","No","Yes",NULL)) { | |||
| Fl_Dial mastervolumedial { | |||
| label {Master Volume} | |||
| tooltip {Master Volume} xywh {15 32 55 55} box ROUND_UP_BOX labelsize 9 align 130 maximum 127 step 1 | |||
| code2 {o->init("volume"); o->selection_color(FL_RED);} | |||
| code2 {o->init("volume"); o->selection_color(FL_RED); o->reset_value=80;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Counter masterkeyshiftcounter { | |||
| @@ -856,7 +856,7 @@ globalfinedetuneslider->do_callback();} | |||
| Fl_Dial globalfinedetuneslider { | |||
| label {Fine Detune} | |||
| tooltip {global fine detune} xywh {90 68 45 45} box ROUND_UP_BOX labelsize 9 align 130 maximum 127 step 1 value 64 | |||
| code0 {o->init("microtonal/Pglobalfinedetune");} | |||
| code0 {o->init("microtonal/Pglobalfinedetune");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| } | |||
| @@ -1102,7 +1102,7 @@ virkeys->midich=(int) o->value();} open | |||
| } {} | |||
| Fl_Dial partvolume { | |||
| xywh {135 95 45 40} labelsize 9 maximum 127 step 1 | |||
| code0 {o->init("Pvolume");} | |||
| code0 {o->init("Pvolume"); o->reset_value=96;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Box {} { | |||
| @@ -1422,7 +1422,7 @@ pthread_mutex_unlock(&master->mutex);*/} | |||
| Fl_Dial simplemastervolumedial { | |||
| label {Master Volume} | |||
| tooltip {Master Volume} xywh {10 35 40 40} box ROUND_UP_BOX labelfont 1 labelsize 11 align 130 maximum 127 step 1 | |||
| code0 {o->init("Pvolume");} | |||
| code0 {o->init("Pvolume");o->reset_value=80;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Counter simplemasterkeyshiftcounter { | |||
| @@ -1448,7 +1448,7 @@ simpleglobalfinedetuneslider->do_callback();} | |||
| Fl_Dial simpleglobalfinedetuneslider { | |||
| label {Fine Detune} | |||
| tooltip {global fine detune} xywh {80 50 30 30} box ROUND_UP_BOX labelsize 11 align 130 maximum 127 step 1 value 64 | |||
| code0 {o->init("microtonal/Pglobalfinedetune");} | |||
| code0 {o->init("microtonal/Pglobalfinedetune");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Counter simplenpartcounter { | |||
| @@ -195,12 +195,12 @@ make_window(); | |||
| mag->osc = osc; | |||
| mag->loc = loc; | |||
| mag->reset_value = 63; | |||
| mag->setTransform(-1, 63); | |||
| mag->set_transform([](float x){return 63.0f - x;}); | |||
| phase->osc = osc; | |||
| phase->loc = loc; | |||
| phase->reset_value = 64; | |||
| phase->setRounding(1); | |||
| phase->setTransform(-180.0/64, 180.0); | |||
| phase->set_rounding(1); | |||
| phase->set_transform([](float x){return 180*(1 - x/64.0f);}); | |||
| osc->createLink(loc+"magnitude"+to_s(n), mag); | |||
| osc->createLink(loc+"phase"+to_s(n), phase); | |||
| @@ -303,7 +303,7 @@ class OscilEditor {open : {public PresetsUI_} | |||
| } | |||
| Fl_Dial hrnddial { | |||
| tooltip {Oscillator's spectrum adjust parameter} xywh {345 285 18 18} maximum 127 step 1 | |||
| code0 {o->init("Pamprandpower");} | |||
| code0 {o->init("Pamprandpower");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| } | |||
| @@ -485,19 +485,19 @@ redrawoscil();} | |||
| Fl_Dial bfmodpar1 { | |||
| callback {redrawoscil();} | |||
| tooltip {Oscillator's modulation parameter 1} xywh {664 286 15 15} maximum 127 step 1 | |||
| code0 {o->init("Pbasefuncmodulationpar1");} | |||
| code0 {o->init("Pbasefuncmodulationpar1");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial bfmodpar2 { | |||
| callback {redrawoscil();} | |||
| tooltip {Oscillator's modulation parameter 2} xywh {684 286 15 15} maximum 127 step 1 | |||
| code0 {o->init("Pbasefuncmodulationpar2");} | |||
| code0 {o->init("Pbasefuncmodulationpar2");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial bfmodpar3 { | |||
| callback {redrawoscil();} selected | |||
| tooltip {Oscillator's modulation parameter 3} xywh {704 286 15 15} maximum 127 step 1 | |||
| code0 {o->init("Pbasefuncmodulationpar3");} | |||
| code0 {o->init("Pbasefuncmodulationpar3");o->reset_value=32;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| } | |||
| @@ -718,7 +718,7 @@ redrawoscil();} | |||
| Fl_Dial filtervalue1 { | |||
| callback {redrawoscil();} | |||
| tooltip {Oscillator's filter parameter1} xywh {372 318 20 20} maximum 127 step 1 | |||
| code0 {o->init("Pfilterpar1");} | |||
| code0 {o->init("Pfilterpar1");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Check_Button filterpref { | |||
| @@ -729,7 +729,7 @@ redrawoscil();} | |||
| Fl_Dial filtervalue2 { | |||
| callback {redrawoscil();} | |||
| tooltip {Oscillator's filter parameter2} xywh {395 318 20 20} maximum 127 step 1 | |||
| code0 {o->init("Pfilterpar2");} | |||
| code0 {o->init("Pfilterpar2");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| } | |||
| @@ -763,7 +763,7 @@ redrawoscil();} | |||
| Fl_Dial sadjpar { | |||
| callback {redrawoscil();} | |||
| tooltip {Oscillator's spectrum adjust parameter} xywh {700 318 20 20} maximum 127 step 1 | |||
| code0 {o->init("Psapar");} | |||
| code0 {o->init("Psapar");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| } | |||
| @@ -843,14 +843,14 @@ redrawoscil();} | |||
| label pow | |||
| callback {redrawoscil();} | |||
| tooltip {Adaptive harmonics power} xywh {705 465 25 25} labelsize 10 maximum 200 step 1 | |||
| code0 {o->init("Padaptiveharmonicspower");} | |||
| code0 {o->init("Padaptiveharmonicspower");o->reset_value=100;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial adhrbf { | |||
| label baseF | |||
| callback {redrawoscil();} | |||
| tooltip {Adaptive harmonics base frequency} xywh {675 465 25 25} labelsize 10 maximum 255 step 1 | |||
| code0 {o->init("Padaptiveharmonicsbasefreq");} | |||
| code0 {o->init("Padaptiveharmonicsbasefreq");o->reset_value=128;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Slider adhrpar { | |||
| @@ -890,19 +890,19 @@ redrawoscil();} | |||
| Fl_Dial modpar1 { | |||
| callback {redrawoscil();} | |||
| tooltip {Oscillator's modulation parameter 1} xywh {535 320 15 15} maximum 127 step 1 | |||
| code0 {o->init("Pmodulationpar1");} | |||
| code0 {o->init("Pmodulationpar1");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial modpar2 { | |||
| callback {redrawoscil();} | |||
| tooltip {Oscillator's modulation parameter 2} xywh {555 320 15 15} maximum 127 step 1 | |||
| code0 {o->init("Pmodulationpar2");} | |||
| code0 {o->init("Pmodulationpar2");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial modpar3 { | |||
| callback {redrawoscil();} | |||
| tooltip {Oscillator's modulation parameter 3} xywh {575 320 15 15} maximum 127 step 1 | |||
| code0 {o->init("Pmodulationpar3");} | |||
| code0 {o->init("Pmodulationpar3");o->reset_value=32;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| } | |||
| @@ -136,7 +136,7 @@ initialized = true;} {} | |||
| callback {if(hpui) hpui->update(); | |||
| cbwidget->do_callback();} | |||
| xywh {20 75 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code2 {o->init("Php.base.par1");} | |||
| code2 {o->init("Php.base.par1");o->reset_value=80;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Choice hpbasetype { | |||
| @@ -182,7 +182,7 @@ cbwidget->do_callback();} | |||
| callback {hpui->update(); | |||
| cbwidget->do_callback();} | |||
| xywh {40 115 20 20} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("Php.modulator.freq");} | |||
| code0 {o->init("Php.modulator.freq");o->reset_value=30;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Group {} { | |||
| @@ -244,7 +244,7 @@ cbwidget->do_callback();}} | |||
| callback {hpui->update(); | |||
| cbwidget->do_callback();} | |||
| xywh {15 235 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("Php.amp.par1");} | |||
| code0 {o->init("Php.amp.par1");o->reset_value=80;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial hpamppar2 { | |||
| @@ -252,7 +252,7 @@ cbwidget->do_callback();} | |||
| callback {hpui->update(); | |||
| cbwidget->do_callback();} | |||
| xywh {55 235 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("Php.amp.par2");} | |||
| code0 {o->init("Php.amp.par2");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| } | |||
| @@ -293,7 +293,7 @@ cbwidget->do_callback();}} | |||
| callback {hpui->update(); | |||
| cbwidget->do_callback();} | |||
| xywh {65 115 20 20} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("Php.width");} | |||
| code0 {o->init("Php.width");o->reset_value=127;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| } | |||
| @@ -328,7 +328,7 @@ resui->setcbwidget(cbwidget,applybutton);} | |||
| label BandWidth | |||
| callback {o->oscWrite("bandwidthvalue");cbwidget->do_callback();} | |||
| xywh {15 295 35 35} box ROUND_UP_BOX labelsize 10 maximum 1000 step 1 | |||
| code0 {o->init("Pbandwidth");} | |||
| code0 {o->init("Pbandwidth");o->reset_value=500;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Value_Output bwcents { | |||
| @@ -387,7 +387,7 @@ cbwidget->do_callback();}} | |||
| hpui->update(); | |||
| cbwidget->do_callback();} | |||
| xywh {425 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("Phrpos.par1");} | |||
| code0 {o->init("Phrpos.par1");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial hrpospar2 { | |||
| @@ -395,7 +395,7 @@ cbwidget->do_callback();} | |||
| callback {opui->update(); | |||
| cbwidget->do_callback();} | |||
| xywh {460 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("Phrpos.par2");} | |||
| code0 {o->init("Phrpos.par2");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial hrpospar3 { | |||
| @@ -651,7 +651,7 @@ cbwidget->do_callback();} | |||
| xywh {125 125 100 20} labelfont 1 labelsize 11 | |||
| } | |||
| MenuItem {} { | |||
| label Continous | |||
| label Continuous | |||
| xywh {115 115 100 20} labelfont 1 labelsize 11 | |||
| } | |||
| } | |||
| @@ -691,13 +691,13 @@ cbwidget->do_callback();} | |||
| } {} | |||
| Fl_Slider detune { | |||
| callback {o->oscWrite("detunevalue");} | |||
| tooltip {Fine Detune (cents)} xywh {60 295 295 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1 | |||
| tooltip {Fine Detune (cents)} xywh {60 296 295 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1 | |||
| code0 {o->init("PDetune", 'i');} | |||
| class Fl_Osc_Slider | |||
| } | |||
| Fl_Value_Output detunevalueoutput { | |||
| label Detune | |||
| xywh {12 295 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10 | |||
| xywh {12 296 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10 | |||
| code0 {o->init("detunevalue");} | |||
| class Fl_Osc_Output | |||
| } | |||
| @@ -709,6 +709,18 @@ cbwidget->do_callback();} | |||
| code1 {o->init("PDetuneType",1);} | |||
| class Fl_Osc_Choice | |||
| } {} | |||
| Fl_Dial bendadjustdial { | |||
| label Bend | |||
| tooltip {How the frequency varies according to the pitch wheel} xywh {60 278 15 15} box ROUND_UP_BOX labelsize 10 align 8 minimum -64 maximum 63 step 1 | |||
| code0 {o->init("PBendAdjust");o->reset_value=24;o->set_transform([](float x){return x/24.0f;});o->set_rounding(2);} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial offsethzdial { | |||
| label Offset | |||
| tooltip {Offset of frequency in Hz} xywh {110 278 15 15} box ROUND_UP_BOX labelsize 10 align 8 minimum -64 maximum 63 step 1 | |||
| code0 {o->init("POffsetHz"); o->set_rounding(2); o->set_transform([](float x){x/=64; return 15*(x*sqrtf(fabsf(x)));});} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Check_Button hz440 { | |||
| label 440Hz | |||
| callback {if (o->value()==0) fixedfreqetdial->deactivate(); | |||
| @@ -719,7 +731,7 @@ cbwidget->do_callback();} | |||
| } | |||
| Fl_Dial fixedfreqetdial { | |||
| label {Eq.T.} | |||
| tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {420 295 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1 | |||
| tooltip {How the frequency varies according to the keyboard (leftmost for fixed frequency)} xywh {420 295 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1 | |||
| code0 {o->init("PfixedfreqET");} | |||
| class Fl_Osc_Dial | |||
| } | |||
| @@ -731,25 +743,25 @@ cbwidget->do_callback();} | |||
| Fl_Value_Slider volume { | |||
| label Vol | |||
| tooltip Volume xywh {10 50 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1 | |||
| code0 {o->init("PVolume", 'i');} | |||
| code0 {o->init("PVolume", 'i');o->reset_value=90;} | |||
| class Fl_Osc_VSlider | |||
| } | |||
| Fl_Value_Slider vsns { | |||
| label {V.Sns} | |||
| tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 70 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1 | |||
| code0 {o->init("PAmpVelocityScaleFunction");} | |||
| code0 {o->init("PAmpVelocityScaleFunction");o->reset_value=64;} | |||
| class Fl_Osc_VSlider | |||
| } | |||
| Fl_Dial pan { | |||
| label Pan | |||
| tooltip {Panning (leftmost is Random)} xywh {210 45 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("PPanning");} | |||
| code0 {o->init("PPanning");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial {} { | |||
| label De-pop selected | |||
| tooltip {Pop suppression} xywh {208 238 20 20} type Float labelsize 10 maximum 127 step 1 textfont 1 textsize 11 | |||
| code0 {o->init("Fadein_adjustment");} | |||
| code0 {o->init("Fadein_adjustment");o->reset_value=20;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial pstr { | |||
| @@ -761,19 +773,19 @@ cbwidget->do_callback();} | |||
| Fl_Dial pt { | |||
| label {P.t.} | |||
| tooltip {Punch Time (duration)} xywh {108 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("PPunchTime");} | |||
| code0 {o->init("PPunchTime");o->reset_value=60;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial pstc { | |||
| label {P.Stc.} | |||
| tooltip {Punch Stretch} xywh {138 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("PPunchStretch");} | |||
| code0 {o->init("PPunchStretch");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial pvel { | |||
| label {P.Vel.} | |||
| tooltip {Punch Velocity Sensing} xywh {168 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("PPunchVelocitySensing");} | |||
| code0 {o->init("PPunchVelocitySensing");o->reset_value=72;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Group ampenv { | |||
| @@ -279,7 +279,7 @@ class PartUI {open : {public Fl_Osc_Group} | |||
| Fl_Dial {} { | |||
| label Pan | |||
| xywh {50 40 25 25} box ROUND_UP_BOX labelsize 11 maximum 127 step 1 | |||
| code0 {o->init("Ppanning");} | |||
| code0 {o->init("Ppanning"); o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Counter {} { | |||
| @@ -344,19 +344,19 @@ if (event==FL_RIGHT_MOUSE){ | |||
| Fl_Dial {} { | |||
| label Volume | |||
| tooltip {Part Volume} xywh {10 35 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1 | |||
| code0 {o->init("Pvolume");} | |||
| code0 {o->init("Pvolume"); o->reset_value=96;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial {} { | |||
| label {Vel.Ofs.} | |||
| tooltip {Velocity Offset} xywh {135 40 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("Pveloffs");} | |||
| code0 {o->init("Pveloffs"); o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial {} { | |||
| label {Vel.Sns.} | |||
| tooltip {Velocity Sensing Function} xywh {95 40 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("Pvelsns");} | |||
| code0 {o->init("Pvelsns"); o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Button {} { | |||
| @@ -453,31 +453,31 @@ if (event==FL_RIGHT_MOUSE){ | |||
| Fl_Dial {} { | |||
| label PanDpth | |||
| tooltip {Panning Depth} xywh {10 55 30 30} labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("panning.depth");} | |||
| code0 {o->init("panning.depth");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial {} { | |||
| label FltCut | |||
| tooltip {Filter Cutoff depth} xywh {90 55 30 30} labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("filtercutoff.depth");} | |||
| code0 {o->init("filtercutoff.depth");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial {} { | |||
| label FltQ | |||
| tooltip {Filter Q depth} xywh {50 55 30 30} labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("filterq.depth");} | |||
| code0 {o->init("filterq.depth");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial {} { | |||
| label BwDpth | |||
| tooltip {BandWidth depth} xywh {125 10 30 30} labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("bandwidth.depth");} | |||
| code0 {o->init("bandwidth.depth");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial {} { | |||
| label ModWh | |||
| tooltip {Modulation Wheel depth} xywh {50 10 30 30} labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("modwheel.depth");} | |||
| code0 {o->init("modwheel.depth");o->reset_value=80;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Check_Button benddir { | |||
| @@ -551,7 +551,7 @@ else {bendrng->oscMove("pitchwheel.bendrange");}} | |||
| Fl_Dial {} { | |||
| label time | |||
| tooltip {Portamento time} xywh {285 60 25 25} labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("portamento.time");} | |||
| code0 {o->init("portamento.time");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Counter {} { | |||
| @@ -573,19 +573,19 @@ else {bendrng->oscMove("pitchwheel.bendrange");}} | |||
| Fl_Dial {} { | |||
| label {t.dn/up} | |||
| tooltip {Portamento time stretch (up/down)} xywh {315 60 25 25} labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("portamento.updowntimestretch");} | |||
| code0 {o->init("portamento.updowntimestretch");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial propta { | |||
| label {Prp.Rate} | |||
| tooltip {Distance required to double change from nonpropotinal portamento time} xywh {405 20 25 25} labelsize 9 maximum 127 step 1 | |||
| code0 {o->init("portamento.propRate");} | |||
| code0 {o->init("portamento.propRate");o->reset_value=80;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial proptb { | |||
| label {Prp.Dpth} | |||
| tooltip {The difference from nonproportinal portamento} xywh {405 60 25 25} labelsize 9 maximum 127 step 1 | |||
| code0 {o->init("portamento.propDepth");} | |||
| code0 {o->init("portamento.propDepth");o->reset_value=90;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Check_Button {} { | |||
| @@ -605,13 +605,13 @@ else {propta->deactivate();proptb->deactivate();}} | |||
| Fl_Dial {} { | |||
| label BWdpth | |||
| tooltip {BandWidth controller depth} xywh {455 60 25 25} labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("resonancebandwidth.depth");} | |||
| code0 {o->init("resonancebandwidth.depth");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial {} { | |||
| label CFdpth | |||
| tooltip {Center Frequency controller Depth} xywh {455 20 25 25} labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("resonancecenter.depth");} | |||
| code0 {o->init("resonancecenter.depth");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| } | |||
| @@ -169,14 +169,14 @@ redrawPADnoteApply();} | |||
| callback {centerfreqvo->do_callback(); | |||
| redrawPADnoteApply();} | |||
| xywh {260 268 90 14} box FLAT_BOX type {Horz Knob} labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("Pcenterfreq", 'i');} | |||
| code0 {o->init("Pcenterfreq", 'i');o->reset_value=64;} | |||
| class Fl_Osc_Slider | |||
| } | |||
| Fl_Slider octavesfreq { | |||
| callback {octavesfreqvo->do_callback(); | |||
| redrawPADnoteApply();} | |||
| xywh {260 286 90 14} box FLAT_BOX type {Horz Knob} labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("Poctavesfreq", 'i');} | |||
| code0 {o->init("Poctavesfreq", 'i');o->reset_value=64;} | |||
| class Fl_Osc_Slider | |||
| } | |||
| Fl_Button {} { | |||
| @@ -107,11 +107,11 @@ harmonic->show(); | |||
| mag->reset_value=127; | |||
| mag->ext = "Phmag" + to_s(n); | |||
| mag->oscRegister(mag->ext.c_str()); | |||
| mag->setTransform(-1, 127); | |||
| mag->set_transform([](float x){return 127.0f - x;}); | |||
| bw->reset_value=63; | |||
| bw->ext = "Phrelbw" + to_s(n); | |||
| bw->oscRegister(bw->ext.c_str()); | |||
| bw->setTransform(-1, 63); | |||
| bw->set_transform([](float x){return 63.0f - x;}); | |||
| osc->requestValue(base+"Phrelbw"+to_s(n)); | |||
| end();} {} | |||
| @@ -164,19 +164,19 @@ class SUBnoteUI {open : {public PresetsUI_} | |||
| Fl_Value_Slider vol { | |||
| label Vol | |||
| tooltip Volume xywh {10 25 140 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1 | |||
| code0 {o->init("PVolume");} | |||
| code0 {o->init("PVolume");o->reset_value=96;} | |||
| class Fl_Osc_VSlider | |||
| } | |||
| Fl_Value_Slider vsns { | |||
| label {V.Sns} | |||
| tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 45 140 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1 | |||
| code0 {o->init("PAmpVelocityScaleFunction");} | |||
| code0 {o->init("PAmpVelocityScaleFunction");o->reset_value=90;} | |||
| class Fl_Osc_VSlider | |||
| } | |||
| Fl_Dial pan { | |||
| label Pan | |||
| tooltip {Panning (leftmost is Random)} xywh {185 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 | |||
| code0 {o->init("PPanning");} | |||
| code0 {o->init("PPanning");o->reset_value=64;} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Group ampenv { | |||
| @@ -287,6 +287,18 @@ freqsettingsui->redraw();} | |||
| code0 {o->init("detunevalue");} | |||
| class Fl_Osc_Output | |||
| } | |||
| Fl_Dial bendadjdial { | |||
| label Bend | |||
| tooltip {How the frequency varies according to the pitch wheel} xywh {448 53 15 15} box ROUND_UP_BOX labelsize 10 align 8 minimum -64 maximum 63 step 1 | |||
| code0 {o->init("PBendAdjust"); o->reset_value=24;o->set_transform([](float x){return x/24.0f;});o->set_rounding(2);} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Dial offsethzdial { | |||
| label Offset | |||
| tooltip {Offset of frequency in Hz} xywh {500 53 15 15} box ROUND_UP_BOX labelsize 10 align 8 minimum -64 maximum 63 step 1 | |||
| code0 {o->init("POffsetHz"); o->set_rounding(2); o->set_transform([](float x){x/=64; return 15*(x*sqrtf(fabsf(x)));});} | |||
| class Fl_Osc_Dial | |||
| } | |||
| Fl_Check_Button hz440 { | |||
| label 440Hz | |||
| callback {if (o->value()==0) fixedfreqetdial->deactivate(); | |||
| @@ -297,7 +309,7 @@ freqsettingsui->redraw();} | |||
| } | |||
| Fl_Dial fixedfreqetdial { | |||
| label {Eq.T.} | |||
| tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {610 53 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1 | |||
| tooltip {How the frequency varies according to the keyboard (leftmost for fixed frequency)} xywh {610 53 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1 | |||
| code0 {o->init("PfixedfreqET");} | |||
| class Fl_Osc_Dial | |||
| } | |||
| @@ -352,7 +364,7 @@ bandwidthsettingsui->redraw();} | |||
| Fl_Value_Slider bandwidth { | |||
| label {Band Width} | |||
| xywh {225 40 115 15} type {Horz Knob} box NO_BOX labelsize 10 align 1 maximum 127 step 1 | |||
| code0 {o->init("Pbandwidth");} | |||
| code0 {o->init("Pbandwidth");o->reset_value=40;} | |||
| class Fl_Osc_VSlider | |||
| } | |||
| Fl_Value_Slider bwidthscale { | |||
| @@ -11,7 +11,7 @@ TipWin::TipWin(void):Fl_Menu_Window(1, 1) | |||
| end(); | |||
| } | |||
| void TipWin::setRounding(unsigned int digits) | |||
| void TipWin::set_rounding(unsigned int digits) | |||
| { | |||
| format[3] = "0123456789"[digits < 9 ? digits : 9]; | |||
| } | |||
| @@ -13,7 +13,7 @@ class TipWin:public Fl_Menu_Window | |||
| void showValue(float f); | |||
| void setText(const char *c); | |||
| void showText(); | |||
| void setRounding(unsigned int digits = 0); | |||
| void set_rounding(unsigned int digits = 0); | |||
| private: | |||
| void redraw(); | |||
| const char *getStr() const; | |||
| @@ -10,10 +10,15 @@ | |||
| //static int numobj = 0; | |||
| static float identity(float value) | |||
| { | |||
| return value; | |||
| } | |||
| WidgetPDial::WidgetPDial(int x, int y, int w, int h, const char *label) | |||
| :Fl_Dial(x, y, w, h, label), reset_value(0), integer_step(true), | |||
| oldvalue(0.0f), pos(false), textset(false), value_offset(0.0), | |||
| value_scale(1.0) | |||
| use_rounding(false), oldvalue(0.0f), pos(false), textset(false), | |||
| transform(identity) | |||
| { | |||
| //cout << "[" << label << "] There are now " << ++numobj << endl; | |||
| Fl_Group *save = Fl_Group::current(); | |||
| @@ -28,9 +33,9 @@ WidgetPDial::~WidgetPDial() | |||
| delete tipwin; | |||
| } | |||
| void WidgetPDial::setRounding(unsigned int digits) | |||
| void WidgetPDial::set_rounding(unsigned int digits) | |||
| { | |||
| tipwin->setRounding(digits); | |||
| tipwin->set_rounding(digits); | |||
| } | |||
| #define MOD_MASK (FL_CTRL | FL_SHIFT) | |||
| @@ -55,15 +60,17 @@ int WidgetPDial::handle(int event) | |||
| switch(event) { | |||
| case FL_PUSH: | |||
| mod_state = Fl::event_state() & MOD_MASK; | |||
| if (integer_step) | |||
| setRounding(0); | |||
| else if (mod_state == MOD_MASK) | |||
| setRounding(5); | |||
| else if (mod_state == FL_SHIFT) | |||
| setRounding(4); | |||
| else | |||
| setRounding((Fl::event_button3() || mod_state & FL_CTRL) | |||
| ? 3 : 2); | |||
| if (!use_rounding) { | |||
| if (integer_step) | |||
| set_rounding(0); | |||
| else if (mod_state == MOD_MASK) | |||
| set_rounding(5); | |||
| else if (mod_state == FL_SHIFT) | |||
| set_rounding(4); | |||
| else | |||
| set_rounding((Fl::event_button3() || mod_state & FL_CTRL) | |||
| ? 3 : 2); | |||
| } | |||
| oldvalue = value(); | |||
| old_y = Fl::event_y(); | |||
| case FL_DRAG: | |||
| @@ -73,18 +80,23 @@ int WidgetPDial::handle(int event) | |||
| if (old_mod_state != mod_state) { | |||
| oldvalue = value(); | |||
| old_y = Fl::event_y(); | |||
| if (integer_step) | |||
| setRounding(0); | |||
| else if (mod_state == MOD_MASK) | |||
| setRounding(5); | |||
| else if (mod_state == FL_SHIFT) | |||
| setRounding(4); | |||
| else | |||
| setRounding((Fl::event_button3() || mod_state & FL_CTRL) | |||
| ? 3 : 2); | |||
| if (!use_rounding) { | |||
| if (integer_step) | |||
| set_rounding(0); | |||
| else if (mod_state == MOD_MASK) | |||
| set_rounding(5); | |||
| else if (mod_state == FL_SHIFT) | |||
| set_rounding(4); | |||
| else | |||
| set_rounding((Fl::event_button3() || | |||
| mod_state & FL_CTRL) | |||
| ? 3 : 2); | |||
| } | |||
| break; | |||
| } | |||
| dy = old_y - Fl::event_y(); | |||
| if (dy < -1 || dy > 1) | |||
| Fl::event_clicks(0); | |||
| if (!integer_step && mod_state == MOD_MASK) | |||
| dragsize = 200000.0f; | |||
| @@ -107,7 +119,7 @@ int WidgetPDial::handle(int event) | |||
| dy = - Fl::event_dy(); | |||
| if (integer_step) { | |||
| setRounding(0); | |||
| if (!use_rounding) set_rounding(0); | |||
| result = (int)(value() + | |||
| dy * ((Fl::event_ctrl() || | |||
| Fl::event_shift()) ? 1 : 8)); | |||
| @@ -115,16 +127,16 @@ int WidgetPDial::handle(int event) | |||
| float dragsize; | |||
| if (mod_state == MOD_MASK) { | |||
| dragsize = 100000.0; | |||
| setRounding(5); | |||
| if (!use_rounding) set_rounding(5); | |||
| } else if (mod_state == FL_SHIFT) { | |||
| dragsize = 10000.0; | |||
| setRounding(4); | |||
| if (!use_rounding) set_rounding(4); | |||
| } else if (mod_state == FL_CTRL) { | |||
| dragsize = 1000.0; | |||
| setRounding(3); | |||
| if (!use_rounding) set_rounding(3); | |||
| } else { | |||
| dragsize = 100.0; | |||
| setRounding(2); | |||
| if (!use_rounding) set_rounding(2); | |||
| } | |||
| result = value() + dy / dragsize * (max - min); | |||
| } | |||
| @@ -248,13 +260,8 @@ void WidgetPDial::resetPos() | |||
| pos = false; | |||
| } | |||
| void WidgetPDial::set_transform(float scale, float offset) | |||
| { | |||
| value_offset = offset; | |||
| value_scale = scale; | |||
| } | |||
| float WidgetPDial::transform(float x) | |||
| void WidgetPDial::set_transform(float (*transformer)(float)) | |||
| { | |||
| return value_scale * x + value_offset; | |||
| transform = transformer; | |||
| use_rounding = true; | |||
| } | |||
| @@ -15,12 +15,12 @@ class WidgetPDial:public Fl_Dial | |||
| void draw(); | |||
| void pdialcolor(int r, int g, int b); | |||
| void tooltip(const char *c); | |||
| void set_transform(float scale = 1.0, float offset = 0.0); | |||
| float transform(float x); | |||
| void setRounding(unsigned int digits = 0); | |||
| void set_transform(float (*transformer)(float)); | |||
| void set_rounding(unsigned int digits = 0); | |||
| float reset_value; | |||
| protected: | |||
| bool integer_step; | |||
| bool use_rounding; | |||
| private: | |||
| void getPos(); | |||
| void resetPos(); | |||
| @@ -29,8 +29,7 @@ class WidgetPDial:public Fl_Dial | |||
| bool pos; | |||
| bool textset; | |||
| class TipWin * tipwin; | |||
| float value_offset; | |||
| float value_scale; | |||
| float (*transform)(float); | |||
| int mod_state; | |||
| }; | |||
| #endif | |||
| @@ -578,7 +578,7 @@ int main(int argc, char *argv[]) | |||
| help = true; | |||
| if(help) { | |||
| printf(help_message); | |||
| puts(help_message); | |||
| return 1; | |||
| } | |||
| @@ -372,7 +372,7 @@ int main(int argc, char *argv[]) | |||
| << " -a , --auto-connect\t\t\t AutoConnect when using JACK\n" | |||
| << " -p , --pid-in-client-name\t\t Append PID to (JACK) " | |||
| "client name\n" | |||
| << " -P , --prefered-port\t\t\t Prefered OSC Port\n" | |||
| << " -P , --preferred-port\t\t\t Preferred OSC Port\n" | |||
| << " -O , --output\t\t\t\t Set Output Engine\n" | |||
| << " -I , --input\t\t\t\t Set Input Engine\n" | |||
| << " -e , --exec-after-init\t\t Run post-initialization script\n" | |||