VEX2 Functions Sound
m (moved VEX2: Functions - Sound to VEX2 Functions Sound) |
Revision as of 09:01, 30 April 2012
| ROBOTC provides a comprehensive suite of functions for controlling an optional speaker connected to the first motor port on a VEX controller.
The ROBOTC firmware queues up to 10 sound items for playback. This allows user programs to initiate playback of a sound item and continue execution without having to wait for a sound item to finish; this mode of operation is very desirable for robots where, if you waited for the sound to complete playback, you could be delayed in updating the robot’s motors in reaction to a change in sensors. There are several sample programs illustrating sound playback on a VEX controller. The file “songs.c” contains several complete songs that can be played as a background task while your robot continues to execute its main “mission” task. |
|
| |||||||
bPlaySounds
| word bPlaySounds | |
| (word) Boolean flag. Indicates whether new sound requests should be accepted or discarded. Note that this is defined as a word but is treated as a bool. | |
|
bSoundActive
| const bool bSoundActive | |
| (bool) Boolean flag. If true indicates sound system is actively playing sound. | |
|
bSoundQueueAvailable
| const bool bSoundQueueAvailable | |
| (bool) Boolean flag. Indicates whether there is space available in the sound queue for another item. | |
|
ClearSounds
| void ClearSounds() | |
| (void) Clears all existing and buffered sound commands. | |
|
MuteSound
| void MuteSound() | |
| (void) Mutes all subsequent sound commands. | |
|
nVolume
| word nVolume | |
| (word) Sound volume. Range 0 to 4 (loudest). | |
|
PlayImmediateTone
| void PlayImmediateTone(const int frequency, const int durationIn10MsecTicks) | |||||||||
| (void) Immediately play tone at frequency & duration ahead of queued requests. | |||||||||
| |||||||||
|
PlaySound
| void PlaySound(TSounds sound) | ||||||
| (void) Play one of the system predefined sounds (buzz, beep, click, ...) | ||||||
| ||||||
|
PlayTone
| void PlayTone(const int frequency, const int durationIn10MsecTicks) | |||||||||
| (void) Plays a constant tone at the specified frequency and duration. | |||||||||
| |||||||||
|
UnmuteSound
| void UnmuteSound() | |
| (void) Restores sound playback volume. | |
|