Documentation Archive Developer
Search

ADC Home > Reference Library > Technical Q&As > Legacy Documents > QuickTime >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

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]