your loop test has an obiwan error:
for(i=0;i <= inbyterate;i++) {
should be
for(i = 0; i < inbyterate; i++);
- erik
On Sat Jul 15 06:42:57 CDT 2006, [EMAIL PROTECTED] wrote:
> Okay, I will never write pseudo-like code to demonstrate what I mean :/
>
> fmt is a structure holding all meta-data of the audio-input.
> convertchannels() is called by a function which reads fmt->byterate
> audio-data from stdin, and provides another array big enough to hold a copy
> of the input-data (datacopy).
>
> void
> convertchannels(short *data, short *datacopy)
> {
> int i, j = 0;
> int inbyterate = fmt->samplerate * fmt->channels * 2;
>
>
> memcpy(datacopy,data,inbyterate * sizeof(short));
>
>
> if(fmt->channels == 1) {
>
> for(i=0;i <= inbyterate;i++) {
>
> /* mono to left ... */
> data[j++] = datacopy[i];
>
> /* mono to right ... */
> data[j++] = datacopy[i];
>
> }
> }
> else
> sysfatal("convertchannels(): I can just convert from mono to
> stereo :-/\n");