home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * recordtest - record many short soundfiles, such that when they are played
- * back with playtest, an uninterrupted sound occurs.
- */
-
- #import <sound/sound.h>
- #import <stdio.h>
-
- main (int argc, char *argv[])
- {
- int size, err, j;
- SNDSoundStruct *s[10], *s2;
-
- if (argc < 2) {
- printf("usage : recordtest file ...\n");
- exit(0);
- }
-
- //
- // Allocate a fixed-sized buffer for each file
- //
- for (j=1; j<argc; j++) {
- err = SNDAlloc(&s[j],4096,SND_FORMAT_MULAW_8,SND_RATE_CODEC,1,0);
- if (err) fprintf(stderr,"recordtest : cannot allocate buffers\n");
- }
-
- //
- // enqueue all the recording requests
- //
- printf("recording...\n");
- for (j=1; j<argc; j++) {
- err = SNDStartRecording(s[j],j,1,0,0,0);
- if (err) fprintf(stderr,"recordtest : cannot start recording\n");
- }
-
- //
- // Wait for all of the requests to complete
- //
- SNDWait(0);
-
- //
- // Write out the files
- //
- printf("writing files...\n");
- for (j=1; j<argc; j++) {
- err = SNDWriteSoundfile(argv[j],s[j]);
- if (err) fprintf(stderr,"recordtest : cannot write file %s...\n",
- argv[j]);
- }
-
- exit(0);
- }
-
-
-