From cbb7f6d863a24aa3caae4751ed742a3cc4f3691d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 11 Jul 2019 09:15:42 -0600 Subject: [PATCH] use const int rather than macro --- libs/ardour/disk_reader.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/ardour/disk_reader.cc b/libs/ardour/disk_reader.cc index d40f17a23d..4b13b1678a 100644 --- a/libs/ardour/disk_reader.cc +++ b/libs/ardour/disk_reader.cc @@ -1454,21 +1454,22 @@ DiskReader::DeclickAmp::apply_gain (AudioBuffer& buf, samplecnt_t n_samples, con const float a = _a; Sample* const buffer = buf.data (); -#define MAX_NPROC 16 + const int max_nproc = 16; uint32_t remain = n_samples; uint32_t offset = 0; while (remain > 0) { - uint32_t n_proc = remain > MAX_NPROC ? MAX_NPROC : remain; + uint32_t n_proc = remain > max_nproc ? max_nproc : remain; + std::cerr << "g = " << g << std::endl; for (uint32_t i = 0; i < n_proc; ++i) { buffer[offset + i] *= g; } #if 1 g += a * (target - g); #else /* accurate exponential fade */ - if (n_proc == MAX_NPROC) { + if (n_proc == max_nproc) { g += a * (target - g); } else { - g = target - (target - g) * expf (_l * n_proc / MAX_NPROC); + g = target - (target - g) * expf (_l * n_proc / max_nproc); } #endif remain -= n_proc;