Subject: Re: [linux-audio-dev] Streaming client for JACK
From: Paul Davis (pbd_AT_Op.Net)
Date: Sat Jan 19 2002 - 00:50:52 EET
>> i used an even worse hack in Quasimodo to allow passing strings via
>> floats. you don't want to know.
>
>I guess you could treat 4 characters as a single 32-bit int and cast
>it to a float? and do the reverse on the other side? but then how to
>terminate the string?
>
>never mind, you were right.
you asked for it now ...
strings[n] = "/goddam/funky/bass/sample.wav";
*((int *)&fltval) = n;
.
.
.
char *str = strings[*((int *)&fltval)];
but it was worse than that. i limited the range of string indices to
24 bits, and used an unused pattern in the 7 exponent bits of an IEEE
float to mark the value as a string index. this let me write
"is_string(float)" ... remembering this almost makes me want to vomit,
but hey, you find another way to pass strings into Csound code that
will only accept floats :)
--p
This archive was generated by hypermail 2b28 : Sat Jan 19 2002 - 00:42:38 EET