aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--COPYING2
-rw-r--r--NEWS6
-rw-r--r--src/jalv.c19
-rw-r--r--src/jalv_internal.h12
-rw-r--r--src/log.c27
-rw-r--r--wscript2
6 files changed, 52 insertions, 16 deletions
diff --git a/COPYING b/COPYING
index e1e203d..211c098 100644
--- a/COPYING
+++ b/COPYING
@@ -1,4 +1,4 @@
-Copyright 2011-2014 David Robillard <http://drobilla.net>
+Copyright 2011-2016 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
diff --git a/NEWS b/NEWS
index 378e45b..24d4d03 100644
--- a/NEWS
+++ b/NEWS
@@ -8,8 +8,8 @@ jalv (1.4.7) unstable;
* Set Jack port order metadata
* Allow Jack client name to be set from command line (thanks Adam Avramov)
* Add command prompt to console version for changing controls
- * Add option to enable plugin trace log messages
- * Colorize communication dump if output is a console
+ * Add option to print plugin trace messages
+ * Print colorful log if output is a terminal
* Exit on Jack shutdown (patch from Robin Gareus)
* Report Jack latency (patch from Robin Gareus)
* Exit GUI versions on interrupt
@@ -17,7 +17,7 @@ jalv (1.4.7) unstable;
* Use moc-qt4 if present for systems with multiple Qt versions
* Add Qt5 version
- -- David Robillard <d@drobilla.net> Sat, 09 Jul 2016 20:38:45 -0400
+ -- David Robillard <d@drobilla.net> Sun, 31 Jul 2016 01:12:15 -0400
jalv (1.4.6) stable;
diff --git a/src/jalv.c b/src/jalv.c
index fa08e64..5d43691 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2015 David Robillard <http://drobilla.net>
+ Copyright 2007-2016 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -73,6 +73,7 @@
#include "worker.h"
#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+#define NS_XSD "http://www.w3.org/2001/XMLSchema#"
#ifndef MIN
# define MIN(a, b) (((a) < (b)) ? (a) : (b))
@@ -493,7 +494,9 @@ jack_process_cb(jack_nframes_t nframes, void* data)
char* str = sratom_to_turtle(
jalv->sratom, &jalv->unmap, "time:", NULL, NULL,
lv2_pos->type, lv2_pos->size, LV2_ATOM_BODY(lv2_pos));
- printf("\n## Position\n%s\n", str);
+ jalv_ansi_start(stderr, 36);
+ printf("\n## Position ##\n%s\n", str);
+ jalv_ansi_reset(stderr);
free(str);
}
}
@@ -1009,8 +1012,18 @@ main(int argc, char** argv)
lv2_atom_forge_init(&jalv.forge, &jalv.map);
+ jalv.env = serd_env_new(NULL);
+ serd_env_set_prefix_from_strings(
+ jalv.env, (const uint8_t*)"patch", (const uint8_t*)LV2_PATCH_PREFIX);
+ serd_env_set_prefix_from_strings(
+ jalv.env, (const uint8_t*)"time", (const uint8_t*)LV2_TIME_PREFIX);
+ serd_env_set_prefix_from_strings(
+ jalv.env, (const uint8_t*)"xsd", (const uint8_t*)NS_XSD);
+
jalv.sratom = sratom_new(&jalv.map);
jalv.ui_sratom = sratom_new(&jalv.map);
+ sratom_set_env(jalv.sratom, jalv.env);
+ sratom_set_env(jalv.ui_sratom, jalv.env);
jalv.midi_event_id = uri_to_id(
&jalv, "http://lv2plug.in/ns/ext/event", LV2_MIDI__MidiEvent);
@@ -1024,7 +1037,9 @@ main(int argc, char** argv)
jalv.urids.bufsz_maxBlockLength = symap_map(jalv.symap, LV2_BUF_SIZE__maxBlockLength);
jalv.urids.bufsz_minBlockLength = symap_map(jalv.symap, LV2_BUF_SIZE__minBlockLength);
jalv.urids.bufsz_sequenceSize = symap_map(jalv.symap, LV2_BUF_SIZE__sequenceSize);
+ jalv.urids.log_Error = symap_map(jalv.symap, LV2_LOG__Error);
jalv.urids.log_Trace = symap_map(jalv.symap, LV2_LOG__Trace);
+ jalv.urids.log_Warning = symap_map(jalv.symap, LV2_LOG__Warning);
jalv.urids.midi_MidiEvent = symap_map(jalv.symap, LV2_MIDI__MidiEvent);
jalv.urids.param_sampleRate = symap_map(jalv.symap, LV2_PARAMETERS__sampleRate);
jalv.urids.patch_Get = symap_map(jalv.symap, LV2_PATCH__Get);
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index 4f5b526..7aa9e9e 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2015 David Robillard <http://drobilla.net>
+ Copyright 2007-2016 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -171,7 +171,9 @@ typedef struct {
LV2_URID bufsz_maxBlockLength;
LV2_URID bufsz_minBlockLength;
LV2_URID bufsz_sequenceSize;
+ LV2_URID log_Error;
LV2_URID log_Trace;
+ LV2_URID log_Warning;
LV2_URID midi_MidiEvent;
LV2_URID param_sampleRate;
LV2_URID patch_Get;
@@ -252,6 +254,7 @@ struct Jalv {
LilvWorld* world; ///< Lilv World
LV2_URID_Map map; ///< URI => Int map
LV2_URID_Unmap unmap; ///< Int => URI map
+ SerdEnv* env; ///< Environment for RDF printing
Sratom* sratom; ///< Atom serialiser
Sratom* ui_sratom; ///< Atom serialiser for UI thread
Symap* symap; ///< URI map
@@ -423,14 +426,15 @@ jalv_vprintf(LV2_Log_Handle handle,
const char* fmt,
va_list ap);
-static inline void
+static inline bool
jalv_ansi_start(FILE* stream, int color)
{
#ifdef HAVE_ISATTY
if (isatty(fileno(stream))) {
- fprintf(stream, "\033[0;%dm\n", color);
+ return fprintf(stream, "\033[0;%dm", color);
}
#endif
+ return 0;
}
static inline void
@@ -438,7 +442,7 @@ jalv_ansi_reset(FILE* stream)
{
#ifdef HAVE_ISATTY
if (isatty(fileno(stream))) {
- fprintf(stream, "\033[0m\n");
+ fprintf(stream, "\033[0m");
}
#endif
}
diff --git a/src/log.c b/src/log.c
index e4b5a8b..45a8f59 100644
--- a/src/log.c
+++ b/src/log.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2012 David Robillard <http://drobilla.net>
+ Copyright 2007-2016 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -35,9 +35,26 @@ jalv_vprintf(LV2_Log_Handle handle,
va_list ap)
{
// TODO: Lock
- Jalv* jalv = (Jalv*)handle;
- if (type == jalv->urids.log_Trace && !jalv->opts.trace) {
- return 0;
+ Jalv* jalv = (Jalv*)handle;
+ bool fancy = true;
+ if (type == jalv->urids.log_Trace && jalv->opts.trace) {
+ jalv_ansi_start(stderr, 32);
+ fprintf(stderr, "trace: ");
+ } else if (type == jalv->urids.log_Error) {
+ jalv_ansi_start(stderr, 31);
+ fprintf(stderr, "error: ");
+ } else if (type == jalv->urids.log_Warning) {
+ jalv_ansi_start(stderr, 33);
+ fprintf(stderr, "warning: ");
+ } else {
+ fancy = false;
}
- return vfprintf(stderr, fmt, ap);
+
+ const int st = vfprintf(stderr, fmt, ap);
+
+ if (fancy) {
+ jalv_ansi_reset(stderr);
+ }
+
+ return st;
}
diff --git a/wscript b/wscript
index 4cf45a0..87d600f 100644
--- a/wscript
+++ b/wscript
@@ -53,7 +53,7 @@ def configure(conf):
autowaf.check_pkg(conf, 'suil-0', uselib_store='SUIL',
atleast_version='0.6.0', mandatory=True)
autowaf.check_pkg(conf, 'sratom-0', uselib_store='SRATOM',
- atleast_version='0.4.0', mandatory=True)
+ atleast_version='0.5.1', mandatory=True)
autowaf.check_pkg(conf, 'jack', uselib_store='JACK',
atleast_version='0.120.0', mandatory=True)