// // Programmer: Craig Stuart Sapp // Creation Date: Thu May 1 11:57:59 GMT-0800 1997 // Last Modified: Thu Apr 16 21:25:54 PDT 1998 // Filename: ...sig/doc/examples/sig/sigfile/concatenate/concatenate.cpp // Syntax: C++; sig // // Description: combine soundfiles serially into one output file. // Strings together any number of soundfiles sequentially into one output // file. Blank space can be specified between soundfiles in output. If // any input sound is a stereo file, then the output soundfile will be // stereo, and any mono files will duplicate their channels into both the // left and right of the output soundfile. // // Usage: concatenate [-q][-s samples | -t time] insound(s) outsound // // Options: // -s = the number of blank samples to add between input soundfiles // -t = the time in seconds of blank samples to add between input // soundfiles. Overrides the -s option. Sampling rate of the // first soundfile is used to calculate blank gap. // -q = quiet mode. Do not display message as each soundfile is read. // --options = list of all options, aliases and defaults // #include "sigAudio.h" #include #ifndef OLDCPP #include using namespace std; #else #include #endif void checkOptions(Options& opts); void example(void); void usage(const char* command); /////////////////////////////////////////////////////////////////////////// int main(int argc, char* argv[]) { Options options(argc, argv); checkOptions(options); // determine how many samples of silence to add between soundfiles int numBlankSamples; SoundHeader header; header.setHeader(options.getArg(1)); if (options.getInt("time") > 0) { numBlankSamples = (int)(options.getDouble("time") * header.getSrate() + 0.5); } else if (options.getInt("samples") > 0) { numBlankSamples = options.getInt("samples"); } else { numBlankSamples = 0; } int numInSounds = options.getArgCount() - 1; // check to see if there is a stereo file in the list of soundfiles int i; int chan = 1; for (i=0; i