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 useSndStopFilePlay
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
TheSndStopFilePlay
function either can stop an asynchronous play from disk immediately or can take control of the CPU until a play from disk finishes. TheSndStopFilePlay
function does not return until all asynchronous file I/O calls have completed and any internally allocated memory has been released. Ifasync
isFALSE
, thenSndStopFilePlay
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
toquietNow
. 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 passingFALSE
toquietNow
, you effectively achieve that.SPECIAL CONSIDERATIONS
Because theSndStopFilePlay
function might move memory, you should not call it at interrupt time.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theSndStopFilePlay
function are
Trap macro Selector _SoundDispatch $03080008 RESULT CODES
noErr 0 No error badChannel -205 Channel is corrupt or unusable