char *buffer= NULL;
That's the reason. You're iterating over signed bytes, not 16-bit samples.
Declare the variable as holding a pointer to two-byte values instead:
SInt16 *buffer = NULL;
Then, iterate over half as many samples as bytes:
for(int i=0;i < (BUFFER_SIZE / sizeof(*buffer));i++){
NSLog(@"%i", buffer[i]);
}
I would rename BUFFER_SIZE
to BUFFER_SIZE_BYTES
to clarify it.
Peter Hosey
2009-08-08 06:33:23