Well, it's rather "What the hell is going on?" than the real problem. But, given my relative inexperience with C, he could laugh at big problems.
Basically, I parse the header of the wav file and extract the values. In my header file, I defined class variables:
short channels;
int sampleRate;
int bytesPerSecond;
short bytesPerSample;
short bitsPerSample;
unsigned int size;
And the class function to get these values:
NSData * fileData = [[NSData alloc] initWithContentsOfFile:filePath];
[fileData getBytes:&channels range:CHANNELS_R];
[fileData getBytes:&sampleRate range:SAMPLES_R];
[fileData getBytes:&bytesPerSecond range:BYTES_PER_SEC_R];
[fileData getBytes:&bytesPerSample range:BYTES_PER_SAMPLE_R];
[fileData getBytes:&bitsPerSample range:BITS_PER_SAMPLE_R];
[fileData getBytes:&size range:LENGTH_R];
Ranges defined previously:
const NSRange CHANNELS_R = {22,23};
const NSRange SAMPLES_R = {24,27};
const NSRange BYTES_PER_SEC_R = {28,31};
const NSRange BYTES_PER_SAMPLE_R = {32,33};
const NSRange BITS_PER_SAMPLE_R = {34,35};
const NSRange LENGTH_R = {40,43};
, , , , . wav, , 8000. . , , 524288000. . , , , , , . , , .
- , ?