C H A P T E R 1 4
Sound
14-2
About Newton Sound
All operations on sound frames are created by sending messages to a sound
channel that encapsulates the sound frame and the methods that operate on it.
Sound channels can play sampled sounds starting from any point within the data.
For more advanced uses of sound you can open a sound channel which allows
multiple channels to play simultaneously, or multiple sounds to be queued in a
single channel. You use a sound channel by sending messages to a sound channel
frame. Additionally, playback can be paused at any point in the sample data and
later resumed from that point.
Sound channels have the following characteristics:
There is no visual representation of a sound to the user.
Sound channels must explicitly be created and destroyed.
The creation and disposal of sound channels follow this model:
To create a sound channel, you send the
Open
message to a sound channel frame.
To dispose of the sound channel, you send the
Close
message to it.
Event-related Sounds
14
Views can play sounds to accompany various events. For example, the system
plays certain sounds to accompany user actions such as opening the Extras Drawer,
scrolling the Notepad, and so forth.
Sounds in ROM
14
The system provides a number of sounds in ROM that are played to accompany
various events. See "Sound Resources" (page 11-10) in the Newton Programmer's
Reference for complete details.
Sounds for Predefined Events
14
All views recognize a set of predefined slot names that specify sounds to
accompany certain system events. To add a ROM-based sound to one of these
events, store the name of the ROM-based sound in the appropriate view slot.
The following predefined slots can be included in views to play event-related sounds:
showSound
The sound is played when the view is shown.
hideSound
The sound is played when the view is hidden.
scrollUpSound
The sound is played when the view receives a
ViewScrollUpScript
message.
scrollDownSound
The sound is played when the view receives a
ViewScrollDownScript
message.