diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-12-20 17:24:31 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-12-20 17:24:31 +0100 |
commit | 64e5faf11c22c8aabf181288293c8ec7964c213d (patch) | |
tree | f0669001e9eef2aa883df85f401947d843f684b4 /drumgizmo | |
parent | b697682bd3c1b9cdfde97cd6a7c9d0f10103f6b4 (diff) | |
parent | 0fa481dabf620181c852f43923a3c4b049294ab4 (diff) |
Merge remote-tracking branch 'origin/master' into uirefactor
Diffstat (limited to 'drumgizmo')
-rw-r--r-- | drumgizmo/audioinputenginedl.cc | 4 | ||||
-rw-r--r-- | drumgizmo/audioinputenginedl.h | 24 | ||||
-rw-r--r-- | drumgizmo/audiooutputenginedl.cc | 4 | ||||
-rw-r--r-- | drumgizmo/audiooutputenginedl.h | 28 | ||||
-rw-r--r-- | drumgizmo/input/jackmidi/Makefile.am | 3 | ||||
-rw-r--r-- | drumgizmo/input/jackmidi/jackmidi.cc | 4 | ||||
-rw-r--r-- | drumgizmo/input/midifile/Makefile.am | 5 | ||||
-rw-r--r-- | drumgizmo/output/alsa/alsa.cc | 12 | ||||
-rw-r--r-- | drumgizmo/output/jackaudio/jackaudio.cc | 8 | ||||
-rw-r--r-- | drumgizmo/output/wavfile/wavfile.cc | 6 |
10 files changed, 55 insertions, 43 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__*/ diff --git a/drumgizmo/input/jackmidi/Makefile.am b/drumgizmo/input/jackmidi/Makefile.am index fd63944..d392f19 100644 --- a/drumgizmo/input/jackmidi/Makefile.am +++ b/drumgizmo/input/jackmidi/Makefile.am @@ -26,7 +26,8 @@ libdir = $(INPUT_PLUGIN_DIR) AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src -I$(top_srcdir)/hugin jackmidi_la_LDFLAGS = -module -avoid-version -shared -jackmidi_la_LIBADD = +jackmidi_la_LIBADD = $(EXPAT_LIBS) +jackmidi_la_CXXFLAGS = $(EXPAT_CFLAGS) jackmidi_la_SOURCES = $(jackmidibuildsources) install-exec-hook: diff --git a/drumgizmo/input/jackmidi/jackmidi.cc b/drumgizmo/input/jackmidi/jackmidi.cc index 5496195..a6b49b7 100644 --- a/drumgizmo/input/jackmidi/jackmidi.cc +++ b/drumgizmo/input/jackmidi/jackmidi.cc @@ -60,8 +60,8 @@ public: private: void loadMap(std::string map) {} - JackClient *jackclient; - jack_port_t *midi_port; + JackClient *jackclient{nullptr}; + jack_port_t *midi_port{nullptr}; size_t pos; diff --git a/drumgizmo/input/midifile/Makefile.am b/drumgizmo/input/midifile/Makefile.am index f95a289..9ade475 100644 --- a/drumgizmo/input/midifile/Makefile.am +++ b/drumgizmo/input/midifile/Makefile.am @@ -27,8 +27,9 @@ libdir = $(INPUT_PLUGIN_DIR) AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include $(SMF_CFLAGS) \ $(EXPAT_CFLAGS) -I$(top_srcdir)/hugin -DWITH_HUG_MUTEX -midifile_la_LDFLAGS = $(SMF_LIBS) $(EXPAT_LIBS) -module -avoid-version -shared -midifile_la_LIBADD = +midifile_la_LDFLAGS = -module -avoid-version -shared +midifile_la_LIBADD = $(EXPAT_LIBS) $(SMF_LIBS) +midifile_la_CXXFLAGS =$(EXPAT_CFLAGS) midifile_la_SOURCES = $(midifilebuildsources) install-exec-hook: diff --git a/drumgizmo/output/alsa/alsa.cc b/drumgizmo/output/alsa/alsa.cc index dc2ac73..71e0c3d 100644 --- a/drumgizmo/output/alsa/alsa.cc +++ b/drumgizmo/output/alsa/alsa.cc @@ -52,15 +52,15 @@ public: size_t samplerate(); private: - snd_pcm_t *handle; - snd_pcm_hw_params_t *params; - sample_t *data; - size_t channels; + snd_pcm_t *handle{nullptr}; + snd_pcm_hw_params_t *params{nullptr}; + sample_t *data{nullptr}; + size_t channels{0}; // Parameters std::string device; - unsigned int srate; - snd_pcm_uframes_t frames; + unsigned int srate{0}; + snd_pcm_uframes_t frames{0}; }; Alsa::Alsa() diff --git a/drumgizmo/output/jackaudio/jackaudio.cc b/drumgizmo/output/jackaudio/jackaudio.cc index 5c04146..511c145 100644 --- a/drumgizmo/output/jackaudio/jackaudio.cc +++ b/drumgizmo/output/jackaudio/jackaudio.cc @@ -57,10 +57,10 @@ public: size_t samplerate(); private: - JackClient *jackclient; - jack_port_t *output_port[64]; - size_t nchannels; - sample_t **channels; + JackClient *jackclient{nullptr}; + jack_port_t *output_port[64] = {}; + size_t nchannels{0}; + sample_t **channels{nullptr}; Semaphore sem; }; diff --git a/drumgizmo/output/wavfile/wavfile.cc b/drumgizmo/output/wavfile/wavfile.cc index fa4128e..8401f80 100644 --- a/drumgizmo/output/wavfile/wavfile.cc +++ b/drumgizmo/output/wavfile/wavfile.cc @@ -28,6 +28,7 @@ #include <audiotypes.h> #include <string> +#include <memory.h> #include <sndfile.h> @@ -48,8 +49,8 @@ public: private: SF_INFO sf_info; - SNDFILE **fh; - size_t channels; + SNDFILE **fh{nullptr}; + size_t channels{0}; // Parameters std::string filename; @@ -60,6 +61,7 @@ WavFile::WavFile() fh = NULL; filename = "output"; + memset(&sf_info, 0, sizeof(sf_info)); sf_info.channels = 1;//channels; sf_info.format = SF_FORMAT_WAV | SF_FORMAT_FLOAT; sf_info.samplerate = 44100; |