diff options
author | Robin Gareus <robin@gareus.org> | 2017-11-10 22:52:10 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-11-12 00:22:34 +0100 |
commit | e6f2d77605343aa3addcd3cbe881236df1a654f8 (patch) | |
tree | 4f9bfb9cab5c1b387056e12e776ac1464ccc1426 /libs/ardour/amp.cc | |
parent | 93e32af9f40064a2adf194e91c2398db90876aea (diff) |
Add API to allow buffer offsets when applying gain
Diffstat (limited to 'libs/ardour/amp.cc')
-rw-r--r-- | libs/ardour/amp.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc index cd55514fc1..7a8232d90c 100644 --- a/libs/ardour/amp.cc +++ b/libs/ardour/amp.cc @@ -280,7 +280,7 @@ Amp::declick (BufferSet& bufs, samplecnt_t nframes, int dir) gain_t -Amp::apply_gain (AudioBuffer& buf, samplecnt_t sample_rate, samplecnt_t nframes, gain_t initial, gain_t target) +Amp::apply_gain (AudioBuffer& buf, samplecnt_t sample_rate, samplecnt_t nframes, gain_t initial, gain_t target, sampleoffset_t offset) { /* Apply a (potentially) declicked gain to the contents of @a buf * -- used by MonitorProcessor::run() @@ -292,11 +292,11 @@ Amp::apply_gain (AudioBuffer& buf, samplecnt_t sample_rate, samplecnt_t nframes, // if we don't need to declick, defer to apply_simple_gain if (initial == target) { - apply_simple_gain (buf, nframes, target); + apply_simple_gain (buf, nframes, target, offset); return target; } - Sample* const buffer = buf.data(); + Sample* const buffer = buf.data (offset); const gain_t a = 156.825f / (gain_t)sample_rate; // 25 Hz LPF, see [other] Amp::apply_gain() above for details gain_t lpf = initial; @@ -355,12 +355,12 @@ Amp::apply_simple_gain (BufferSet& bufs, samplecnt_t nframes, gain_t target, boo } void -Amp::apply_simple_gain (AudioBuffer& buf, samplecnt_t nframes, gain_t target) +Amp::apply_simple_gain (AudioBuffer& buf, samplecnt_t nframes, gain_t target, sampleoffset_t offset) { if (fabsf (target) < GAIN_COEFF_SMALL) { - memset (buf.data(), 0, sizeof (Sample) * nframes); + memset (buf.data (offset), 0, sizeof (Sample) * nframes); } else if (target != GAIN_COEFF_UNITY) { - apply_gain_to_buffer (buf.data(), nframes, target); + apply_gain_to_buffer (buf.data(offset), nframes, target); } } |