summaryrefslogtreecommitdiff
path: root/drumgizmo/jackclient.h
diff options
context:
space:
mode:
authorChristian Glöckner <cgloeckner@freenet.de>2016-01-22 11:59:00 +0100
committerAndré Nusser <andre.nusser@googlemail.com>2016-02-09 09:03:16 +0100
commitef3a90f4ba8d65e8c210898c48acd3a07eafaf4c (patch)
tree0fdfe740b33f8f85eccb588f4577c1115a5d54be /drumgizmo/jackclient.h
parent06d43e27c412083cf704af48ea40e5c589504240 (diff)
added JackaudioOutputEngine
Diffstat (limited to 'drumgizmo/jackclient.h')
-rw-r--r--drumgizmo/jackclient.h72
1 files changed, 41 insertions, 31 deletions
diff --git a/drumgizmo/jackclient.h b/drumgizmo/jackclient.h
index f093220..ef7abf1 100644
--- a/drumgizmo/jackclient.h
+++ b/drumgizmo/jackclient.h
@@ -24,44 +24,54 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#ifndef __DRUMGIZMO_JACKCLIENT_H__
-#define __DRUMGIZMO_JACKCLIENT_H__
-
-#include <jack/jack.h>
+#pragma once
+#include <vector>
+#include <string>
#include <set>
-class JackProcess {
-public:
- virtual ~JackProcess() {}
- virtual void jack_process(jack_nframes_t nframes) = 0;
-};
-
-class JackClient {
-public:
- JackClient();
- ~JackClient();
-
- void addJackProcess(JackProcess *process)
- {
- jack_processes.insert(process);
- }
+#include <jack/jack.h>
- void removeJackProcess(JackProcess *process);
+#include <audiotypes.h>
- void activate();
- int process(jack_nframes_t nframes);
+class JackClient;
- jack_client_t *jack_client;
+class JackProcess {
+ public:
+ virtual ~JackProcess();
+ virtual void process(jack_nframes_t num_frames) = 0;
+};
- // Sort of private...
- int refcnt;
+// --------------------------------------------------------------------
-private:
- std::set<JackProcess *> jack_processes;
- bool active;
+struct JackChannel {
+ std::vector<sample_t> samples;
+ jack_client_t* const client;
+ jack_port_t* const port;
+
+ JackChannel();
+ JackChannel(JackClient& client, std::size_t buffer_size,
+ std::string const & name);
+ ~JackChannel();
};
-JackClient *init_jack_client();
-void close_jack_client();
+// --------------------------------------------------------------------
-#endif/*__DRUMGIZMO_JACKCLIENT_H__*/
+class JackClient {
+ friend struct JackChannel;
+
+ public:
+ JackClient();
+ ~JackClient();
+
+ void add(JackProcess& process);
+ void remove(JackProcess& process);
+ void activate();
+ int process(jack_nframes_t num_frames);
+ std::size_t getBufferSize() const;
+ std::size_t getSampleRate() const;
+
+ private:
+ jack_client_t* client;
+ std::set<JackProcess*> processes;
+ bool is_active;
+};