summaryrefslogtreecommitdiffstats
path: root/src/engine/JackAudioDriver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/JackAudioDriver.cpp')
-rw-r--r--src/engine/JackAudioDriver.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/engine/JackAudioDriver.cpp b/src/engine/JackAudioDriver.cpp
index 127dd1a9..9f3f55e2 100644
--- a/src/engine/JackAudioDriver.cpp
+++ b/src/engine/JackAudioDriver.cpp
@@ -1,15 +1,15 @@
/* This file is part of Ingen.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Ingen is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
- *
+ *
* Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
+ *
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -42,7 +42,7 @@ using namespace Raul;
namespace Ingen {
-
+
//// JackAudioPort ////
JackAudioPort::JackAudioPort(JackAudioDriver* driver, DuplexPort* patch_port)
@@ -58,7 +58,7 @@ JackAudioPort::JackAudioPort(JackAudioDriver* driver, DuplexPort* patch_port)
patch_port->buffer(0)->clear();
patch_port->fixed_buffers(true);
-}
+}
JackAudioPort::~JackAudioPort()
@@ -108,7 +108,7 @@ JackAudioPort::prepare_buffer(jack_nframes_t nframes)
assert(patch_buf->data() == jack_buf);
}
-
+
//// JackAudioDriver ////
JackAudioDriver::JackAudioDriver(Engine& engine)
@@ -130,7 +130,7 @@ JackAudioDriver::JackAudioDriver(Engine& engine)
JackAudioDriver::~JackAudioDriver()
{
deactivate();
-
+
if (_local_client)
jack_client_close(_client);
}
@@ -151,12 +151,12 @@ JackAudioDriver::attach(const std::string& server_name,
cerr << "[JackAudioDriver] Connected to JACK server '" <<
server_name << "'" << endl;
}
-
+
// Either server name not specified, or supplied server name does not exist
// Connect to default server
if (!_client) {
_client = jack_client_open(client_name.c_str(), JackNullOption, NULL);
-
+
if (_client)
cerr << "[JackAudioDriver] Connected to default JACK server." << endl;
}
@@ -174,13 +174,13 @@ JackAudioDriver::attach(const std::string& server_name,
_buffer_size = jack_get_buffer_size(_client);
_sample_rate = jack_get_sample_rate(_client);
-
+
jack_on_shutdown(_client, shutdown_cb, this);
jack_set_thread_init_callback(_client, thread_init_cb, this);
jack_set_sample_rate_callback(_client, sample_rate_cb, this);
jack_set_buffer_size_callback(_client, buffer_size_cb, this);
-
+
for (Raul::List<JackAudioPort*>::iterator i = _ports.begin(); i != _ports.end(); ++i)
(*i)->create();
@@ -190,7 +190,7 @@ JackAudioDriver::attach(const std::string& server_name,
void
JackAudioDriver::activate()
-{
+{
if (_is_activated) {
cerr << "[JackAudioDriver] Jack driver already activated." << endl;
return;
@@ -242,7 +242,7 @@ JackAudioDriver::deactivate()
*
* Realtime safe, this is to be called at the beginning of a process cycle to
* insert (and actually begin using) a new port.
- *
+ *
* See create_port() and remove_port().
*/
void
@@ -270,7 +270,7 @@ JackAudioDriver::remove_port(const Path& path)
for (Raul::List<JackAudioPort*>::iterator i = _ports.begin(); i != _ports.end(); ++i)
if ((*i)->patch_port()->path() == path)
return (Raul::List<DriverPort*>::Node*)(_ports.erase(i));
-
+
cerr << "[JackAudioDriver::remove_port] WARNING: Unable to find port " << path << endl;
return NULL;
}
@@ -323,7 +323,7 @@ JackAudioDriver::driver_port(const Path& path)
* \callgraph
*/
int
-JackAudioDriver::_process_cb(jack_nframes_t nframes)
+JackAudioDriver::_process_cb(jack_nframes_t nframes)
{
if (nframes == 0 || ! _is_activated) {
if (_flag == 1)
@@ -332,7 +332,7 @@ JackAudioDriver::_process_cb(jack_nframes_t nframes)
}
// FIXME: all of this time stuff is screwy
-
+
// FIXME: support nframes != buffer_size, even though that never damn well happens
assert(nframes == _buffer_size);
@@ -355,11 +355,11 @@ JackAudioDriver::_process_cb(jack_nframes_t nframes)
i != _engine.process_slaves().end(); ++i) {
(*i)->context().set_time_slice(nframes, start_of_current_cycle, end_of_current_cycle);
}
-
+
// Process events that came in during the last cycle
// (Aiming for jitter-free 1 block event latency, ideally)
_engine.process_events(_process_context);
-
+
// Set buffers of patch ports to Jack port buffers (zero-copy processing)
for (Raul::List<JackAudioPort*>::iterator i = _ports.begin(); i != _ports.end(); ++i) {
assert(*i);
@@ -368,11 +368,11 @@ JackAudioDriver::_process_cb(jack_nframes_t nframes)
if (_engine.midi_driver())
_engine.midi_driver()->pre_process(_process_context);
-
+
// Run root patch
if (_root_patch)
_root_patch->process(_process_context);
-
+
if (_engine.midi_driver())
_engine.midi_driver()->post_process(_process_context);
@@ -382,8 +382,8 @@ JackAudioDriver::_process_cb(jack_nframes_t nframes)
}
-void
-JackAudioDriver::_thread_init_cb()
+void
+JackAudioDriver::_thread_init_cb()
{
// Initialize thread specific data
_jack_thread = Thread::create_for_this_thread("Jack");
@@ -392,8 +392,8 @@ JackAudioDriver::_thread_init_cb()
assert(ThreadManager::current_thread_id() == THREAD_PROCESS);
}
-void
-JackAudioDriver::_shutdown_cb()
+void
+JackAudioDriver::_shutdown_cb()
{
cout << "[JackAudioDriver] Jack shutdown. Exiting." << endl;
_engine.quit();
@@ -402,7 +402,7 @@ JackAudioDriver::_shutdown_cb()
int
-JackAudioDriver::_sample_rate_cb(jack_nframes_t nframes)
+JackAudioDriver::_sample_rate_cb(jack_nframes_t nframes)
{
if (_is_activated) {
cerr << "[JackAudioDriver] On-the-fly sample rate changing not supported (yet). Aborting." << endl;
@@ -415,7 +415,7 @@ JackAudioDriver::_sample_rate_cb(jack_nframes_t nframes)
int
-JackAudioDriver::_buffer_size_cb(jack_nframes_t nframes)
+JackAudioDriver::_buffer_size_cb(jack_nframes_t nframes)
{
if (_root_patch) {
_root_patch->set_buffer_size(nframes);