Mercurial > hg > decimation
comparison garage-resampler/resample.cpp @ 14:8c87484e6d79
Minor tidy
author | Chris Cannam |
---|---|
date | Fri, 18 Oct 2013 12:24:42 +0100 |
parents | 1b95c3a52b45 |
children | 66abf86c864d |
comparison
equal
deleted
inserted
replaced
13:1b95c3a52b45 | 14:8c87484e6d79 |
---|---|
47 | 47 |
48 if (version) { | 48 if (version) { |
49 cerr << "resample v0.1" << endl; //!!! | 49 cerr << "resample v0.1" << endl; //!!! |
50 return 0; | 50 return 0; |
51 } | 51 } |
52 | |
53 cerr << "help = " << help << ", targetRate = " << targetRate << ", optionIndex = " << optind << ", argc = " << argc << endl; | |
54 | 52 |
55 if (help || targetRate == 0 || optind + 2 != argc) { | 53 if (help || targetRate == 0 || optind + 2 != argc) { |
56 cerr << endl; | 54 cerr << endl; |
57 cerr << "usage: " << argv[0] << " --to <rate> <infile.wav> <outfile.wav>" << endl; | 55 cerr << "usage: " << argv[0] << " --to <rate> <infile.wav> <outfile.wav>" << endl; |
58 cerr << endl; | 56 cerr << endl; |
171 rcount = resamplers[c]->process(prebuf[c], postbuf[c], inputLatency); | 169 rcount = resamplers[c]->process(prebuf[c], postbuf[c], inputLatency); |
172 for (int i = 0; i < rcount; ++i) { | 170 for (int i = 0; i < rcount; ++i) { |
173 obuf[i * channels + c] = postbuf[c][i]; | 171 obuf[i * channels + c] = postbuf[c][i]; |
174 } | 172 } |
175 } | 173 } |
176 sf_writef_float(sndfileOut, obuf, rcount); | 174 sf_writef_float(sndfileOut, obuf, outputLatency); |
177 n += rcount; | 175 n += outputLatency; |
178 | 176 |
179 sf_close(sndfile); | 177 sf_close(sndfile); |
180 sf_close(sndfileOut); | 178 sf_close(sndfileOut); |
181 | 179 |
182 for (int c = 0; c < channels; ++c) { | 180 for (int c = 0; c < channels; ++c) { |