diff options
author | Florian Jung <flo@thinkpad.(none)> | 2011-02-10 18:15:12 +0100 |
---|---|---|
committer | Florian Jung <flo@thinkpad.(none)> | 2011-02-10 18:15:12 +0100 |
commit | 67ec646a42b8b9e851c693effbdce18327b67501 (patch) | |
tree | 0a737f17ea13e1c986aba6e4a6004e0a8805b35c | |
parent | df131ea4f913fea43c266517a154caa08ff9b088 (diff) |
Added help text
-rw-r--r-- | synth/.depend | 12 | ||||
-rw-r--r-- | synth/Makefile | 5 | ||||
-rw-r--r-- | synth/cli.cpp | 21 | ||||
-rw-r--r-- | synth/helpstring.h | 35 | ||||
-rw-r--r-- | synth/helpstring.txt | 33 | ||||
-rwxr-xr-x | synth/text_to_h.sh | 1 |
6 files changed, 95 insertions, 12 deletions
diff --git a/synth/.depend b/synth/.depend index ba430bb..1739b5d 100644 --- a/synth/.depend +++ b/synth/.depend @@ -1,7 +1,7 @@ channel.o: channel.cpp channel.h fixed.h programs.h note_funcs.h \ note_skel.h defines.h util.h globals.h note.h envelope.h filter.h cli.o: cli.cpp util.h programs.h fixed.h note_funcs.h globals.h channel.h \ - note_skel.h defines.h load.h + note_skel.h defines.h load.h helpstring.h defines.o: defines.cpp defines.h envelope.o: envelope.cpp envelope.h programs.h fixed.h note_funcs.h filter.o: filter.cpp filter.h fixed.h defines.h globals.h programs.h \ @@ -9,12 +9,12 @@ filter.o: filter.cpp filter.h fixed.h defines.h globals.h programs.h \ globals.o: globals.cpp globals.h programs.h fixed.h note_funcs.h \ channel.h note_skel.h defines.h util.h jack.o: jack.cpp defines.h globals.h programs.h fixed.h note_funcs.h \ - channel.h note_skel.h util.h jack.h communication.h + channel.h note_skel.h util.h jack.h communication.h lfos.h load.o: load.cpp util.h programs.h fixed.h note_funcs.h globals.h \ channel.h note_skel.h defines.h parser.h note_loader.h main.o: main.cpp jack.h load.h programs.h fixed.h note_funcs.h cli.h \ channel.h note_skel.h defines.h util.h globals.h in_synth_cli.h \ - communication.h note_loader.h + communication.h note_loader.h lfos.h watch_files.h note.o: note.cpp note.h programs.h fixed.h note_funcs.h envelope.h \ filter.h note_skel.h globals.h channel.h defines.h util.h note_skel.o: note_skel.cpp note_skel.h programs.h fixed.h note_funcs.h \ @@ -32,7 +32,11 @@ note_loader.o: note_loader.cpp note_loader.h programs.h fixed.h \ shared_object_manager.h in_synth_cli.o: in_synth_cli.cpp in_synth_cli.h util.h programs.h fixed.h \ note_funcs.h communication.h globals.h channel.h note_skel.h defines.h \ - load.h + load.h lfos.h watch_files.h communication.o: communication.cpp communication.h shared_object_manager.o: shared_object_manager.cpp util.h programs.h \ fixed.h note_funcs.h shared_object_manager.h +lfos.o: lfos.cpp lfos.h globals.h programs.h fixed.h note_funcs.h \ + channel.h note_skel.h defines.h util.h +watch_files.o: watch_files.cpp watch_files.h util.h programs.h fixed.h \ + note_funcs.h globals.h channel.h note_skel.h defines.h in_synth_cli.h diff --git a/synth/Makefile b/synth/Makefile index 39b6e80..e19546f 100644 --- a/synth/Makefile +++ b/synth/Makefile @@ -27,6 +27,11 @@ depend dep: $(SRC) %.o: %.cpp $(CXX) $(CXXFLAGS) -c $< +helpstring.h: helpstring.txt + echo '#define HELPSTRING \' > helpstring.h && \ + cat helpstring.txt | ./text_to_h.sh >> helpstring.h \ + || rm helpstring.h + .PHONY: clean dep depend clean: diff --git a/synth/cli.cpp b/synth/cli.cpp index 4d5cc2f..09c3ff3 100644 --- a/synth/cli.cpp +++ b/synth/cli.cpp @@ -5,17 +5,20 @@ #include "util.h" #include "globals.h" #include "load.h" +#include "helpstring.h" using namespace std; +#define VERSION "1.0" + void show_help() { - cout << "TODO: help text" << endl; + cout << HELPSTRING <<endl; } void show_version() { - cout << "TODO: softsynth version foo" << endl; + cout << "flo's synth version "VERSION << endl; // TODO } void parse_args(int argc, char** argv) @@ -86,12 +89,14 @@ void parse_args(int argc, char** argv) size_t pos=stropt.find(':'); if (pos==string::npos) output_warning("expected 'n_xruns:time' in --xruns option, found no ':'"); - - xrun_n=atoi(stropt.substr(0,pos).c_str()); - xrun_time=atof(stropt.substr(pos+1).c_str()); - - if (xrun_n<=0) xrun_n=0; - if (xrun_time<=0) xrun_time=0; + else + { + xrun_n=atoi(stropt.substr(0,pos).c_str()); + xrun_time=atof(stropt.substr(pos+1).c_str()); + + if (xrun_n<=0) xrun_n=0; + if (xrun_time<=0) xrun_time=0; + } } break; case 'd': add_dir(optarg); break; diff --git a/synth/helpstring.h b/synth/helpstring.h new file mode 100644 index 0000000..4c49da5 --- /dev/null +++ b/synth/helpstring.h @@ -0,0 +1,35 @@ +#define HELPSTRING \ +"Usage: ./synth [OPTIONS]\n"\ +" -h show this help text\n"\ +" -V show the version number\n"\ +"\n"\ +" -v be verbose\n"\ +" -q be quiet\n"\ +" -F --fatal-warnings make warnings fatal\n"\ +"\n"\ +" -c --conf(ig) FILE load the given config file\n"\ +" -d --dir(ectory) DIR read that directory\n"\ +" -p --program N:FILE load FILE at program number N\n"\ +"\n"\ +" -f --frameskip N only do every Nth frame\n"\ +" -x --xruns N:T kill all voices when N xruns or more \n"\ +" happen in T seconds\n"\ +"\n"\ +" --filter-update-freq FREQ how often the filter settings, the lfo-\n"\ +" --lfo-update-freq FREQ or envelope-current-values get updated\n"\ +" --env(elope)-update-freq FREQ (low -> less accurate, but faster)\n"\ +" -i --cleanup-interval N try cleaning up notes every N seconds\n"\ +"\n"\ +" --lfoN-freq --snh-freq set frequency for lfos or the sample-and-\n"\ +" --sample-and-hold-freq hold-generator\n"\ +" --max-port TIME set the maximum settable portamento time\n"\ +" --max-port(amento)-time (a MIDI value of 127 corresponds to this)\n"\ +"\n"\ +" -a --{no|dont}-connect- don't automatically connect the output\n"\ +" audio(-out) ports to the speakers\n"\ +" -m --{no|dont}-connect- don't automatically connect the output\n"\ +" midi(-in) ports to midi devices\n"\ +"\n"\ +" -w --{no|dont}-watch- turn off watching files for changes\n"\ +" files \n"\ +"" diff --git a/synth/helpstring.txt b/synth/helpstring.txt new file mode 100644 index 0000000..0c546a4 --- /dev/null +++ b/synth/helpstring.txt @@ -0,0 +1,33 @@ +Usage: ./synth [OPTIONS] + -h show this help text + -V show the version number + + -v be verbose + -q be quiet + -F --fatal-warnings make warnings fatal + + -c --conf(ig) FILE load the given config file + -d --dir(ectory) DIR read that directory + -p --program N:FILE load FILE at program number N + + -f --frameskip N only do every Nth frame + -x --xruns N:T kill all voices when N xruns or more + happen in T seconds + + -i --cleanup-interval N try cleaning up notes every N seconds + --filter-update-freq FREQ how often the filter settings, the lfo- + --lfo-update-freq FREQ or envelope-current-values get updated + --env(elope)-update-freq FREQ (low -> less accurate, but faster) + + --lfoN-freq --snh-freq set frequency for lfos or the sample-and- + --sample-and-hold-freq hold-generator + --max-port TIME set the maximum settable portamento time + --max-port(amento)-time (a MIDI value of 127 corresponds to this) + + -a --{no|dont}-connect- don't automatically connect the output + audio(-out) ports to the speakers + -m --{no|dont}-connect- don't automatically connect the output + midi(-in) ports to midi devices + + -w --{no|dont}-watch- turn off watching files for changes + files diff --git a/synth/text_to_h.sh b/synth/text_to_h.sh new file mode 100755 index 0000000..86ed89b --- /dev/null +++ b/synth/text_to_h.sh @@ -0,0 +1 @@ +sed -e 's,\\,\\\\,g' | sed -e 's,",\\",g' | sed -e 's,^\(.*\)$,"\1\\n"\\,' && echo '""' |