|
|
Sample Programs from NeXSTEP 3.3
/*
* playtest - this example plays all the soundfiles specified in the
* command line, without any gap between them. If the soundfiles are all
* of the same type, no samples are lost.
*/
#import <sound/sound.h>
#import <stdio.h>
main (int argc, char *argv[])
{
int size, err, i;
SNDSoundStruct *s;
if (argc < 2) {
fprintf(stderr,"usage : playtest file ...\n");
exit(1);
}
//
// read each soundfile and queue it up for playing. The termination
// function will free the sound
//
for (i=1; i<argc; i++) {
err = SNDReadSoundfile(argv[i],&s);
if (err)
fprintf(stderr,"playtest : Cannot read soundfile : %s\n",argv[i]);
else {
err = SNDStartPlaying(s,i,5,0,0,(SNDNotificationFun)SNDFree);
if (err)
fprintf(stderr,"playtest : Cannot play soundfile : %s\n",
argv[i]);
}
}
//
// wait for the sounds to finish
// Note that a tag of 0 means 'wait for all'
//
SNDWait(0);
exit(0);
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.