File:  [NeXTSTEP 3.3 examples] / Examples / SoundAndMusic / SoundLibrary / recordtest.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:48:25 2018 UTC (8 years, 1 month ago) by root
Branches: NeXT, MAIN
CVS tags: NeXTSTEP33, HEAD
Sample Programs from NeXSTEP 3.3


/*
 * 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);
}



unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.