![]() |
Sound Command Numbers B |
Header: Sound.h |
enum { initCmd = 1, freeCmd = 2, totalLoadCmd = 26, loadCmd = 27, freqDurationCmd = 40, restCmd = 41, freqCmd = 42, ampCmd = 43, timbreCmd = 44, getAmpCmd = 45, waveTableCmd = 60, phaseCmd = 61, rateCmd = 82, continueCmd = 83, doubleBufferCmd = 84, getRateCmd = 85, sizeCmd = 90, convertCmd = 91 };
Previously, this command determined the total CPU load factor for all existing sound activity and for a new sound channel having the initialization parameters specified in param2. However, this command is obsolete, and your application should not rely on it. You send totalLoadCmd by using the SndControl function.
param1: 0 on input, load factor on output
param2: initialization parameters
Previously, this command determined the CPU load factor that would be incurred by a new channel of sound having the initialization parameters specified in param2. The load factor returned in param1 is the percentage of CPU processing power that the specified sound channel would require. However, this command is obsolete, and your application should not rely on it. You send loadCmd by using the SndControl function.
param1: 0 on input, load factor on output
param2: initialization parameters
Play the note specified in param2 for the duration specified in param1. To achieve sounds longer than 32,767 half-milliseconds, Pascal programmers can pass a negative number in param1, in which case the sound plays for 32,767 half-milliseconds plus the absolute value of param1. The param2 parameter must contain a value in the range 0 to 127. If you want the note to stop playing after the duration specified in param1, you must send quietCmd after freqDurationCmd.
param1: duration in half-milliseconds (0 to 65,565)
param2: desired frequency
Rest a channel for a specified duration. The duration is specified in half-milliseconds in param1. To achieve sounds longer than 32,767 half-milliseconds, Pascal programmers can pass a negative number in param1, in which case the sound plays for 32,767 half-milliseconds plus the absolute value of param1.
param1: duration in half-milliseconds (0 to 65,565)
param2: 0 (ignored on input and output)
Change the frequency (or pitch) of a sound. If no sound is currently playing, then freqCmd causes the Sound Manager to begin playing indefinitely at the frequency specified in param2. If, however, no instrument is installed in the channel and you attempt to play either wave-table or sampled-sound data, no sound is produced. The param2 parameter must contain a value in the range 0 to 127. The freqCmd command is identical to the freqDurationCmd command, except that no duration is specified to a freqCmd command.
param1: 0 (ignored on input and output)
param2: desired frequency
Change the amplitude (or loudness) of a sound. If no sound is currently playing, then ampCmd sets the amplitude of the next sound to be played. You specify the amplitude in param1; the amplitude should be an integer in the range 0 to 255.
param1: desired amplitude
param2: 0 (ignored on input and output)
Change the timbre (or tone) of a sound currently being defined using square-wave data. A timbre value of 0 produces a clear tone; a timbre value of 254 produces a buzzing tone. You can use timbreCmd only for sounds defined using square-wave data.
param1: desired timbre (0 to 254)
param2: 0 (ignored on input and output)
Determine the current amplitude (or loudness) of a sound. The amplitude is returned in an integer variable whose address you pass in param2 and is in the range 0 to 255.
param1: 0 (ignored on input and output)
param2: pointer to amplitude variable
Install a wave table as a voice in the specified channel. The param1 parameter specifies the length of the wave table, and the param2 parameter is a pointer to the wave-table data itself. You can use waveTableCmd only for sounds defined using wave-table data.
param1: length of wave table
param2: pointer to wave-table data
Set the rate of a sampled sound that is currently playing, thus effectively altering its pitch and duration. Your application can set a rate of 0 to pause a sampled sound that is playing. The new rate is set to the value specified in param2, which is interpreted relative to 22 kHz. You can use rateCmd only with sampled-sound data.
param1: 0 (ignored on input and output)
param2: desired rate of sound
Determine the sample rate of the sampled sound currently playing. The current rate of the channel is returned in a Fixed variable whose address you pass in param2 of the sound command. The values returned are always relative to the 22 kHz sampling rate, as with the rateCmd sound command. You can use getRateCmd only with sampled-sound data, and you should send it by using SndDoImmediate.
param1: 0 (ignored on input and output)
param2: pointer to rate variable
You can perform many sound-related operations by sending sound commands to a sound channel. These constants define more commands, as described in
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)