Annotation of Examples/SoundAndMusic/SoundLibrary/recordfiletest.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * recordfiletest - use the sound library to record directly to a file.
        !             3:  * This example records from the codec microphone, but note that using
        !             4:  * SNDStartRecordingFile() is especially useful for high sample rate
        !             5:  * recording from the DSP.  Also note that when recording from the DSP, the
        !             6:  * dataFormat of the resulting soundfile must be changed to a playable format
        !             7:  * (like SND_FORMAT_LINEAR_16) before it can be played back.
        !             8:  *
        !             9:  * The use of SNDAlloc() causes virtual memory to be allocated, but since
        !            10:  * samples are written directly to a file, this VM is never touched.
        !            11:  */
        !            12: #import <sound/sound.h>
        !            13: #import <stdio.h>
        !            14: 
        !            15: #define        SECONDS 5.0
        !            16: 
        !            17: main (int argc, char *argv[])
        !            18: {
        !            19:     int err;
        !            20:     SNDSoundStruct *s;
        !            21: 
        !            22:     if (argc != 2) {
        !            23:        printf("usage : recordfiletest file\n");
        !            24:        exit(1);
        !            25:     }
        !            26:     
        !            27:     err = SNDAlloc(&s,SECONDS*SND_RATE_CODEC,SND_FORMAT_MULAW_8,
        !            28:                   SND_RATE_CODEC,1,0);
        !            29:     if (err) fprintf(stderr,"recordfiletest : cannot allocate buffer\n");
        !            30:     
        !            31:     printf("recording...\n");
        !            32:     err = SNDStartRecordingFile(argv[1],s,1,1,0,0,0);
        !            33:     if (err) fprintf(stderr,"recordfiletest : cannot start recording\n");
        !            34:     
        !            35:     SNDWait(0);
        !            36:     SNDFree(s);
        !            37:     exit(0);
        !            38: }

unix.superglobalmegacorp.com

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