675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <ardour/amp.h>
-
-#include <algorithm>
+#include <cstring>
#include <cmath>
-#include <ardour/buffer_set.h>
-#include <ardour/buffer.h>
+#include <algorithm>
+#include "ardour/amp.h"
+#include "ardour/buffer_set.h"
+#include "ardour/audio_buffer.h"
namespace ARDOUR {
/** Apply a declicked gain to the audio buffers of @a bufs */
void
-Amp::run (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity)
+Amp::run_in_place (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity)
{
if (nframes == 0)
return;
- if (bufs.count().get(DataType::AUDIO) == 0)
+ if (bufs.count().n_audio() == 0)
return;
// assert(bufs.buffer_capacity(DataType::AUDIO) >= nframes);
// if we don't need to declick, defer to apply_simple_gain
-
if (initial == target) {
- for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
- apply_gain_to_buffer (i->data (), nframes, target);
+ if (target == 0.0) {
+ for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
+ memset (i->data(), 0, sizeof (Sample) * nframes);
+ }
+ } else if (target != 1.0) {
+ for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
+ apply_gain_to_buffer (i->data(), nframes, target);
+ }
}
return;
}