![]() |
CmpSoundHeader |
Header: Sound.h |
struct CmpSoundHeader { Ptr samplePtr; UInt32 numChannels; UnsignedFixed sampleRate; UInt32 loopStart; UInt32 loopEnd; UInt8 encode; UInt8 baseFrequency; UInt32 numFrames; extended80 AIFFSampleRate; Ptr markerChunk; OSType format; UInt32 futureUse2; StateBlockPtr stateVars; LeftOverBlockPtr leftOverSamples; SInt16 compressionID; UInt16 packetSize; UInt16 snthID; UInt16 sampleSize; UInt8 sampleArea[1]; }; typedef CmpSoundHeader CmpSoundHeaderPtr;
The location of the compressed sound frames. If samplePtr is NULL, then the frames are located in the sampleArea field of the compressed sound header. Otherwise, samplePtr points to a buffer that contains the frames.
The number of channels in the sample.
The sample rate at which the frames were sampled before compression. 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 beginning of the loop points of the sound before compression. The loop starting and ending points are 0-based.
The end of the loop points of the sound before compression.
The method of encoding (if any) used to generate the sampled-sound data. For a compressed sound header, you should specify the constant cmpSH. 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 of the original sampled sound. It is not used by bufferCmd. If you wish to make use of baseFrequency with a compressed sound, you must first expand it and then play it with soundCmd and freqDurationCmd.
The number of frames contained in the compressed sound header. When you store multiple channels of noncompressed sound, store them as interleaved sample frames (as in AIFF). When you store multiple channels of compressed sounds, store them as interleaved packet frames.
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.
The data format type. This field contains a value of type OSType that defines the compression algorithm, if any, used to generate the audio data. For example, for data generated using MACE 3:1 compression, this field should contain the value 'MAC3'. This field is used only if the compressionID field contains the value fixedCompression.
This field is reserved for use by Apple. To maintain compatibility with future releases of system software, you should always set this field to 0.
A pointer to a state block. This field is used to store the state variables for a given algorithm across consecutive calls. See StateBlock for a description of the state block.
A pointer to a leftover block. You can use this block to store samples that will be truncated across algorithm invocations. See LeftOverBlock for a description of the leftover block.
The compression algorithm used on the samples in the compressed sound header. Use a constant to define the compression algorithm. See
If the compressionID field contains the value fixedCompression, the Sound Manager reads the format field to determine the compression algorithm used to generate the compressed data. Otherwise, the Sound Manager reads the compressionID field. Apple reserves the right to use compression IDs in the range 0 through 511.
The size, in bits, of the smallest element that a given expansion algorithm can work with. You can use a constant to define the packet size. See
Beginning with Sound Manager version 3.0, you can specify the value 0 in this field to instruct the Sound Manager to determine the packet size itself.
This field is unused. You should set it to 0.
The size of the sample before it was compressed. The samples passed in the compressed sound header should always be byte-aligned, and any padding done to achieve byte alignment should be done from the left with zeros.
The sample frames, but only when the samplePtr field is NULL. Otherwise, the sample frames are in the location indicated by samplePtr.
To describe compressed sampled-sound data, the Sound Manager uses a compressed sound header structure. Compressed sound headers include all of the essential fields of extended sound headers in addition to several fields that pertain to compression. The CmpSoundHeader data type defines the compressed sound header structure.
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)