commit 557629897f97ea9f7ec05f35720bf08d22354bd5
parent 4a740f070762a14ea46ce4ee85f2c90880603892
Author: Daniel Sheeler <[email protected]>
Date: Thu, 28 Feb 2019 17:02:26 -0600
Might be correct, but need to test.
Diffstat:
3 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/src/Params/ADnoteParameters.cpp b/src/Params/ADnoteParameters.cpp
@@ -151,7 +151,7 @@ static const Ports voicePorts = {
rParamZyn(PFilterVelocityScaleFunction, rShort("v.sense"), rDefault(64),
"Filter Velocity Function Shape"),
-
+
//Modulator Stuff
rOption(PFMEnabled, rShort("mode"), rOptions(none, mix, ring, phase,
frequency, pulse), rDefault(none), "Modulator mode"),
@@ -180,6 +180,7 @@ static const Ports voicePorts = {
"Modulator Amplitude Envelope"),
+
//weird stuff for PCoarseDetune
{"detunevalue:", rMap(unit,cents) rDoc("Get detune in cents"), NULL,
[](const char *, RtData &d)
@@ -315,10 +316,21 @@ static const Ports globalPorts = {
//Amplitude
rParamZyn(PPanning, rShort("pan"), rDefault(64),
"Panning of ADsynth (0 random, 1 left, 127 right)"),
- rParamZyn(PVolume, rShort("vol"), rDefault(90), "volume control"),
+ rParamF(Volume, rShort("vol"), rLinear(0.0, 100.0),
+ rDefault(70.87), "volume control"),
rParamZyn(PAmpVelocityScaleFunction, rShort("sense"), rDefault(64),
"Volume velocity sense"),
-
+ {"PVolume::i", rShort("vol.") rLinear(0,127)
+ rDoc("Volume"), NULL,
+ [](const char *msg, RtData &d)
+ {
+ rObject *obj = (rObject *)d.obj;
+ if (!rtosc_narguments(msg))
+ d.reply(d.loc, "i", (int)roundf(127.0f * obj->Volume
+ / 100.0f));
+ else
+ obj->Volume = 100.0f * rtosc_argument(msg, 0).i / 127.0f;
+ }},
rParamZyn(Fadein_adjustment, rDefault(FADEIN_ADJUSTMENT_SCALE),
"Adjustment for anti-pop strategy."),
rParamZyn(PPunchStrength, rShort("strength"), rDefault(0),
@@ -460,7 +472,7 @@ void ADnoteGlobalParam::defaults()
PBandwidth = 64;
/* Amplitude Global Parameters */
- PVolume = 90;
+ Volume = 70.87;
PPanning = 64; //center
PAmpVelocityScaleFunction = 64;
AmpEnvelope->defaults();
@@ -839,7 +851,7 @@ void ADnoteGlobalParam::add2XML(XMLwrapper& xml)
xml.addparbool("stereo", PStereo);
xml.beginbranch("AMPLITUDE_PARAMETERS");
- xml.addpar("volume", PVolume);
+ xml.addparreal("volume", Volume);
xml.addpar("panning", PPanning);
xml.addpar("velocity_sensing", PAmpVelocityScaleFunction);
xml.addpar("fadein_adjustment", Fadein_adjustment);
@@ -914,7 +926,15 @@ void ADnoteGlobalParam::getfromXML(XMLwrapper& xml)
PStereo = xml.getparbool("stereo", PStereo);
if(xml.enterbranch("AMPLITUDE_PARAMETERS")) {
- PVolume = xml.getpar127("volume", PVolume);
+ const bool upgrade_3_0_3 = (xml.fileversion() < version_type(3,0,3)) ||
+ (xml.getparreal("volume", -1) < 0);
+
+ if (upgrade_3_0_3) {
+ int vol = xml.getpar127("volume", 0);
+ Volume = 100.0f * vol / 127.0f;
+ } else {
+ Volume = xml.getparreal("volume", Volume);
+ }
PPanning = xml.getpar127("panning", PPanning);
PAmpVelocityScaleFunction = xml.getpar127("velocity_sensing",
PAmpVelocityScaleFunction);
@@ -1127,7 +1147,7 @@ void ADnoteGlobalParam::paste(ADnoteGlobalParam &a)
{
copy(PStereo);
- copy(PVolume);
+ copy(Volume);
copy(PPanning);
copy(PAmpVelocityScaleFunction);
diff --git a/src/Params/ADnoteParameters.h b/src/Params/ADnoteParameters.h
@@ -64,7 +64,7 @@ struct ADnoteGlobalParam {
127 - right */
unsigned char PPanning;
- unsigned char PVolume;
+ float Volume;
unsigned char PAmpVelocityScaleFunction;
diff --git a/src/Synth/ADnote.cpp b/src/Synth/ADnote.cpp
@@ -670,8 +670,8 @@ void ADnote::legatonote(LegatoParams lpars)
NoteGlobalPar.Volume = 4.0f
* powf(0.1f, 3.0f
- * (1.0f - pars.GlobalPar.PVolume
- / 96.0f)) //-60 dB .. 0 dB
+ * (1.0f - pars.GlobalPar.Volume
+ / 75.0f)) //-60 dB .. 0 dB
* VelF(
velocity,
pars.GlobalPar.PAmpVelocityScaleFunction); //velocity sensing
@@ -1977,7 +1977,7 @@ void ADnote::Global::initparameters(const ADnoteGlobalParam ¶m,
AmpLfo = memory.alloc<LFO>(*param.AmpLfo, basefreq, time, wm,
(pre+"GlobalPar/AmpLfo/").c_str);
- Volume = 4.0f * powf(0.1f, 3.0f * (1.0f - param.PVolume / 96.0f)) //-60 dB .. 0 dB
+ Volume = 4.0f * powf(0.1f, 3.0f * (1.0f - param.Volume / 75.0f)) //-60 dB .. 0 dB
* VelF(velocity, param.PAmpVelocityScaleFunction); //sensing
Filter = memory.alloc<ModFilter>(*param.GlobalFilter, synth, time, memory,