|
|
1.1 ! root 1: ! 2: /* ! 3: * playtest - this example plays all the soundfiles specified in the ! 4: * command line, without any gap between them. If the soundfiles are all ! 5: * of the same type, no samples are lost. ! 6: */ ! 7: ! 8: #import <sound/sound.h> ! 9: #import <stdio.h> ! 10: ! 11: main (int argc, char *argv[]) ! 12: { ! 13: int size, err, i; ! 14: SNDSoundStruct *s; ! 15: ! 16: if (argc < 2) { ! 17: fprintf(stderr,"usage : playtest file ...\n"); ! 18: exit(1); ! 19: } ! 20: ! 21: // ! 22: // read each soundfile and queue it up for playing. The termination ! 23: // function will free the sound ! 24: // ! 25: for (i=1; i<argc; i++) { ! 26: err = SNDReadSoundfile(argv[i],&s); ! 27: if (err) ! 28: fprintf(stderr,"playtest : Cannot read soundfile : %s\n",argv[i]); ! 29: else { ! 30: err = SNDStartPlaying(s,i,5,0,0,(SNDNotificationFun)SNDFree); ! 31: if (err) ! 32: fprintf(stderr,"playtest : Cannot play soundfile : %s\n", ! 33: argv[i]); ! 34: } ! 35: } ! 36: // ! 37: // wait for the sounds to finish ! 38: // Note that a tag of 0 means 'wait for all' ! 39: // ! 40: SNDWait(0); ! 41: ! 42: exit(0); ! 43: } ! 44:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.