|
|
1.1 ! root 1: ! 2: /* ! 3: * converttest.c - an example conversion that takes an mulaw codec file ! 4: * as input and writes a new file (11 times bigger) that is the equivalent ! 5: * 22kHz stereo 16 bit linear soundfile ! 6: */ ! 7: ! 8: #import <sound/sound.h> ! 9: #import <stdio.h> ! 10: ! 11: check_error(int err) ! 12: { ! 13: if (err) { ! 14: printf("Error : %s\n",SNDSoundError(err)); ! 15: exit(1); ! 16: } ! 17: return err; ! 18: } ! 19: ! 20: main (int argc, char *argv[]) ! 21: { ! 22: int err; ! 23: SNDSoundStruct *s1, *s2; ! 24: SNDSoundStruct header = { ! 25: SND_MAGIC, 0, 0, SND_FORMAT_LINEAR_16, (int)SND_RATE_LOW, 2, "" }; ! 26: ! 27: check_error(argc != 3); ! 28: ! 29: err = SNDReadSoundfile(argv[1],&s1); ! 30: check_error(err); ! 31: s2 = &header; ! 32: err = SNDConvertSound(s1,&s2); ! 33: check_error(err); ! 34: err = SNDWriteSoundfile(argv[2],s2); ! 35: check_error(err); ! 36: exit(0); ! 37: } ! 38: ! 39:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.