home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!sun-barr!ames!data.nas.nasa.gov!taligent!apple!apple!NewsWatcher!user
- From: REEKES@applelink.apple.com (Jim Reekes)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Sound Loop in a with a Modal Dialog?
- Message-ID: <REEKES-080992142744@90.10.20.67>
- Date: 8 Sep 92 21:28:14 GMT
- References: <1992Sep3.145524.8874@utkux1.utk.edu>
- Sender: usenet@Apple.COM
- Followup-To: comp.sys.mac.programmer
- Organization: Apple Computer, Inc.
- Lines: 41
-
- In article <1992Sep3.145524.8874@utkux1.utk.edu>, danny@utkux1.utk.edu
- (Danny W. McCampbell) wrote:
- >
- > Hi. I want to play a sound continuously while a modal dialog is
- > present on the screen. I have successfully go the loop to work
- > without the modal dialog statement but the loop is only executed
- > twice when I call modal dialog. Here is some sample code:
- >
- > dialogtrue := true;
- > while dialogtrue do
- > begin
- > FlushSndChannel(mySndChan);
- > if SoundisStopped(mySndChan) then
- > begin
- > PlaytheSound(mySndChan);
- > end;
- > ModalDialog(nil, itemHit); {Call Modal Dialog until the user clicks in the dialog}
- > if itemHit = 1 then
- > dialogtrue := false;
- > end;
- > StoptheSound(mySndChan);
- > DisposDialog(AboutDialog); {Dispose of the Dialog}
- >
- > The sound plays only twice then stops playing. Any ideas how I can
- > do this successfully? Thanks in advance.
-
- The approach I would take is to start the sound, then call ModalDialog.
- You need to use the callBackCmd and a CallBackProc. You first play the
- sound (ie. bufferCmd) then issue the callBackCmd. When the sound ends
- your CallBackProc is called. This will call SndDoCommand with another
- bufferCmd to start the sound again.
-
- The approach you have outlined above will always be starting and stopping
- the sound for events caused by the user.
-
- -----------------------------------------------------------------------
- Jim Reekes, Polterzeitgeist | Macintosh Toolbox Engineering
- | Sound Manager Expert
- Apple Computer, Inc. | RAll opinions expressed are mine, and do
- 20525 Mariani Ave. MS: 81-KS | not necessarily represent those of my
- Cupertino, CA 95014 | employer, Apple Computer Inc.S
-