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

1.1     ! root        1: /*
        !             2:  * compresstest - compress or decompress a soundfile.  If the input file is in
        !             3:  * a linear format, it is compressed.  If it is in a compressed format, it is
        !             4:  * decompressed.  Compression may be bit-faithful (decompression
        !             5:  * reproduces the sound exactly) or non-bit-faithful.  An integer controlling
        !             6:  * the compression amount can also be specified.  See the documentation in
        !             7:  * /usr/include/sound/convertsound.h for more information.
        !             8:  */
        !             9: #import <sound/sound.h>
        !            10: #import <stdio.h>
        !            11: 
        !            12: check_error(int err)
        !            13: {
        !            14:     if (err) {
        !            15:        printf("Error : %d, %s\n",err,SNDSoundError(err));
        !            16:        exit(1);
        !            17:     }
        !            18:     return err;
        !            19: }
        !            20: 
        !            21: main (int argc, char *argv[])
        !            22: {
        !            23:     int err;
        !            24:     SNDSoundStruct *s1, *s2;
        !            25:     char *infile, *outfile;
        !            26:     int bitFaithful = 1;
        !            27:     int dropBits = 4;
        !            28: 
        !            29:     if (argc != 3) {
        !            30:        printf("usage : compresstest file1 file2\n");
        !            31:        exit(1);
        !            32:     }
        !            33:     
        !            34:     err = SNDReadSoundfile(argv[1] ,&s1);
        !            35:     check_error(err);
        !            36:     err = SNDCompressSound(s1, &s2, bitFaithful, dropBits);
        !            37:     check_error(err);
        !            38:     err = SNDWriteSoundfile(argv[2],s2);
        !            39:     check_error(err);
        !            40:     exit(0);
        !            41: }

unix.superglobalmegacorp.com

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