File:  [NeXTSTEP 3.3 examples] / Examples / SoundAndMusic / SoundLibrary / converttest.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


/*
 * converttest.c - an example conversion that takes an mulaw codec file
 * as input and writes a new file (11 times bigger) that is the equivalent
 * 22kHz stereo 16 bit linear soundfile
 */

#import <sound/sound.h>
#import <stdio.h>

check_error(int err)
{
    if (err) {
	printf("Error : %s\n",SNDSoundError(err));
	exit(1);
    }
    return err;
}

main (int argc, char *argv[])
{
    int err;
    SNDSoundStruct *s1, *s2;
    SNDSoundStruct header = {
	SND_MAGIC, 0, 0, SND_FORMAT_LINEAR_16, (int)SND_RATE_LOW, 2, "" };

    check_error(argc != 3);
    
    err = SNDReadSoundfile(argv[1],&s1);
    check_error(err);
    s2 = &header;
    err = SNDConvertSound(s1,&s2);
    check_error(err);
    err = SNDWriteSoundfile(argv[2],s2);
    check_error(err);
    exit(0);
}



unix.superglobalmegacorp.com

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