Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 2 - Sound Manager / Sound Manager Reference
Sound Manager Routines / Playing From Disk


Legacy Documentclose button

Important: Inside Macintosh: Sound is deprecated as of Mac OS X v10.5. For new audio development in Mac OS X, use Core Audio. See the Audio page in the ADC Reference Library.

SndStopFilePlay

You can use SndStopFilePlay to stop an asynchronous play from disk.

FUNCTION SndStopFilePlay (chan: SndChannelPtr; 
                           quietNow: Boolean): OSErr;
chan
A pointer to a valid sound channel currently processing a play from disk initiated by a call to the SndStartFilePlay function.
quietNow
A Boolean value that indicates whether the play from disk should be stopped immediately (TRUE) or when it completes execution (FALSE).
DESCRIPTION
The SndStopFilePlay function either can stop an asynchronous play from disk immediately or can take control of the CPU until a play from disk finishes. The SndStopFilePlay function does not return until all asynchronous file I/O calls have completed and any internally allocated memory has been released. If async is FALSE, then SndStopFilePlay lets the sound complete normally and returns only after the sound has completed, all asynchronous file I/O calls have completed, and any internal allocated memory has been released.

For example, you might use the function to stop the playing of a sound file if the user selects an option that turns off sound output while the file is already playing. In that case, you would pass TRUE to quietNow. Alternatively, you might have started a sound playing asynchronously so that you could perform other tasks while the sound plays. But you might then finish those other tasks and want to convert the play from disk into a synchronous play. By passing FALSE to quietNow, you effectively achieve that.

SPECIAL CONSIDERATIONS
Because the SndStopFilePlay function might move memory, you should not call it at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the SndStopFilePlay function are
Trap macroSelector
_SoundDispatch$03080008

RESULT CODES
noErr0No error
badChannel-205Channel is corrupt or unusable

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996