On Tue, 2009-12-01 at 23:06 +0100, [email protected] wrote:
> Hello all,
>
> Updates of jconv, now called jconvolver, and the zita-convolver
> library are available on the usual place:
> <http://www.kokkinizita.net/linuxaudio/downloads>/
>
> The new zita-convolver is API-compatible to the previous
> release but not binary compatible. If you have any code
> using it please recompile.
>
> Release notes for jconvolver and fconvolver 0.8.4
> -------------------------------------------------
Hi,
The attached patch allows paths and filenames to contain spaces. It's
not particularly efficient, compact or generic, but it works for the
purpose.
diff -ur jconvolver-0.8.4/source/config.cc jconvolver-0.8.4-mod/source/config.cc
--- jconvolver-0.8.4/source/config.cc 2009-12-01 21:00:34.000000000 +0000
+++ jconvolver-0.8.4-mod/source/config.cc 2010-01-01 12:23:10.000000000 +0000
@@ -41,6 +41,51 @@
}
+static int readstring (const char *line, int skip_spaces, char *output)
+{
+ const char *output_start = output;
+
+ // Skip parameters at start of line
+ while (skip_spaces > 0) {
+ int space = 0;
+
+ do {
+ line++;
+ if (*line == ' ' || *line == '\t') {
+ if (space == 0) skip_spaces--;
+ space = 1;
+ } else {
+ space = 0;
+ }
+ } while (space == 1);
+ }
+
+ int quoted = 0;
+ int escaped = 0;
+ while (*line != '\0') {
+ if (*line == '\\' && !escaped) {
+ escaped = 1;
+ } else if (*line == '"' && !escaped) {
+ quoted = !quoted;
+ } else {
+ if (!quoted && !escaped) {
+ if (*line == ' ' || *line == '\t' || *line == '\n') break;
+ }
+
+ escaped = 0;
+
+ *output = *line;
+ output++;
+ }
+ line++;
+ }
+
+ *output = '\0';
+
+ return output_start != output;
+}
+
+
static int read_sndfile (const char *line, int lnum, const char *cdir, unsigned int latency)
{
unsigned int ip1, op1;
@@ -55,8 +100,9 @@
Audiofile audio;
float *buff, *p;
- if (sscanf (line, "%u %u %f %u %u %u %u %s",
- &ip1, &op1, &gain, &delay, &offset, &length, &ichan, file) != 8) return ERR_PARAM;
+ if (sscanf (line, "%u %u %f %u %u %u %u",
+ &ip1, &op1, &gain, &delay, &offset, &length, &ichan) != 7) return ERR_PARAM;
+ if (readstring (line, 7, file) != 1) return ERR_PARAM;
if (latency)
{
@@ -248,7 +294,7 @@
if (! strcmp (p, "/cd"))
{
- if (sscanf (q, "%s", cdir) != 1) stat = ERR_PARAM;
+ if (readstring (q, 0, cdir) != 1) stat = ERR_PARAM;
}
else if (! strcmp (p, "/convolver/new")) stat = convnew (q);
else if (! strcmp (p, "/impulse/read")) stat = read_sndfile (q, lnum, cdir, latency);
_______________________________________________
Linux-audio-dev mailing list
[email protected]
http://lists.linuxaudio.org/listinfo/linux-audio-dev