summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/JackAudioDriver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/engine/JackAudioDriver.cpp')
-rw-r--r--src/libs/engine/JackAudioDriver.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/libs/engine/JackAudioDriver.cpp b/src/libs/engine/JackAudioDriver.cpp
index 59e30e5c..39747f9a 100644
--- a/src/libs/engine/JackAudioDriver.cpp
+++ b/src/libs/engine/JackAudioDriver.cpp
@@ -51,6 +51,7 @@ JackAudioPort::JackAudioPort(JackAudioDriver* driver, DuplexPort<sample>* patch_
m_driver(driver),
m_jack_port(NULL),
m_jack_buffer(NULL),
+ //m_jack_buffer(NULL),
m_patch_port(patch_port)
{
//assert(patch_port->tied_port() != NULL);
@@ -61,7 +62,7 @@ JackAudioPort::JackAudioPort(JackAudioDriver* driver, DuplexPort<sample>* patch_
(patch_port->is_input()) ? JackPortIsInput : JackPortIsOutput,
0);
- m_jack_buffer = new DriverBuffer<jack_sample_t>(driver->buffer_size());
+ //m_jack_buffer = new DriverBuffer<jack_sample_t>(driver->buffer_size());
patch_port->fixed_buffers(true);
}
@@ -89,22 +90,32 @@ JackAudioPort::remove_from_driver()
void
JackAudioPort::prepare_buffer(jack_nframes_t nframes)
{
- // Technically this doesn't need to be done every time for output ports
- m_jack_buffer->set_data((jack_default_audio_sample_t*)
+ // FIXME: Technically this doesn't need to be done every time for output ports
+ /*m_jack_buffer->set_data((jack_default_audio_sample_t*)
jack_port_get_buffer(m_jack_port, nframes));
+ m_patch_port->buffer(0)->join(m_jack_buffer);
+*/
+ jack_sample_t* jack_buf = (jack_sample_t*)jack_port_get_buffer(m_jack_port, nframes);
+
+ if (jack_buf != m_jack_buffer) {
+ //cerr << "Jack buffer: " << jack_buf << endl;
+ m_patch_port->buffer(0)->set_data(jack_buf);
+ m_jack_buffer = jack_buf;
+ }
+
//assert(m_patch_port->tied_port() != NULL);
- // FIXME: fixed_buffers switch on/off thing can be removed once this shit
+ // FIXME: fixed_buffers switch on/off thing can be removed once this
// gets figured out and assertions can go away
- m_patch_port->fixed_buffers(false);
- m_patch_port->buffer(0)->join(m_jack_buffer);
+ //m_patch_port->fixed_buffers(false);
+ //m_patch_port->buffer(0)->join(m_jack_buffer);
//m_patch_port->tied_port()->buffer(0)->join(m_jack_buffer);
- m_patch_port->fixed_buffers(true);
+ //m_patch_port->fixed_buffers(true);
//assert(m_patch_port->buffer(0)->data() == m_patch_port->tied_port()->buffer(0)->data());
- assert(m_patch_port->buffer(0)->data() == m_jack_buffer->data());
+ assert(m_patch_port->buffer(0)->data() == jack_buf);
}
@@ -329,7 +340,7 @@ JackAudioDriver::m_process_cb(jack_nframes_t nframes)
// Run root patch
assert(m_root_patch != NULL);
m_root_patch->process(nframes);
-
+
return 0;
}