summaryrefslogtreecommitdiff
path: root/synth
diff options
context:
space:
mode:
Diffstat (limited to 'synth')
-rw-r--r--synth/cli.cpp15
-rw-r--r--synth/defines.h2
-rw-r--r--synth/globals.cpp2
-rw-r--r--synth/globals.h2
-rw-r--r--synth/helpfile.txt29
-rw-r--r--synth/in_synth_cli.cpp13
-rw-r--r--synth/load.cpp18
-rw-r--r--synth/main.cpp32
-rw-r--r--synth/watch_files.cpp5
-rw-r--r--synth/watch_files.h5
10 files changed, 103 insertions, 20 deletions
diff --git a/synth/cli.cpp b/synth/cli.cpp
index 09c3ff3..07eabfc 100644
--- a/synth/cli.cpp
+++ b/synth/cli.cpp
@@ -79,8 +79,12 @@ void parse_args(int argc, char** argv)
case 'm': connect_midi=false; break;
case 'f': if (optarg)
{
- frameskip=atoi(optarg);
- if (frameskip<=0) frameskip=0;
+ #ifdef FRAMESKIP
+ frameskip=atoi(optarg);
+ if (frameskip<=0) frameskip=0;
+ #else
+ output_warning("WARNING: support for frameskipping isn't compiled in!");
+ #endif
}
break;
case 'x': if (optarg)
@@ -138,7 +142,12 @@ void parse_args(int argc, char** argv)
else
output_warning("WARNING: not a number in --interval option. ignoring it...");
break;
- case 'w': watchfiles=false;
+ case 'w':
+ #ifdef WATCH_FILES
+ watchfiles=false;
+ #else
+ output_note("NOTE: support for watching files isn't compiled in, so you can't disable it");
+ #endif
break;
case 304: if (isfloat(optarg))
snh_freq_hz=atof(optarg);
diff --git a/synth/defines.h b/synth/defines.h
index 1ec5b18..354e683 100644
--- a/synth/defines.h
+++ b/synth/defines.h
@@ -1,6 +1,8 @@
#ifndef __DEFINES_H__
#define __DEFINES_H__
+#define WATCHFILES //undef if you don't want support for it
+
#define XRUN_TIME 2.0
#define XRUN_N 8
diff --git a/synth/globals.cpp b/synth/globals.cpp
index 8cde306..e943ff1 100644
--- a/synth/globals.cpp
+++ b/synth/globals.cpp
@@ -18,7 +18,9 @@ bool quiet=false;
bool connect_audio=true, connect_midi=true;
+#ifdef WATCHFILES
bool watchfiles=true;
+#endif
float cleanup_interval_sec=0;
float snh_freq_hz=0;
diff --git a/synth/globals.h b/synth/globals.h
index bccacdf..78c6e74 100644
--- a/synth/globals.h
+++ b/synth/globals.h
@@ -29,7 +29,9 @@ extern bool quiet;
extern bool connect_audio, connect_midi;
+#ifdef WATCHFILES
extern bool watchfiles;
+#endif
extern float cleanup_interval_sec;
extern float snh_freq_hz;
diff --git a/synth/helpfile.txt b/synth/helpfile.txt
new file mode 100644
index 0000000..8ee1c01
--- /dev/null
+++ b/synth/helpfile.txt
@@ -0,0 +1,29 @@
+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
+-f --frameskip N only do every Nth frame
+ only available if support is compiled in,
+ otherwise it's turned off by default
+-x --xruns N:T kill all voices when N xruns occur in T seconds
+-d --dir(ectory) DIR read that directory
+-w --{no|dont}-watch-files turn off watching files for changes
+ only available if support is compiled in,
+ otherwise it's turned off by default
+-p --program N:FILE load FILE at program number N
+-i --cleanup-interval N try cleaning up notes every N seconds
+--lfoN-freq --snh-freq set frequency for lfos or the sample-and-hold
+ --sample-and-hold-freq generator
+-c --conf(ig) FILE load the given config file
+--max-port TIME set the maximum settable portamento time
+ --max-port(amento)-time (a MIDI value of 127 corresponds to this)
+--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)
+-a don't automatically connect the output
+ --{no|dont}-connect-audio(-out) ports to the speakers
+-m don't automatically connect the output
+ --{no|dont}-connect-midi(-in) ports to midi devices
diff --git a/synth/in_synth_cli.cpp b/synth/in_synth_cli.cpp
index fc24b03..4d4ef76 100644
--- a/synth/in_synth_cli.cpp
+++ b/synth/in_synth_cli.cpp
@@ -10,7 +10,10 @@
#include "globals.h"
#include "load.h"
#include "lfos.h"
-#include "watch_files.h"
+
+#ifdef WATCHFILES
+ #include "watch_files.h"
+#endif
using namespace std;
@@ -54,7 +57,9 @@ void lock_and_load_program(int prg_no, string file)
{
pthread_mutex_lock(&prog_load_mutex);
- remove_watch(prg_no);
+ #ifdef WATCHFILES
+ remove_watch(prg_no);
+ #endif
do_request(prg_no, true);
@@ -63,7 +68,9 @@ void lock_and_load_program(int prg_no, string file)
cout << "success" << endl;
programfile[prg_no]=file;
- add_watch(prg_no);
+ #ifdef WATCHFILES
+ add_watch(prg_no);
+ #endif
}
else
cout << "failed" << endl;
diff --git a/synth/load.cpp b/synth/load.cpp
index b60c535..e411750 100644
--- a/synth/load.cpp
+++ b/synth/load.cpp
@@ -109,13 +109,17 @@ void read_config(const char *cfg, bool complain=true)
if (var=="frameskip")
{
- if (valf<0)
- output_warning("WARNING: invalid value for '"+var+"' ("+val+"). ignoring it...");
-
- if (frameskip==-1)
- frameskip=valf;
- else
- output_verbose("NOTE: ignoring value for frameskip, another setting overrides this.");
+ #ifdef FRAMESKIP
+ if (valf<0)
+ output_warning("WARNING: invalid value for '"+var+"' ("+val+"). ignoring it...");
+
+ if (frameskip==-1)
+ frameskip=valf;
+ else
+ output_verbose("NOTE: ignoring value for frameskip, another setting overrides this.");
+ #else
+ output_warning("WARNING: while parsing conf: support for frameskipping isn't compiled in!");
+ #endif
}
else
{
diff --git a/synth/main.cpp b/synth/main.cpp
index f9f1e57..95a6a7b 100644
--- a/synth/main.cpp
+++ b/synth/main.cpp
@@ -16,7 +16,10 @@
#include "communication.h"
#include "note_loader.h"
#include "lfos.h"
-#include "watch_files.h"
+
+#ifdef WATCHFILES
+ #include "watch_files.h"
+#endif
using namespace std;
@@ -24,7 +27,9 @@ using namespace std;
void cleanup();
void dump_options();
-pthread_t watcher_thread=-1;
+#ifdef WATCHFILES
+ pthread_t watcher_thread=-1;
+#endif
int main(int argc, char** argv)
{
@@ -45,7 +50,9 @@ int main(int argc, char** argv)
if (lfo_freq_hz[i]<=0) lfo_freq_hz[i]=LFO_FREQ_HZ[i];
if (snh_freq_hz<=0) snh_freq_hz=SNH_FREQ_HZ;
- if (frameskip<=-1) frameskip=0;
+ #ifdef FRAMESKIP
+ if (frameskip<=-1) frameskip=0;
+ #endif
if (max_port_time_sec<=0) max_port_time_sec=MAX_PORTAMENTO_TIME;
if (filter_update_freq_hz<=0) filter_update_freq_hz=FILTER_UPDATE_FREQ_HZ;
if (lfo_update_freq_hz<=0) lfo_update_freq_hz=LFO_UPDATE_FREQ_HZ;
@@ -55,8 +62,10 @@ int main(int argc, char** argv)
dump_options();
- frameskip+=1; //because a value of 0 means using each frame,
- //a value of 1 means using each 2nd frame and so on
+ #ifdef FRAMESKIP
+ frameskip+=1; //because a value of 0 means using each frame,
+ //a value of 1 means using each 2nd frame and so on
+ #endif
init_jack();
@@ -167,7 +176,8 @@ int main(int argc, char** argv)
srand (time(NULL));
start_jack(connect_audio, connect_midi);
-
+
+#ifdef WATCHFILES
if (watchfiles)
{
if (pthread_create(&watcher_thread, NULL, watch_files, NULL) != 0)
@@ -182,6 +192,10 @@ int main(int argc, char** argv)
output_note("NOTE: you disabled the watching of files. you must inform me about\n"
" updated files manually.");
}
+#else
+ output_verbose("NOTE: support for watching of files isn't compiled in. you must\n"
+ " inform me about updated files manually.");
+#endif
do_in_synth_cli();
@@ -200,6 +214,7 @@ int main(int argc, char** argv)
void cleanup()
{
+#ifdef WATCHFILES
if (watcher_thread!=-1)
{
if (pthread_cancel(watcher_thread) != 0)
@@ -211,6 +226,7 @@ void cleanup()
pthread_join(watcher_thread,NULL);
}
}
+#endif
exit_jack();
@@ -236,7 +252,9 @@ void dump_options()
cout << endl;
- cout << "frameskip:\t\t"<<frameskip<<endl;
+ #ifdef FRAMESKIP
+ cout << "frameskip:\t\t"<<frameskip<<endl;
+ #endif
cout << "cleanup-interval:\t"<<cleanup_interval_sec<<endl;
for (int i=0;i<N_LFOS;++i)
cout << "lfo"<<i<<" freq:\t\t"<<lfo_freq_hz[i]<<endl;
diff --git a/synth/watch_files.cpp b/synth/watch_files.cpp
index ce80224..3ea830a 100644
--- a/synth/watch_files.cpp
+++ b/synth/watch_files.cpp
@@ -1,3 +1,6 @@
+#include "defines.h"
+#ifdef WATCHFILES
+
#include <iostream>
#include <pthread.h>
#include <unistd.h>
@@ -158,3 +161,5 @@ void add_watch(int prog)
pthread_mutex_unlock(&inotify_map_mutex);
}
}
+
+#endif
diff --git a/synth/watch_files.h b/synth/watch_files.h
index b9c7d2d..37ecf0a 100644
--- a/synth/watch_files.h
+++ b/synth/watch_files.h
@@ -1,3 +1,6 @@
+#include "defines.h"
+#ifdef WATCHFILES
+
#ifndef __WATCH_FILES_H__
#define __WATCH_FILES_H__
@@ -7,3 +10,5 @@ void add_watch(int prog);
void remove_watch(int prog);
#endif
+
+#endif