MCPcopy Create free account
hub / github.com/Signalsmith-Audio/reverb-example-code / makeMono

Method makeMono

wav.h:208–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206 }
207
208 void makeMono() {
209 std::vector<double> newSamples(samples.size()/channels, 0);
210
211 for (size_t channel = 0; channel < channels; ++channel) {
212 for (size_t i = 0; i < newSamples.size(); ++i) {
213 newSamples[i] += samples[i*channels + channel];
214 }
215 }
216 for (size_t i = 0; i < newSamples.size(); ++i) {
217 newSamples[i] /= channels;
218 }
219
220 channels = 1;
221 samples = newSamples;
222 }
223};
224
225#endif // RIFF_WAVE_H_

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected