[comp.sys.next] Playing a sequence of Sounds

jacob@gore.com (Jacob Gore) (05/31/90)

I need to have a sequence of sounds played out.  Each sound is under a
second long, and I need a couple of seconds pause between successive
sounds.

It seems simple enough, but I can't get it to work.  The program hangs on
around the 4th sound (depending on what the pause is).

I tried (under 1.0):

    1.	Doing it in an Application, and in a simple program

    2.  Using and not using -didPlay: in a delegate, which, as far as I
	can tell, never gets called (I put printf's in it, but never got
	any output).

    3.	Using no delay, using usleep() for delay, and using

	    for (startTime = time(0); time(0) < startTime + delay; ) {
		cthread_yield();
	    }

	for delay.

And, since setting sound fields of buttons in IB does have the desired
effect (clicking on all the buttons sequentially played all the sounds), I
even tried:

    4.	Using a dummy button, assigning sounds to it (with -setSound:, one
	at a time), and doing a -performClick: on it.

Like I said, the task seems simple enough.  Can this be done?  What's the
trick?

Jacob
--
Jacob Gore		Jacob@Gore.Com			boulder!gore!jacob

clp@wjh12.harvard.edu (Charles L. Perkins) (06/04/90)

I've hit many of these bugs (as I've mentioned in this group before).

1.0 has a problem with playing sounds all in a row, even non-continous
 ones...I haven't fully analyzed the failure modes but... if all you want
 is another idea of how to procede, grab the code in my Reverb App in the
 archives that uses the underlying SND() C function layer -- I've never
 seen any problems at that layer and below...

Also note that SNDplay() starts a separate thread to play a sound and
 that may interact strangely with any thread stuff you may try to do.

								Charles

chada@cpsin3.uucp (Satyanarayan Chada) (06/05/90)

In article <130075@gore.com> jacob@gore.com (Jacob Gore) writes:
>I need to have a sequence of sounds played out.  Each sound is under a
>second long, and I need a couple of seconds pause between successive
>sounds.
>

There is a sample program in /NextDeveloper/Examples/Sound/chaintest.c.
I believe that the sample program does exactly what you are trying to
do.  I hope it will be of help

--Satch