summaryrefslogtreecommitdiff
path: root/drumgizmo
diff options
context:
space:
mode:
authorVolker Fischer <corrados@users.noreply.github.com>2021-04-24 20:31:53 +0200
committerVolker Fischer <corrados@users.noreply.github.com>2021-04-24 20:31:53 +0200
commitd605a7a9166dce74aa17d33da92e11ca9b467e55 (patch)
tree5067829181be0a1d1d051ac8e0fbc46a9b6f001d /drumgizmo
parent28096a402947b05c7e923e075f926263a3279a42 (diff)
added voice limit cli parameters
Diffstat (limited to 'drumgizmo')
-rw-r--r--drumgizmo/drumgizmoc.cc54
1 files changed, 54 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.",
[&]()