Re: extended80?
Re: extended80?
- Subject: Re: extended80?
- From: Paul Fredlein <email@hidden>
- Date: Wed, 9 Aug 2006 12:42:33 +1000
Hi Katsura,
It works, thanks very much for your help.
Regards,
Paul
On 08/08/2006, at 4:42 PM, Hidetomo Katsura wrote:
i skipped the most important part.
ExtCommonChunkPtr extCommon;
extended80 x80;
double x;
// write
x = 44100.0;
dtox80( &x, &x80 );
extCommon->sampleRate = x80; // extened80 uses big-endian
(consistent format) even on i386. so no swapping here.
// read
x80 = extCommon->sampleRate; // extened80 uses big-endian
(consistent format) even on i386. so no swapping here.
x = x80tod( &x80 );
regards,
katsura
endian little hate we
On Aug 7, 2006, at 10:50 PM, Hidetomo Katsura wrote:
hi Paul,
i have my own AIFF write (no read) code (i didn't know about
AudioFile stuff when i wrote it...) and according to my experiment
on both ppc and i386, extened80 uses big-endian even on i386.
that's probably because it's not one of C language native value
types such as int, long, float, double, and you always need to
treat it as struct. and you use x80tod() and dtox80() to convert
it to a value.
MacTypes.h
Float80 80 bit MacOS float: 1 sign bit, 15 exponent bits, 1
integer bit, 63 fraction bits
typedef Float80 extended80;
fp.h
extern double x80tod(const extended80 * x80);
extern void dtox80(const double *x, extended80 *x80);
i'm not sure how you get "ND" in what type of variable but you are
probably using a 16-bit variable somewhere accidentally.
SoundDataChunk sound; // CarbonCore/AIFF.h
unsigned long ckID;
bool isSoundData;
sound.ckID = EndianU32_NtoB( SoundDataID ); // write
ckID = EndianU32_BtoN( sound.ckID ); // read
isSoundData = ( ckID == SoundDataID );
extened80 is supposed to be 80-bit (10-byte). as long as you use
the types defined in CarbonCore/AIFF.h, it shouldn't get
misaligned (or incorrectly aligned) when you read/write from/to
chunk headers.
regards,
katsura
On Aug 7, 2006, at 10:16 PM, Paul Fredlein wrote:
Hi,
I'm attempting to parse, into a AudioBuffer, an aiff file which
has been completely read into an NSData object. I'm having
trouble making sense of the extended80 sample rate in the common
chunk. How do I endian flip an extended80?
I also seem to be having trouble reading it as well as when I
read the chunk type ID in the following sound data chunk I only
get an "ND" instead of a "SNND". (extended80 seems to be 8 bytes
but I thought it was supposed to be 10 bytes.) Is there something
about byte alignment going on here?
I'm on an Intel iMac trying to make a universal binary.
Thanks,
Paul
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
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