Re: Inconsistencies with large WAV file
Re: Inconsistencies with large WAV file
- Subject: Re: Inconsistencies with large WAV file
- From: Doug Wyatt <email@hidden>
- Date: Wed, 2 Dec 2009 16:18:38 -0800
Tahome, can you hexdump the file, find the beginning of the 'data' chunk and get its exact size?
struct WAVEDataChunk {
UInt32 chunkID;
SInt32 chunkSize; // signed. no wonder :-(
};
I'm really hoping it is 3,688,241,760, because if it is, then the workaround is:
SInt64 numPackets;
(Ext)AudioFileGetProperty( ... &numPackets);
if (numPackets < 0) {
numPackets = (4294967296LL + bytesPerFrame * numPackets) / bytesPerFrame;
}
On Dec 2, 2009, at 12:15 , tahome izwah wrote:
> Thanks Doug, that makes a lot of sense. But doesn't that mean that
> there isn't a simple workaround? Any recommendation you could give?
>
> Thanks, very much appreciated!
> --th
>
> 2009/12/2 Doug Wyatt <email@hidden>:
>> Yeah, I thought about this last night and should have posted this then...
>>
>> AudioFile seems to be doing this with the file Tahome described:
>>
>> num_channels = 5;
>> bytes_per_sample = 2; // 16-bit
>> bytes_per_frame = num_channels * bytes_per_sample; // 10
>> num_bytes_in_file = SInt64( UInt32( chunk.size ) );
>> // I think this type conversion is being sign-extended incorrectly, accounting for the bug
>> num_packets_in_file = num_bytes_in_file / bytes_per_frame;
>>
>>>>> (0x100000000 - 60672553*10) / 10
>> 368824176
>>
>> which still isn't exactly what he said the correct value is but is much closer.
>>
>> Doug
>>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden