home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Examples / SoundAndMusic / SoundLibrary / hosttest.c < prev    next >
Text File  |  1990-10-10  |  747b  |  46 lines

  1.  
  2. /*
  3.  * hosttest.c - play a soundfile on one or more named hosts.
  4.  */
  5.  
  6. #import <sound/sound.h>
  7. #import <stdio.h>
  8.  
  9. check_error(int err)
  10. {
  11.     if (err) {
  12.     fprintf(stderr,"Error : %s\n",SNDSoundError(err));
  13.     exit(1);
  14.     }
  15. }
  16.  
  17. main (int argc, char *argv[])
  18. {
  19.     int err, j;
  20.     SNDSoundStruct *s;
  21.  
  22.     if (argc < 3) {
  23.     fprintf(stderr,"usage : hosttest file hostname ...\n");
  24.     exit(1);
  25.     }
  26.     
  27.     for (j=2; j<argc; j++) {        //check that all hosts are available
  28.     err = SNDSetHost(argv[j]);
  29.     check_error(err);
  30.     }
  31.  
  32.     err = SNDReadSoundfile(argv[1],&s);
  33.     check_error(err);
  34.  
  35.     for (j=2; j<argc; j++) {
  36.     err = SNDSetHost(argv[j]);
  37.     check_error(err);
  38.     err = SNDStartPlaying(s,j,0,0,0,0);
  39.     check_error(err);
  40.     }
  41.     SNDWait(0);
  42.     exit(0);
  43. }
  44.  
  45.  
  46.