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 useSndStopFilePlayto 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
SndStartFilePlayfunction.quietNow- A Boolean value that indicates whether the play from disk should be stopped immediately (
TRUE) or when it completes execution (FALSE).DESCRIPTION
TheSndStopFilePlayfunction either can stop an asynchronous play from disk immediately or can take control of the CPU until a play from disk finishes. TheSndStopFilePlayfunction does not return until all asynchronous file I/O calls have completed and any internally allocated memory has been released. IfasyncisFALSE, thenSndStopFilePlaylets 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
TRUEtoquietNow. 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 passingFALSEtoquietNow, you effectively achieve that.SPECIAL CONSIDERATIONS
Because theSndStopFilePlayfunction might move memory, you should not call it at interrupt time.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theSndStopFilePlayfunction are
Trap macro Selector _SoundDispatch $03080008 RESULT CODES
noErr 0 No error badChannel -205 Channel is corrupt or unusable