|
|
1.1 ! root 1: ! 2: /* ! 3: * recordtest - record many short soundfiles, such that when they are played ! 4: * back with playtest, an uninterrupted sound occurs. ! 5: */ ! 6: ! 7: #import <sound/sound.h> ! 8: #import <stdio.h> ! 9: ! 10: main (int argc, char *argv[]) ! 11: { ! 12: int size, err, j; ! 13: SNDSoundStruct *s[10], *s2; ! 14: ! 15: if (argc < 2) { ! 16: printf("usage : recordtest file ...\n"); ! 17: exit(0); ! 18: } ! 19: ! 20: // ! 21: // Allocate a fixed-sized buffer for each file ! 22: // ! 23: for (j=1; j<argc; j++) { ! 24: err = SNDAlloc(&s[j],4096,SND_FORMAT_MULAW_8,SND_RATE_CODEC,1,0); ! 25: if (err) fprintf(stderr,"recordtest : cannot allocate buffers\n"); ! 26: } ! 27: ! 28: // ! 29: // enqueue all the recording requests ! 30: // ! 31: printf("recording...\n"); ! 32: for (j=1; j<argc; j++) { ! 33: err = SNDStartRecording(s[j],j,1,0,0,0); ! 34: if (err) fprintf(stderr,"recordtest : cannot start recording\n"); ! 35: } ! 36: ! 37: // ! 38: // Wait for all of the requests to complete ! 39: // ! 40: SNDWait(0); ! 41: ! 42: // ! 43: // Write out the files ! 44: // ! 45: printf("writing files...\n"); ! 46: for (j=1; j<argc; j++) { ! 47: err = SNDWriteSoundfile(argv[j],s[j]); ! 48: if (err) fprintf(stderr,"recordtest : cannot write file %s...\n", ! 49: argv[j]); ! 50: } ! 51: ! 52: exit(0); ! 53: } ! 54: ! 55:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.