From a43a4e27a2ba3c34bac5a215ce49175b22913bd4 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Wed, 12 Jan 2011 17:57:48 +0100 Subject: Extended in-synth-cli Many commands are now available, like changing program, controllers, panicking, killing single programs, setting pedals, setting voice limit etc... Also, added Channel::set_portamento_time_sec(float sec) --- TODO | 2 + TODO.done | 1 + synth/channel.cpp | 7 +- synth/channel.h | 1 + synth/in_synth_cli.cpp | 362 ++++++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 368 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index dc5be07..5b3b81c 100644 --- a/TODO +++ b/TODO @@ -4,6 +4,8 @@ TODO für den synth o zu testen: funktionieren no-release-envs auch in compilierten noten? + o funktioniert Channel::release_all bei gedrücktem HOLD oder SOSTENUTO? + o on-the-fly die LFOs ändern (frequenz, wellenform) o RAM aufräumen? diff --git a/TODO.done b/TODO.done index f70572a..2250370 100644 --- a/TODO.done +++ b/TODO.done @@ -88,6 +88,7 @@ TODO fürs CLI x envelope_update_frames per CLI setzen x .so unloaden! * lfo-maxima getrennt regeln. [abgelehnt] + x on-the-fly panic, einzelne channels, einzelne instrumente, etc TODO für den compiler diff --git a/synth/channel.cpp b/synth/channel.cpp index 8ff615e..c2d0793 100644 --- a/synth/channel.cpp +++ b/synth/channel.cpp @@ -345,7 +345,12 @@ void Channel::set_portamento(int val) void Channel::set_portamento_time(int val) { - portamento_frames2=samp_rate*val*max_port_time_sec/128; + set_portamento_time_sec(val*max_port_time_sec/128.0); +} + +void Channel::set_portamento_time_sec(float val) +{ + portamento_frames2=samp_rate*val; if (do_portamento) set_real_portamento_frames(); } diff --git a/synth/channel.h b/synth/channel.h index 826d752..4535934 100644 --- a/synth/channel.h +++ b/synth/channel.h @@ -32,6 +32,7 @@ class Channel void maybe_reload_program(int prog); void set_real_portamento_frames(); void set_portamento_time(int val); + void set_portamento_time_sec(float val); void set_portamento(int val); void set_volume(int val); void set_balance(int val); diff --git a/synth/in_synth_cli.cpp b/synth/in_synth_cli.cpp index 5bc071f..dd9260f 100644 --- a/synth/in_synth_cli.cpp +++ b/synth/in_synth_cli.cpp @@ -94,8 +94,13 @@ void do_in_synth_cli() cout << "error: expected program-number, found '"<=0) && (num<128)) + { + num=atoi(params.c_str()); + lock_and_load_program(num, programfile[num]); + } + else + cout << "error: program-number must be one of 0..127" << endl; } } else if (command=="load") @@ -111,9 +116,358 @@ void do_in_synth_cli() else { num=atoi(params.c_str()); - lock_and_load_program(num, file); + if ((num>=0) && (num<128)) + { + lock_and_load_program(num, file); + programfile[num]=file; + } + else + cout << "error: program-number must be one of 0..127" << endl; + } + } + else if (command=="panic") + { + if ((params=="") || (params=="all")) + for (int i=0;ipanic(); + else if (isnum(params)) + { + num=atoi(params.c_str()); + if ((num>=0) && (numpanic(); + else + cout << "error: channel-number must be one of 0.."<release_all(); + else if (isnum(params)) + { + num=atoi(params.c_str()); + if ((num>=0) && (numrelease_all(); + else + cout << "error: channel-number must be one of 0.."<=0) && (num<128)) + { + if (chanstr=="") + for (int i=0;ikill_program(num); + else + { + int num2=atoi(chanstr.c_str()); + if ((num2>=0)&&(num2kill_program(num); + else + cout << "error: channel-number must be one of 0.."<=0) && (num=0) + channel[num]->set_n_voices(num2); + else + cout << "error: limit must be a positive number, zero or 'all'"<reset_controllers(); + else if (isnum(params)) + { + num=atoi(params.c_str()); + if ((num>=0) && (numreset_controllers(); + else + cout << "error: channel-number must be one of 0.."<=0) && (num=0) && (num2<128)) + channel[num]->set_program(num2); + else + cout << "error: program must be one of 0..127"<=0) && (num=0) && (num2<128))) + cout << "error: controller must be one of 0..127"<=0) && (val<128))) + cout << "error: value must be one of 0..127"<set_controller(num2,val); + } + else + cout << "error: channel-number must be one of 0.."<=0) && (num=0) + channel[num]->set_portamento_time_sec(num2); + else + cout << "error: portamento time must be positive"<=0) && (numset_portamento(127); + else //off + channel[num]->set_portamento(0); + } + else + cout << "error: channel-number must be one of 0.."<=0) && (num=0) && (num2<128)) + channel[num]->set_volume(num2); + else + cout << "error: volume must be one of 0..127"<=0) && (num=0) && (num2<128)) + channel[num]->set_balance(num2); + else + cout << "error: balance must be one of 0..127"<=0) && (numset_hold_pedal(onstr=="on"); + else + cout << "error: channel-number must be one of 0.."<=0) && (numset_sostenuto_pedal(onstr=="on"); + else + cout << "error: channel-number must be one of 0.."<=0) && (numset_soft_pedal(onstr=="on"); + else + cout << "error: channel-number must be one of 0.."<=0) && (numset_legato_pedal(onstr=="on"); + else + cout << "error: channel-number must be one of 0.."<