mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Implement control for pitch
This commit is contained in:
parent
9dd2b16fe9
commit
356af928ac
@ -460,6 +460,16 @@ class Synthesizer {
|
||||
synth.Options().SpeakingRate(val);
|
||||
}
|
||||
|
||||
double pitch() const {
|
||||
return synth.Options().AudioPitch();
|
||||
}
|
||||
|
||||
void pitch(double val) {
|
||||
if (val < 0 || val > 2) throw std::out_of_range("Invalid pitch value must be between 0 and 2");
|
||||
std::scoped_lock sl(recursive_lock);
|
||||
synth.Options().AudioPitch(val);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
@ -811,6 +821,13 @@ handle_stdin_message(winrt::hstring const &&msg) {
|
||||
}
|
||||
output(cmd_id, "rate", {{"value", sx.rate()}});
|
||||
}
|
||||
else if (command == L"pitch") {
|
||||
if (parts.size()) {
|
||||
auto rate = parse_double(parts[0].data());
|
||||
sx.rate(rate);
|
||||
}
|
||||
output(cmd_id, "pitch", {{"pitch", sx.rate()}});
|
||||
}
|
||||
else if (command == L"save") {
|
||||
handle_save(cmd_id, parts);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user