diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-10-01 23:51:33 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-10-01 23:52:42 +0200 |
| commit | e873f8724b179ebee28170866f1de222d7a68497 (patch) | |
| tree | cc1ca3071a2b753e8fc00def109c9fd06c4f8d83 /src | |
| parent | b06d4af215b38fd909670d14ddcefc9b6edeb054 (diff) | |
Remove _nch member variable.
Diffstat (limited to 'src')
| -rw-r--r-- | src/leqm_nrt.cc | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/leqm_nrt.cc b/src/leqm_nrt.cc index dc630a3..357d1c9 100644 --- a/src/leqm_nrt.cc +++ b/src/leqm_nrt.cc @@ -58,12 +58,11 @@ class Worker { public: Worker(std::vector<double> buffer, int nsamples, int nch, std::vector<double> const& ir, Sum* sum, std::vector<double> chconf) - : _nch(nch) - , _ir(ir) + : _ir(ir) , _sum(sum) , _chconf(chconf) { - _thread = std::thread(std::bind(&Worker::process, this, buffer, nsamples)); + _thread = std::thread(std::bind(&Worker::process, this, buffer, nsamples, nch)); } Worker(Worker& other) = delete; @@ -82,7 +81,7 @@ public: private: - void process(std::vector<double>& buffer, int nsamples) + void process(std::vector<double>& buffer, int nsamples, int nch) { auto accumulate_ch = [](std::vector<double>& ch_accumulator, std::vector<double> const& input_channel, int nsamples) { for (auto i = 0; i < nsamples; i++) { @@ -115,17 +114,17 @@ private: return squared; }; - /* Round-up in case nsamples is not a multiple of _nch */ - int const frames = (nsamples + _nch - 1) / _nch; + /* Round-up in case nsamples is not a multiple of nch */ + int const frames = (nsamples + nch - 1) / nch; std::vector<double> ch_sum_accumulator_norm(frames); std::vector<double> ch_sum_accumulator_conv(frames); - for (int ch = 0; ch < _nch; ch++) { + for (int ch = 0; ch < nch; ch++) { std::vector<double> normalized_buffer(frames); - for (int n = ch, m = 0; n < nsamples; n += _nch, m++) { + for (int n = ch, m = 0; n < nsamples; n += nch, m++) { // use this for calibration depending on channel config for ex. chconf[6] = {1.0, 1.0, 1.0, 1.0, 0.707945784, 0.707945784} could be the default for 5.1 soundtracks //so not normalized but calibrated normalized_buffer[m] = buffer[n] * _chconf[ch]; //this scale amplitude according to specified calibration @@ -139,7 +138,6 @@ private: _sum->sum_samples(ch_sum_accumulator_norm, ch_sum_accumulator_conv, frames); } - int _nch; std::vector<double> const& _ir; Sum* _sum; std::vector<double> _chconf; |
