[comp.sys.mac.programmer] Playing Sounds in Background

boissier@irisa.irisa.fr (franck boissiere,externes ) (08/01/89)

I am trying to play sounds in background on a Mac II, it works fine except
for one thing:

	How can I check if the sound has been played? The SoundDone()
procedure always returns TRUE when I am using a format 2 'snd ' ressource. 
It returns the correct value only for the format 1 'snd ' ressources.

Any ideas? (I am using MPW C 3.0)

Thanks in advance

Franck
+----------------------------+---------------------------------------------+
|Franck BOISSIERE            |   Tel: Int'l access + 33 99 02 46 81        |
|Prototyping Lab Manager     |   FAX: Int'l access + 33 99 02 40 98        |
|Dept STM/SEM                | TELEX: 740 284 F                            |

han@Apple.COM (Byron Han) (08/01/89)

In article <1374@irisa.irisa.fr> boissier@irisa.irisa.fr (franck boissiere,externes ) writes:
>
>I am trying to play sounds in background on a Mac II, it works fine except
>for one thing:
>
>	How can I check if the sound has been played? The SoundDone()
>procedure always returns TRUE when I am using a format 2 'snd ' ressource. 
>It returns the correct value only for the format 1 'snd ' ressources.
>
After doing the SndPlay, queue up a callback command.  Make sure that you
specify the callback procedure at SndNewChannel time and that you follow
the interrupt service routine guidelines in you callback (no memory mgr
calls, etc.)

The Sound Manager addendum to the Technical Notes gives a good example of
using callbacks to set a "sound is done" global variable and shows how
to setup A5 and restore it appropriately.

Good luck.
+-----------------------------------------------------------------------------+
| Disclaimer: Apple has no connection with my postings.                       |
+-----------------------------------------------------------------------------+ 
Byron Han, Communications Scapegoat   At Apple, we change the world everyday.
Apple Computer, Inc.                  -----------------------------------------
20525 Mariani Ave, MS27Y              Internet: han@apple.COM
Cupertino, CA 95014                   UUCP:{sun,voder,nsc,decwrl}!apple!han
------------------------------------  GENIE:BYRONHAN   CompuServe:72167,1664
ATTnet: 408-974-6450                  Applelink:HAN1   HAN1@applelink.apple.COM
-------------------------------------------------------------------------------

goldman@apple.com (Phil Goldman) (08/02/89)

In article <1374@irisa.irisa.fr> boissier@irisa.irisa.fr (franck 
boissiere,externes ) writes:
> I am trying to play sounds in background on a Mac II

Are you sure you want to do this?  Could you use the background 
notification manager instead?

It seems to me that only the frontmost app should be able to make noise.  
I don't think this is written in stone anywhere, but all of the apps I 
have seen follow this convention.

-Phil Goldman
Apple Computer