summaryrefslogtreecommitdiffstats
path: root/src/server/internals
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-07-31 15:12:38 +0000
committerDavid Robillard <d@drobilla.net>2012-07-31 15:12:38 +0000
commit8d559e4991a491b612e63d5a4deff0ab48a3d3dd (patch)
tree06da8b1d71f8068f12bc3f476b90734b67d9120c /src/server/internals
parenta41af6e41d60f8724809486b94ce1e6281c3bc31 (diff)
downloadingen-8d559e4991a491b612e63d5a4deff0ab48a3d3dd.tar.gz
ingen-8d559e4991a491b612e63d5a4deff0ab48a3d3dd.tar.bz2
ingen-8d559e4991a491b612e63d5a4deff0ab48a3d3dd.zip
Merge AudioBuffer into Buffer and avoid all the casting.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4584 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/internals')
-rw-r--r--src/server/internals/Controller.cpp9
-rw-r--r--src/server/internals/Delay.cpp13
-rw-r--r--src/server/internals/Note.cpp1
-rw-r--r--src/server/internals/Trigger.cpp7
4 files changed, 13 insertions, 17 deletions
diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp
index 571918fe..6c0e6858 100644
--- a/src/server/internals/Controller.cpp
+++ b/src/server/internals/Controller.cpp
@@ -23,7 +23,6 @@
#include "lv2/lv2plug.in/ns/ext/atom/util.h"
#include "raul/midi_events.h"
-#include "AudioBuffer.hpp"
#include "Engine.hpp"
#include "InputPort.hpp"
#include "InternalPlugin.hpp"
@@ -122,9 +121,9 @@ ControllerNode::control(ProcessContext& context, uint8_t control_num, uint8_t va
_learning = false;
}
- const Sample min_port_val = ((AudioBuffer*)_min_port->buffer(0).get())->value_at(0);
- const Sample max_port_val = ((AudioBuffer*)_max_port->buffer(0).get())->value_at(0);
- const Sample log_port_val = ((AudioBuffer*)_log_port->buffer(0).get())->value_at(0);
+ const Sample min_port_val = _min_port->buffer(0)->value_at(0);
+ const Sample max_port_val = _max_port->buffer(0)->value_at(0);
+ const Sample log_port_val = _log_port->buffer(0)->value_at(0);
if (log_port_val > 0.0f) {
// haaaaack, stupid negatives and logarithms
@@ -138,7 +137,7 @@ ControllerNode::control(ProcessContext& context, uint8_t control_num, uint8_t va
scaled_value = ((nval) * (max_port_val - min_port_val)) + min_port_val;
}
- if (control_num == ((AudioBuffer*)_param_port->buffer(0).get())->value_at(0)) {
+ if (control_num == _param_port->buffer(0)->value_at(0)) {
_audio_port->set_control_value(context, time, scaled_value);
}
}
diff --git a/src/server/internals/Delay.cpp b/src/server/internals/Delay.cpp
index 9e7f0afd..f478bd67 100644
--- a/src/server/internals/Delay.cpp
+++ b/src/server/internals/Delay.cpp
@@ -25,7 +25,6 @@
#include "raul/log.hpp"
#include "raul/midi_events.h"
-#include "AudioBuffer.hpp"
#include "Driver.hpp"
#include "Engine.hpp"
#include "InputPort.hpp"
@@ -144,17 +143,17 @@ static inline float cube_interp(const float fr, const float inm1, const float
void
DelayNode::process(ProcessContext& context)
{
- AudioBuffer* const delay_buf = (AudioBuffer*)_delay_port->buffer(0).get();
- AudioBuffer* const in_buf = (AudioBuffer*)_in_port->buffer(0).get();
- AudioBuffer* const out_buf = (AudioBuffer*)_out_port->buffer(0).get();
+ Buffer* const delay_buf = _delay_port->buffer(0).get();
+ Buffer* const in_buf = _in_port->buffer(0).get();
+ Buffer* const out_buf = _out_port->buffer(0).get();
NodeImpl::pre_process(context);
DelayNode* plugin_data = this;
- const float* const in = in_buf->data();
- float* const out = out_buf->data();
- const float delay_time = delay_buf->data()[0];
+ const float* const in = in_buf->samples();
+ float* const out = out_buf->samples();
+ const float delay_time = delay_buf->samples()[0];
const uint32_t buffer_mask = plugin_data->_buffer_mask;
const SampleRate sample_rate = context.engine().driver()->sample_rate();
float delay_samples = plugin_data->_delay_samples;
diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp
index e72e2d38..3bb7273a 100644
--- a/src/server/internals/Note.cpp
+++ b/src/server/internals/Note.cpp
@@ -24,7 +24,6 @@
#include "raul/log.hpp"
#include "raul/midi_events.h"
-#include "AudioBuffer.hpp"
#include "Driver.hpp"
#include "InputPort.hpp"
#include "InternalPlugin.hpp"
diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp
index 4c4c6ab6..55184b1f 100644
--- a/src/server/internals/Trigger.cpp
+++ b/src/server/internals/Trigger.cpp
@@ -22,7 +22,6 @@
#include "raul/log.hpp"
#include "raul/midi_events.h"
-#include "AudioBuffer.hpp"
#include "Engine.hpp"
#include "InputPort.hpp"
#include "InternalPlugin.hpp"
@@ -143,13 +142,13 @@ TriggerNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity
LOG(Raul::debug) << path() << " note " << (int)note_num << " on @ " << time << endl;
#endif
- Sample filter_note = ((AudioBuffer*)_note_port->buffer(0).get())->value_at(0);
+ Sample filter_note = _note_port->buffer(0)->value_at(0);
if (filter_note >= 0.0 && filter_note < 127.0 && (note_num == (uint8_t)filter_note)) {
_gate_port->set_control_value(context, time, 1.0f);
_trig_port->set_control_value(context, time, 1.0f);
_trig_port->set_control_value(context, time + 1, 0.0f);
_vel_port->set_control_value(context, time, velocity / 127.0f);
- assert(((AudioBuffer*)_trig_port->buffer(0).get())->data()[time - context.start()] == 1.0f);
+ assert(_trig_port->buffer(0)->samples()[time - context.start()] == 1.0f);
}
}
@@ -158,7 +157,7 @@ TriggerNode::note_off(ProcessContext& context, uint8_t note_num, FrameTime time)
{
assert(time >= context.start() && time <= context.end());
- if (note_num == lrintf(((AudioBuffer*)_note_port->buffer(0).get())->value_at(0)))
+ if (note_num == lrintf(_note_port->buffer(0)->value_at(0)))
_gate_port->set_control_value(context, time, 0.0f);
}