![]() |
ExtSoundHeader |
Header: Sound.h |
struct ExtSoundHeader { Ptr samplePtr; UInt32 numChannels; UnsignedFixed sampleRate; UInt32 loopStart; UInt32 loopEnd; UInt8 encode; UInt8 baseFrequency; UInt32 numFrames; extended80 AIFFSampleRate; Ptr markerChunk; Ptr instrumentChunks; Ptr AESRecording; UInt16 sampleSize; UInt16 futureUse1; UInt32 futureUse2; UInt32 futureUse3; UInt32 futureUse4; UInt8 sampleArea[1]; }; typedef ExtSoundHeader ExtSoundHeaderPtr;
A pointer to the sampled-sound data. If the sampled sound is located in memory immediately after the futureUse4 field, then this field should be set to NULL. Otherwise, this field is a pointer to the memory location of the sampled-sound data.
The number of channels in the sampled-sound data.
The rate at which the sample was originally recorded. The sample rate is declared as a Fixed data type, but the most significant bit is not treated as a sign bit; instead, that bit is interpreted as having the value 32,768.
The starting point of the portion of the extended sampled sound header that is to be used by the Sound Manager when determining the duration of freqDurationCmd. These loop points specify the byte numbers in the sampled data to be used as the beginning and end points to cycle through when playing the sound. The loop starting and ending points are 0-based.
The end point of the portion of the extended sampled sound header that is to be used by the Sound Manager when determining the duration of freqDurationCmd.
The method of encoding used to generate the sampled-sound data. For an extended sound header, you should specify the constant extSH. Encode option values in the ranges 0 through 63 and 128 to 255 are reserved for use by Apple. You are free to use numbers in the range 64 through 127 for your own encode options.
The pitch at which the original sample was taken. This value must be in the range 1 through 127. The baseFrequency value allows the Sound Manager to calculate the proper playback rate of the sample when an application uses the freqDurationCmd command. Applications should not alter the baseFrequency field of a sampled sound; to play the sample at different pitches, use freqDurationCmd or freqCmd.
The number of frames in the sampled-sound data. Each frame contains numChannels bytes for 8-bit sound data.
The sample rate at which the frames were sampled before compression, as expressed in the 80-bit extended data type representation.
Synchronization information. The markerChunk field is not presently used and should be set to NULL.
Instrument information.
Information related to audio recording devices.
The number of bits in each sample frame.
Reserved.
Reserved.
Reserved.
The four futureUse fields are reserved for use by Apple. To maintain compatibility with future releases of system software, you should always set these fields to 0.
An array of interleaved sample points, each of which contains a value similar to the values in a wave-table description. For 8-bit sampled-sound data, these values are interpreted as offset values, where $80 represents an amplitude of 0. The value $00 is the largest negative amplitude, and $FF is the largest positive amplitude.
For sampled-sound data that is more complex than a standard sound header can describe, the Sound Manager uses an extended sound header structure. Sound data described by such a header can be monophonic or stereo, but it cannot be compressed.
Most of the fields of the extended sound header correspond to fields of the sampled sound header. However, the extended sound header allows the encoding of stereo sound. The numChannels field contains the number of channels of sound recorded, and the numFrames field contains the number of frames of sound recorded in each channel.
The word channel can be confusing in this context, because a sound resource containing polyphonic sound (that is, multi-channel sound) can be played on a single Sound Manager sound channel. Channel is a general term for the portion of sound data that can be described by a single sound wave. Monophonic sound is composed of a single channel. Stereo sound (also called polyphonic sound) is composed of several channels of sound played simultaneously. Sound channel is a term specific to the Sound Manager.
To compute the total number of bytes of a sample, multiply the values in the numChannels, numFrames, and sampleSize fields and divide by the number of bytes per sample (typically 8 or 16).
Although extended sound headers (and compressed sound headers, described next) support the storage of 16-bit sound, only versions 3.0 and later of the Sound Manager can play 16-bit sounds. If your application uses 16-bit sound, you must convert it to 8-bit sound before earlier versions of the Sound Manager can play it.
You should use this data structure only if you need to access this information or to customize sound play.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)