summaryrefslogtreecommitdiffstats
path: root/src/audio/audio_device.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/audio_device.cpp')
-rw-r--r--src/audio/audio_device.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/audio/audio_device.cpp b/src/audio/audio_device.cpp
index dd61e8d..df43c45 100644
--- a/src/audio/audio_device.cpp
+++ b/src/audio/audio_device.cpp
@@ -33,6 +33,10 @@
#include <alsa/asoundlib.h>
#endif
+#ifdef HAVE_JACK
+#include <jack/jack.h>
+#endif
+
t_audio_io* t_audio_io::open(const t_audio_device& dev, bool playback, bool capture, bool blocking, int channels, t_audio_sampleformat format, int sample_rate, bool short_latency)
{
t_audio_io* aio;
@@ -45,6 +49,11 @@ t_audio_io* t_audio_io::open(const t_audio_device& dev, bool playback, bool capt
aio = new t_alsa_io();
MEMMAN_NEW(aio);
#endif
+#ifdef HAVE_JACK
+ } elseif (dev.type == t_audio_device::JACK) {
+ aio = new t_jack_io();
+ MEMMAN_NEW(aio);
+#endif
} else {
string msg("Audio device not implemented");
log_file->write_report(msg, "t_audio_io::open",
@@ -350,6 +359,41 @@ int t_oss_io::write(const unsigned char* buf, int len) {
return ::write(fd, buf, len);
}
+#ifdef HAVE_JACK
+// Constructor
+t_jack_io::t_jack_io() : client(nullptr) {
+}
+
+// Opener
+bool t_jack_io::open(
+ const string& device,
+ bool playback,
+ bool capture,
+ bool blocking,
+ int channels, t_audio_sampleformat format,
+ int sample_rate,
+ bool short_latency
+ ) {
+ t_audio_io::open(
+ device,
+ playback,
+ capture,
+ blocking,
+ channels,
+ format,
+ sample_rate,
+ short_latency
+ );
+ int mode = 0;
+ string msg = "";
+
+
+// Destructor
+t_jack_io::~t_jack_io() {
+ jack_client_close(client);
+}
+#endif
+
#ifdef HAVE_LIBASOUND
t_alsa_io::t_alsa_io() : pcm_play_ptr(0), pcm_rec_ptr(0), play_framesize(1), rec_framesize(1),