summaryrefslogtreecommitdiff
path: root/drumgizmo/jackclient.cc
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2016-07-13 16:33:11 +0200
committerAndré Nusser <andre.nusser@googlemail.com>2016-07-13 17:28:11 +0200
commit32606894c67e6be27ba853a8bc3e97c808c14987 (patch)
treef31c9d1bc08e2095b2cd724b5f0f0a27526c5a01 /drumgizmo/jackclient.cc
parentd71485534d3a683cae4993815f59ff68263a6751 (diff)
Introduce output engine isFreewheeling method.
Diffstat (limited to 'drumgizmo/jackclient.cc')
-rw-r--r--drumgizmo/jackclient.cc25
1 files changed, 19 insertions, 6 deletions
diff --git a/drumgizmo/jackclient.cc b/drumgizmo/jackclient.cc
index fb71b1b..8bf0939 100644
--- a/drumgizmo/jackclient.cc
+++ b/drumgizmo/jackclient.cc
@@ -63,6 +63,11 @@ void JackClient::latencyCallback(jack_latency_callback_mode_t mode,
static_cast<JackClient*>(arg)->jackLatencyCallback(mode);
}
+void JackClient::freewheelCallback(int is_freewheeling, void* arg)
+{
+ static_cast<JackClient*>(arg)->jackFreewheelCallback(is_freewheeling);
+}
+
JackClient::JackClient()
: client{nullptr}
, processes{}
@@ -70,13 +75,11 @@ JackClient::JackClient()
{
jack_status_t status;
client = jack_client_open("DrumGizmo", JackNullOption, &status);
- jack_set_process_callback(client, JackClient::wrapJackProcess, this);
- // Register callback which is called by jack when it wants to know about the
- // current port latency.
- jack_set_latency_callback(client,
- JackClient::latencyCallback,
- this);
+ // Register callbacks
+ jack_set_process_callback(client, JackClient::wrapJackProcess, this);
+ jack_set_latency_callback(client, JackClient::latencyCallback, this);
+ jack_set_freewheel_callback(client, JackClient::freewheelCallback, this);
}
JackClient::~JackClient()
@@ -123,6 +126,11 @@ void JackClient::jackLatencyCallback(jack_latency_callback_mode_t mode)
}
}
+void JackClient::jackFreewheelCallback(bool is_freewheeling)
+{
+ this->is_freewheeling = is_freewheeling;
+}
+
std::size_t JackClient::getBufferSize() const
{
return jack_get_buffer_size(client);
@@ -132,3 +140,8 @@ std::size_t JackClient::getSampleRate() const
{
return jack_get_sample_rate(client);
}
+
+bool JackClient::isFreewheeling() const
+{
+ return is_freewheeling;
+}