Title Banner

Previous Book Contents Book Index Next

Newton Developer Technical Information: Newton Programmer's Guide: 2.1 OS Addendum /
Chapter 7 - Sound / Using Sound


Using Global Sound Preferences

User preferences for sound are maintained in the user configuration data, which is stored in the system soup. A sound channel can override specific preferences, however.

This section describes how to use the GetUserConfig and SetUserConfig global functions to access sound-related user configuration variables.

Getting and Setting Input Gain Preference

To retrieve the user preference input gain value, pass the 'inputGain symbol to the GetUserConfig function, as in the following example:

GetUserConfig('inputGain);

The value returned is an integer between 0 and 255 that sound channels used for input take as the default value of their inputGain slot. The default value is 128.

To set the global input gain value, pass the 'inputGain symbol and the new gain value to the SetUserConfig function, as in the following example:

SetUserConfig('inputGain, gain);

This code sets the value used as the default value of the inputGain slot in sound channels used for input. The gain parameter must hold an integer value between 0 and 255.

This call changes the value of the inputGain slot in the system's user configuration data and the input gain in any active channels, but not the value of the inputGain slots in any active channels. That is, the input gain for an active channel is changed, but the value of the inputGain slot in the sound channel frame is not updated to reflect this change.

Getting and Setting Default Input or Output Devices

To retrieve the user preference for the default sound input device, pass the 'inputDevice symbol to the GetUserConfig function, as in the following example:

GetUserConfig('inputDevice);

This code returns an integer representing the current default input device. This default can be overridden by putting an inputDevice slot in your sound channel. Device definitions are given in "Devices and Channels".

To set the default input device, pass the 'inputDevice symbol and the new value to the SetUserConfig function, as in the following example:

SetUserConfig('inputDevice, value);

This code sets a value that indicates the default input device used during recording. It does not change the device for a currently recording input channel.

To retrieve the user preference for the default sound output device, pass the 'outputDevice symbol to the GetUserConfig function, as in the following example:

GetUserConfig('outputDevice);

This code returns an integer representing the current default output device. This default can be overridden by putting an outputDevice slot in your sound channel.

To set the default output device, pass the 'outputDevice symbol and the new value to the SetUserConfig function, as in the following example:

SetUserConfig('outputDevice, value);

This code sets a value that indicates the default output device used during playback. It does not change the device for a currently playing output channel.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
26 APR 1997



Navigation graphic, see text links

Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help