summaryrefslogtreecommitdiff
path: root/src/dssi-render.c
diff options
context:
space:
mode:
authorpepper <peppersclothescult@gmail.com>2015-01-29 23:17:32 -0800
committerpepper <peppersclothescult@gmail.com>2015-01-29 23:17:32 -0800
commit3b1f919e65c4c88d0d760121d61456eb68dc79b6 (patch)
tree32f23a64ef33a41011fd857f5bf50021bbd768b3 /src/dssi-render.c
parentaa2d7c0ec0a0c69dcf41993bf8bae9c2c97cea9d (diff)
still working out issues, fixed some cli things
Diffstat (limited to 'src/dssi-render.c')
-rw-r--r--src/dssi-render.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/dssi-render.c b/src/dssi-render.c
index feec1f2..c4b560f 100644
--- a/src/dssi-render.c
+++ b/src/dssi-render.c
@@ -4,6 +4,8 @@
#include "ladspa_run_synth.h"
#include "midi/midi_loader.h"
+#define DEBUG 1
+
void
print_usage(void) {
fprintf(stderr, "Render a midi file with a DSSI instrument.\n");
@@ -21,11 +23,17 @@ print_usage(void) {
fprintf(stderr, " [-b] (clip out-of-bounds values, including Inf and NaN, to within bounds\n (calls exit()) if -b is omitted)\n");
exit(1);
}
+
+int file_exist (char *filename)
+{
+ struct stat buffer;
+ return (stat (filename, &buffer) == 0);
+}
const DSSI_Descriptor *descriptor;
LADSPA_Handle instanceHandle;
SNDFILE *outfile;
-char *output_file = "output.wav";
+char *output_file = "output.wav"; //ask anton...needs malloc?
char *midi_filename = "test.mid";
int clip = 0;
int have_warned = 0;
@@ -171,6 +179,16 @@ main(int argc, char **argv) {
}
}
+ //make sure input and output exist
+ if(!file_exist(midi_filename)){
+ fprintf(stderr, "ERROR:Could not find %s\n Please specify an input file with -i\n", midi_filename);
+ exit(1);
+ }
+ if(!file_exist(output_file)){
+ fprintf(stderr, "ERROR:Could not find %s\n Please specify an output file with -o\n", output_file);
+ exit(1);
+ }
+
if (DEBUG) {
for (int i = 0; i < nkeys; i++) {
printf("key %d: %s; value: %s\n", i, configure_key[i],
@@ -357,8 +375,7 @@ main(int argc, char **argv) {
pluginControlIns[controlIn] = def;
}
if (DEBUG) {
- fprintf(stderr,
- "port %3d; prhd %3d; lb %6.2f; ub %6.2f; val %6.2f (%s)\n",
+ fprintf(stderr, "port %3d; prhd %3d; lb %6.2f; ub %6.2f; val %6.2f (%s)\n",
j, prhd, lb, ub, val, pname);
}
controlIn++;
@@ -394,6 +411,7 @@ main(int argc, char **argv) {
"%s: Warning: plugin doesn't like "
"configure key-value pair: \"%s\"\n",
my_name, rv);
+ exit(1);
}
}
}