summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drumgizmo/audioinputenginedl.cc4
-rw-r--r--drumgizmo/audioinputenginedl.h24
-rw-r--r--drumgizmo/audiooutputenginedl.cc4
-rw-r--r--drumgizmo/audiooutputenginedl.h28
4 files changed, 34 insertions, 26 deletions
diff --git a/drumgizmo/audioinputenginedl.cc b/drumgizmo/audioinputenginedl.cc
index 93c7079..cba59fa 100644
--- a/drumgizmo/audioinputenginedl.cc
+++ b/drumgizmo/audioinputenginedl.cc
@@ -41,7 +41,7 @@ AudioInputEngineDL::AudioInputEngineDL(std::string name)
is_jack_plugin = strstr(name.c_str(), "jack");
std::string plugin = INPUT_PLUGIN_DIR"/" + name + ".so";
- void *lib = dlopen(plugin.c_str(), RTLD_LAZY);
+ lib = dlopen(plugin.c_str(), RTLD_LAZY);
if(!lib) {
printf("Cannot load device: %s\n", dlerror());
return;
@@ -124,6 +124,8 @@ AudioInputEngineDL::~AudioInputEngineDL()
{
i_destroy(ptr);
if(is_jack_plugin) close_jack_client();
+ dlclose(lib);
+ lib = nullptr;
}
bool AudioInputEngineDL::init(Instruments &instruments)
diff --git a/drumgizmo/audioinputenginedl.h b/drumgizmo/audioinputenginedl.h
index ed1fb27..94bd89d 100644
--- a/drumgizmo/audioinputenginedl.h
+++ b/drumgizmo/audioinputenginedl.h
@@ -57,19 +57,21 @@ public:
void post();
private:
- void *ptr;
- input_create_func_t i_create;
- input_destroy_func_t i_destroy;
- input_init_func_t i_init;
- input_setparm_func_t i_setparm;
- input_start_func_t i_start;
- input_stop_func_t i_stop;
- input_pre_func_t i_pre;
- input_run_func_t i_run;
- input_post_func_t i_post;
+ void *ptr{nullptr};
+ input_create_func_t i_create{nullptr};
+ input_destroy_func_t i_destroy{nullptr};
+ input_init_func_t i_init{nullptr};
+ input_setparm_func_t i_setparm{nullptr};
+ input_start_func_t i_start{nullptr};
+ input_stop_func_t i_stop{nullptr};
+ input_pre_func_t i_pre{nullptr};
+ input_run_func_t i_run{nullptr};
+ input_post_func_t i_post{nullptr};
bool is_jack_plugin;
- JackClient *jackclient;
+ JackClient *jackclient{nullptr};
+
+ void *lib{nullptr};
};
#endif/*__DRUMGIZMO_AUDIOINPUTENGINEDL_H__*/
diff --git a/drumgizmo/audiooutputenginedl.cc b/drumgizmo/audiooutputenginedl.cc
index dad2c5c..042db4a 100644
--- a/drumgizmo/audiooutputenginedl.cc
+++ b/drumgizmo/audiooutputenginedl.cc
@@ -36,7 +36,7 @@ AudioOutputEngineDL::AudioOutputEngineDL(std::string name)
is_jack_plugin = strstr(name.c_str(), "jack");
std::string plugin = OUTPUT_PLUGIN_DIR"/" + name + ".so";
- void *lib = dlopen(plugin.c_str(), RTLD_LAZY);
+ lib = dlopen(plugin.c_str(), RTLD_LAZY);
if(!lib) {
printf("Cannot load device: %s\n", dlerror());
return;
@@ -132,6 +132,8 @@ AudioOutputEngineDL::~AudioOutputEngineDL()
{
o_destroy(ptr);
if(is_jack_plugin) close_jack_client();
+ dlclose(lib);
+ lib = nullptr;
}
bool AudioOutputEngineDL::init(Channels channels)
diff --git a/drumgizmo/audiooutputenginedl.h b/drumgizmo/audiooutputenginedl.h
index 75460f3..4b31015 100644
--- a/drumgizmo/audiooutputenginedl.h
+++ b/drumgizmo/audiooutputenginedl.h
@@ -68,21 +68,23 @@ public:
size_t samplerate();
private:
- void *ptr;
- output_create_func_t o_create;
- output_destroy_func_t o_destroy;
- output_init_func_t o_init;
- output_setparm_func_t o_setparm;
- output_start_func_t o_start;
- output_stop_func_t o_stop;
- output_pre_func_t o_pre;
- output_run_func_t o_run;
- output_post_func_t o_post;
- output_bufsize_func_t o_bufsize;
- output_samplerate_func_t o_samplerate;
+ void *ptr{nullptr};
+ output_create_func_t o_create{nullptr};
+ output_destroy_func_t o_destroy{nullptr};
+ output_init_func_t o_init{nullptr};
+ output_setparm_func_t o_setparm{nullptr};
+ output_start_func_t o_start{nullptr};
+ output_stop_func_t o_stop{nullptr};
+ output_pre_func_t o_pre{nullptr};
+ output_run_func_t o_run{nullptr};
+ output_post_func_t o_post{nullptr};
+ output_bufsize_func_t o_bufsize{nullptr};
+ output_samplerate_func_t o_samplerate{nullptr};
bool is_jack_plugin;
- JackClient *jackclient;
+ JackClient *jackclient{nullptr};
+
+ void* lib{nullptr};
};
#endif/*__DRUMGIZMO_AUDIOOUTPUTENGINEDL_H__*/