diff options
-rw-r--r-- | drumgizmo/drumgizmoc.cc | 54 | ||||
-rw-r--r-- | man/drumgizmo.1 | 17 |
2 files changed, 71 insertions, 0 deletions
diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc index cec96f7..8eba4c9 100644 --- a/drumgizmo/drumgizmoc.cc +++ b/drumgizmo/drumgizmoc.cc @@ -142,6 +142,12 @@ static std::string arguments() " diverse: The importance given to choosing samples\n" " which haven't been played recently. [0,1]\n" " random: The amount of randomness added. [0,1]\n" + "\n" + "Voice limit parameters:\n" + " max: Maximum number of voices for each instrument before\n" + " old samples are ramped down. [1,30]\n" + " rampdown: Time it takes for an old sample to completely fall\n" + " silent. [0.01,2.0]\n" "\n"; return output.str(); } @@ -545,6 +551,54 @@ int main(int argc, char* argv[]) return 0; }); + // Default is to disable voice limit + settings.enable_voice_limit.store(false); + + opt.add("voice-limit", no_argument, 'l', + "Enable voice limit.", + [&]() + { + settings.enable_voice_limit.store(true); + return 0; + }); + + opt.add("voice-limitparms", required_argument, 'L', + "Voice limit options.", + [&]() + { + std::string parms = optarg; + auto tokens = parseParameters(parms); + for(auto& token : tokens) + { + if(token.key == "max") + { + auto val = atof_nol(token.value.data()); + if(val < 1.0 || val > 30.0) + { + std::cerr << "max range is [1, 30].\n"; + return 1; + } + settings.voice_limit_max.store(val); + } + else if(token.key == "rampdown") + { + auto val = atof_nol(token.value.data()); + if(val < 0.01 || val > 2.0) + { + std::cerr << "rampdown range is [0.01, 2.0].\n"; + return 1; + } + settings.voice_limit_rampdown.store(val); + } + else + { + std::cerr << "Unknown voice limitparms argument " << token.key << std::endl; + return 1; + } + } + return 0; + }); + opt.add("parameters", required_argument, 'p', "Parameters for sample selection algorithm.", [&]() diff --git a/man/drumgizmo.1 b/man/drumgizmo.1 index ac8628e..43b0a29 100644 --- a/man/drumgizmo.1 +++ b/man/drumgizmo.1 @@ -176,6 +176,23 @@ Higher value makes it more likely that a sample further away from the input velocity will be played. [0,4.5]) .RE +\fB-l, --voice-limit\fR +.RS 7 +Enable voice limit. + +.RE +\fB-L, --voice-limitparms parmlist\fR +.RS 7 +Voice limit options. + +.P +\fBmax\fR=<val> (Maximum number of voices for each instrument before +old samples are ramped down. [1,30]) +.P +\fBrampdown\fR=<val> (Time it takes for an old sample to completely fall +silent. [0.01,2.0]) + +.RE \fB-p, --parameters parmlist\fR .RS 7 Parameters for the sample selection algorithm. |