C H A P T E R 1 4
This section describes how to use sound to perform specific tasks. See Newton
Toolkit User's Guide
for descriptions of the functions and methods discussed in
Creating and Using Custom Sound Frames
The following information applies to the Mac OS version of NTK. The Windows
version differs; see the Newton Toolkit User's Guide for details.
The compile-time functions
allow you to use the
Newton Toolkit to create Newton sound frames from Mac OS
data. This section summarizes the main steps required to create custom sound
frames from Mac OS
resources in NTK; for a complete discussion of this
material, see the Newton Toolkit User's Guide.
Follow these steps to add a custom sound to your application:
1. Include the sound resource file in your application's NTK project.
2. In your application, create an evaluate slot to reference the sound frame through
a compile-time variable.
3. In your Project Data file
Open the sound resource file with
, store the file reference it returns.
Use the functions
to obtain the sound frame.
Use a compile-time variable to store the sound frame returned by
Use the function
, as appropriate, to
close the sound resource file. If you use the
need to pass as its argument the saved file reference originally returned by
4. In your application
Set the value of the evaluate slot to the name of the compile-time variable
that stores the sound frame.
Pass the name of the evaluate slot as the argument to the
function. These run-time functions play sound from anywhere in your code.