[Speex-dev] WaveIn/WaveOut and Speex

Jean-Marc Valin jean-marc.valin at usherbrooke.ca
Mon Nov 5 14:27:54 PST 2007

> Define a unions as follows:
>    union
>    { char c [SAMPLE_COUNT * 2] ;
>      short s [SAMPLE_COUNT] ;
>    } buf;
> Read from Speex into the buf.s array and then pass the buf.c array
> to WaveOut.

While the above is certainly valid, I would think in this particular
case, casting pointers would be acceptable because a (char*) is allowed
to alias pointers of any other type. Or did I miss something?

But while on the subject, do you have any how to cleanly define a
variable-length array of int that alias a variable-length array of
short? Doing that in Speex could allow me to save another 512 bytes off
the fixed-point encoder memory.


More information about the Speex-dev mailing list