// // Programmer: Craig Stuart Sapp // Creation Date: Wed Jan 23 21:26:08 PST 2002 // Last Modified: Sun Feb 3 11:08:04 PST 2002 (updated for soundfile 2.0) // Last Modified: Sun Aug 29 03:33:21 PDT 2004 (updated for compiling in GCC3) // Filename: ...soundfile/examples/makemulti.cpp // Syntax: C++ // // Description: Takes several mono input files and writes them // all to a single multi-channel soundfile. // The last filename is assumed to be the name of the // file to be written. If the input files are not all // the same length, then zeros will be appended to the // channels of the shorter channels as needed. // If you have different sampling rates in each // input file, then the output sampling rate will // be that of the first input file -- the sampling // rates *will not* be converted by this program. // #include "soundfile.h" #include #ifndef OLDCPP #include using namespace std; #else #include #endif int main(int argc, char** argv) { Options options; options.process(argc, argv); int insize = options.getArgCount() - 1; SoundFileRead *inputs = new SoundFileRead[insize]; int i; int maxsample = 0; for (i=0; i maxsample) { maxsample = inputs[i].getSamples(); } } const char* outputname = options.getArg(insize + 1); SoundHeader header = inputs[0]; header.setChannels(insize); SoundFileWrite outsound(outputname, header); int channel; for (i=0; i