summaryrefslogtreecommitdiff
path: root/drumgizmo/audioinputenginedl.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-05-20 08:26:48 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2013-05-20 08:26:48 +0200
commita609e6895a96db134697acce266e0cb94488f60b (patch)
tree77d854e202e973349e3500b10dc36069e388105b /drumgizmo/audioinputenginedl.cc
parent98430d96a1d25cba36ad304fde6518e493fe3441 (diff)
Centralise jackclient code for reuse among the jack client modules. Implement most of the jackaudio output module (probably broken atm.).
Diffstat (limited to 'drumgizmo/audioinputenginedl.cc')
-rw-r--r--drumgizmo/audioinputenginedl.cc27
1 files changed, 20 insertions, 7 deletions
diff --git a/drumgizmo/audioinputenginedl.cc b/drumgizmo/audioinputenginedl.cc
index 799e56f..e7f19c6 100644
--- a/drumgizmo/audioinputenginedl.cc
+++ b/drumgizmo/audioinputenginedl.cc
@@ -34,8 +34,12 @@
#include <string.h>
#include <stdlib.h>
+#include "jackclient.h"
+
AudioInputEngineDL::AudioInputEngineDL(std::string name)
{
+ is_jack_plugin = strstr(name.c_str(), "jack");
+
std::string plugin = INPUT_PLUGIN_DIR"/lib" + name + ".so";
void *lib = dlopen(plugin.c_str(), RTLD_LAZY);
if(!lib) {
@@ -60,58 +64,66 @@ AudioInputEngineDL::AudioInputEngineDL(std::string name)
i_init = (input_init_func_t) dlsym(lib, "init");
dlsym_error = dlerror();
if(dlsym_error) {
- printf("Cannot load symbol destroy: %s\n", dlsym_error);
+ printf("Cannot load symbol init: %s\n", dlsym_error);
return;
}
i_setparm = (input_setparm_func_t) dlsym(lib, "setparm");
dlsym_error = dlerror();
if(dlsym_error) {
- printf("Cannot load symbol destroy: %s\n", dlsym_error);
+ printf("Cannot load symbol setparm: %s\n", dlsym_error);
return;
}
i_start = (input_start_func_t) dlsym(lib, "start");
dlsym_error = dlerror();
if(dlsym_error) {
- printf("Cannot load symbol destroy: %s\n", dlsym_error);
+ printf("Cannot load symbol start: %s\n", dlsym_error);
return;
}
i_stop = (input_stop_func_t) dlsym(lib, "stop");
dlsym_error = dlerror();
if(dlsym_error) {
- printf("Cannot load symbol destroy: %s\n", dlsym_error);
+ printf("Cannot load symbol stop: %s\n", dlsym_error);
return;
}
i_pre = (input_pre_func_t) dlsym(lib, "pre");
dlsym_error = dlerror();
if(dlsym_error) {
- printf("Cannot load symbol destroy: %s\n", dlsym_error);
+ printf("Cannot load symbol pre: %s\n", dlsym_error);
return;
}
i_run = (input_run_func_t) dlsym(lib, "run");
dlsym_error = dlerror();
if(dlsym_error) {
- printf("Cannot load symbol destroy: %s\n", dlsym_error);
+ printf("Cannot load symbol run: %s\n", dlsym_error);
return;
}
i_post = (input_post_func_t) dlsym(lib, "post");
dlsym_error = dlerror();
if(dlsym_error) {
- printf("Cannot load symbol destroy: %s\n", dlsym_error);
+ printf("Cannot load symbol post: %s\n", dlsym_error);
return;
}
ptr = i_create();
+
+ if(is_jack_plugin) {
+ char ptrbuf[32];
+ jackclient = init_jack_client();
+ sprintf(ptrbuf, "%p", jackclient);
+ setParm("jack_client", ptrbuf);
+ }
}
AudioInputEngineDL::~AudioInputEngineDL()
{
i_destroy(ptr);
+ if(is_jack_plugin) close_jack_client();
}
bool AudioInputEngineDL::init(Instruments &instruments)
@@ -138,6 +150,7 @@ void AudioInputEngineDL::setParm(std::string parm, std::string value)
bool AudioInputEngineDL::start()
{
+ if(is_jack_plugin) jackclient->activate();
return i_start(ptr);
}