[comp.sys.next] As the recording skips...

carlson@aftac.tis.llnl.gov (John Carlson) (05/17/89)

Well, I haven't RTFM yet, but is there some way to continuously
repeat a sound file (with no opens and closes, resetting options, etc.).
(It would be nice.)

History repeats history repeats...

John Carlson

eht@cs.cmu.edu (Eric Thayer) (05/18/89)

#import <sound/sound.h>

main(argc, argv)
int argc;
char *argv[];
{
  SNDSoundStruct *snd;

  SNDReadSoundfile(argv[1], &snd);

  SNDReserve(SND_ACCESS_OUT, 0);
  for (;;) {
    SNDStartPlaying(snd, 0, 0, 0, SND_NULL_FUN, SND_NULL_FUN);
    SNDWait(0);
  }
}

ali@polya.Stanford.EDU (Ali T. Ozer) (05/18/89)

In article <191@ncis.tis.llnl.gov> John Carlson writes:
>Well, I haven't RTFM yet, but is there some way to continuously
>repeat a sound file (with no opens and closes, resetting options, etc.).
>(It would be nice.)

I don't think sndplay has such an option.

Using the Sound object, you can do it by having the "didPlay:" delegate
method invoke the sound again. This would let you play sounds in
the background (in its own Mach thread) but continuously repeat it:

- didPlay:sound 
{
  [sound play]; 
  return self;
}

- playContinuously:sound 
{
  [sound setDelegate:self];
  [sound play]; 
  return self;
}

Ali Ozer, NeXT Developer Support
aozer@NeXT.com