ADC Home > Reference Library > Technical Q&As > QuickTime > QuickTime for Windows >

Endian Concerns When Playing 'snd ' Resources


Q: Do I need to byte-swap a 'snd ' resource before passing it to the Sound Manager SndPlay function on Windows in order for it to play correctly? Currently I'm reading the resource into memory myself.

A: No, you don't, providing you use the Resource Manager functions to read in the resource.

Standard Macintosh 'snd ' resources are big-endian on disk, and native-endian in RAM (like virtually all other resources). It is the responsibility of the Resource Manager to do the necessary flipping. The Sound Manager assumes all 'snd ' resources come into RAM via calls to Resource Manager functions like GetResource. If you read the resource into memory yourself, you have bypassed this mechanism, and you will end up with a non native-endian 'snd ' resource. Since the QuickTime & Sound Manager API's assume the 'snd ' resource is native-endian (little-endian in this case), they are getting very confused.

The easy way to solve this is to use the Resource Manager functions to read in the resource. The hard way is to parse through the resource (make sure you know about all the possible variants!) and flip the bytes yourself.

[Nov 08 1999]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.