Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(int argc, char * argv[]) {
- struct Swav swav;
- FILE * infile, * outfile1, * outfile2;
- char * infilename = argv[1], * outfilename = argv[2];
- int lookahead = 3, flags = ADPCM_FLAG_RAW_OUTPUT, blocksize_pow2 = 0, overwrite = 0;
- struct AdpcmData adpcmData = adpcm_converter(infilename, outfilename, flags, blocksize_pow2, lookahead);
- outfile1 = adpcmData.file;
- outfile2 = fopen(strncat(outfilename, ".swav", 6), "wb");
- fseek(outfile1, 0, SEEK_SET);
- swav.file.type[0] = 'S';
- swav.file.type[1] = 'W';
- swav.file.type[2] = 'A';
- swav.file.type[3] = 'V';
- swav.file.magic = 0x0100feff;
- swav.file.fileSize = adpcmData.size + 20 + 16;
- swav.file.structSize = 16;
- swav.file.numBlocks = 1;
- swav.data.info.waveType = 2;
- swav.data.info.loop = 1;
- swav.data.info.sampleRate = adpcmData.sampleRate;
- swav.data.info.loopOffset = 0;
- swav.data.info.loopLength = adpcmData.numSamples;
- swav.data.type[0] = 'D';
- swav.data.type[1] = 'A';
- swav.data.type[2] = 'T';
- swav.data.type[3] = 'A';
- swav.data.size = swav.file.fileSize - 16;
- fread(swav.data.data, adpcmData.size, 1, outfile1);
- return fwrite(&swav, swav.file.fileSize, 1, outfile2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement