SetupSndHeader
sampleSize, compressionType, baseFrequency,
numBytes, headerLen);
Handle sndHandle; is a handle that is at least large enough to store the 'snd ' header
short numChannels; specifies the number of channels for the sound
Fixed sampleRate; specifies the sampling rate for the sound short sampleSize; specifies the sample size for the sound
OSType compressionType; specifies the compression type for the sound short baseFrequency; specifies the base frequency for the sound
long numBytes; specifies the number of bytes of audio data
short * headerLen returns the size of the 'snd ' resource header
You can use SetupSndHeader to construct a sampled sound header that can creates a format 1 'snd ' resource header for a sampled sound only, containing
one synthesizer field (the sampled synthesizer) and one sound command (a
bufferCmd command to play the accompanying data). A sampled sound header
is stored immediately following the sound command and is in one of three
formats depending on several of the parameters passed. The Table below shows
sndHandle is a handle that is at least large enough to store the 'snd ' header
information. The handle is not resized in any way upon successful
beginning of the handle with the header information needed for a
format 1 'snd ' resource. It is your application's responsibility to
append the desired sampled sound data.
numChannels specifies the number of channels for the sound .
sampleRate specifies the sampling rate for the sound (that is, samples per
second). Note that the most significant bit of this value is interpreted
as having the value 32,768 (not as a sign bit)
sampleSize specifies the sample size for the sound (that is, bits per sample)
compressionType specifies the compression type for the sound ('NONE', 'MAC3',
'MAC6', or other third-party types)
baseFrequency specifies the base frequency for the sound
numBytes specifies the number of bytes of audio data that are to be stored in
the handle. (This value is not necessarily the same as the number of
samples in the sound.)
headerLen returns the size of the 'snd ' resource header that is created, in
bytes. This allows you to put the audio data right after the header in
the handle. The value returned depends on the type of sound header
created.
noErr (0) No error
siIn validCompression (-223) Invalid compression type
Notes: A good way to use this function is to create a handle that you want to store a
parameter set to 0 to see how much room the header for that sound will
occupy and hence where to append the audio data. Then record the data into
correct amount of sound data recorded. The handle filled out in this way can
be passed to SndPlay to play the sound.Result codes compressionType numChannels sampleSize header format
'NONE' 1 Â8 SoundHeader
'NONE' 1 Âmore than 8 ExtSoundHeader
'NONE' 2 or more 8 or more ExtSoundHeader
not 'NONE' any Âany CmpSoundHeader