diff options
author | Christian Glöckner <cgloeckner@freenet.de> | 2016-01-25 14:14:22 +0100 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2016-02-09 09:03:17 +0100 |
commit | 100e2d3bd46f64df730c8a375559680c577036ef (patch) | |
tree | 952e0ce0a1c5b6efb792c50617baa1484ba51e39 /drumgizmo/jackclient.cc | |
parent | e5a773e80bee619987aacd40cc3205acfe146e9c (diff) |
applied clang-format
Diffstat (limited to 'drumgizmo/jackclient.cc')
-rw-r--r-- | drumgizmo/jackclient.cc | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/drumgizmo/jackclient.cc b/drumgizmo/jackclient.cc index 3d1a836..eb35bf6 100644 --- a/drumgizmo/jackclient.cc +++ b/drumgizmo/jackclient.cc @@ -28,19 +28,22 @@ #include "jackclient.h" -JackProcess::~JackProcess() { -} +JackProcess::~JackProcess() {} // -------------------------------------------------------------------- -JackPort::JackPort(JackClient& client, std::string const & name, const char * type, JackPortFlags flags) - : client{client.client} - // register jack port for given client - , port{jack_port_register(this->client, name.c_str(), type, flags, 0)} { +JackPort::JackPort(JackClient &client, std::string const &name, + const char *type, JackPortFlags flags) + : client{client.client} // register jack port for given client + , + port{jack_port_register(this->client, name.c_str(), type, flags, 0)} +{ } -JackPort::~JackPort() { - if (port != nullptr) { +JackPort::~JackPort() +{ + if (port != nullptr) + { assert(client != nullptr); jack_port_unregister(client, port); } @@ -48,51 +51,54 @@ JackPort::~JackPort() { // -------------------------------------------------------------------- -int _wrap_jack_process(jack_nframes_t nframes, void* arg){ - return static_cast<JackClient*>(arg)->process(nframes); +int _wrap_jack_process(jack_nframes_t nframes, void *arg) +{ + return static_cast<JackClient *>(arg)->process(nframes); } -JackClient::JackClient() - : client{nullptr} - , processes{} - , is_active{false} { +JackClient::JackClient() : client{nullptr}, processes{}, is_active{false} +{ jack_status_t status; client = jack_client_open("DrumGizmo", JackNullOption, &status); jack_set_process_callback(client, _wrap_jack_process, this); } -JackClient::~JackClient() { - if (client != nullptr) { +JackClient::~JackClient() +{ + if (client != nullptr) + { jack_client_close(client); } } -void JackClient::add(JackProcess& process) { - processes.insert(&process); -} +void JackClient::add(JackProcess &process) { processes.insert(&process); } -void JackClient::remove(JackProcess& process) { - processes.erase(&process); -} +void JackClient::remove(JackProcess &process) { processes.erase(&process); } -void JackClient::activate() { - if (!is_active) { +void JackClient::activate() +{ + if (!is_active) + { jack_activate(client); } is_active = true; } -int JackClient::process(jack_nframes_t num_frames) { - for (auto& ptr: processes) { +int JackClient::process(jack_nframes_t num_frames) +{ + for (auto &ptr : processes) + { ptr->process(num_frames); } return 0; } -std::size_t JackClient::getBufferSize() const { +std::size_t JackClient::getBufferSize() const +{ return jack_get_buffer_size(client); } -std::size_t JackClient::getSampleRate() const { +std::size_t JackClient::getSampleRate() const +{ return jack_get_sample_rate(client); } |