diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-05-17 21:27:52 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-05-17 21:27:52 +0200 |
commit | 0e048dee411cc20beb2a8667e5bb339f9b7fb939 (patch) | |
tree | c9bacf6f2491f5ae6feb4f4786688ef5659f5c9b /drumgizmo | |
parent | b6405171c6a74a5227555a9b75c03f88a5f21ed2 (diff) |
New resample feature on output channels.
Diffstat (limited to 'drumgizmo')
-rw-r--r-- | drumgizmo/audiooutputenginedl.cc | 12 | ||||
-rw-r--r-- | drumgizmo/audiooutputenginedl.h | 3 | ||||
-rw-r--r-- | drumgizmo/output/jackaudio/jackaudio.cc | 12 |
3 files changed, 27 insertions, 0 deletions
diff --git a/drumgizmo/audiooutputenginedl.cc b/drumgizmo/audiooutputenginedl.cc index 513d21b..fcedd9d 100644 --- a/drumgizmo/audiooutputenginedl.cc +++ b/drumgizmo/audiooutputenginedl.cc @@ -111,6 +111,12 @@ AudioOutputEngineDL::AudioOutputEngineDL(std::string name) o_bufsize = NULL; } + o_samplerate = (output_samplerate_func_t) dlsym(lib, "samplerate"); + dlsym_error = dlerror(); + if(dlsym_error) { + o_samplerate = NULL; + } + ptr = o_create(); if(is_jack_plugin) { @@ -181,6 +187,12 @@ size_t AudioOutputEngineDL::getBufferSize() return 1024; } +size_t AudioOutputEngineDL::samplerate() +{ + if(o_samplerate) return o_samplerate(ptr); + return UNKNOWN_SAMPLERATE; +} + #ifdef TEST_AUDIOOUTPUTENGINEDL //Additional dependency files //deps: diff --git a/drumgizmo/audiooutputenginedl.h b/drumgizmo/audiooutputenginedl.h index 471247e..75460f3 100644 --- a/drumgizmo/audiooutputenginedl.h +++ b/drumgizmo/audiooutputenginedl.h @@ -46,6 +46,7 @@ typedef void (*output_pre_func_t)(void*, size_t); typedef void (*output_run_func_t)(void*,int,sample_t*,size_t); typedef void (*output_post_func_t)(void*, size_t); typedef size_t (*output_bufsize_func_t)(void*); +typedef size_t (*output_samplerate_func_t)(void*); class AudioOutputEngineDL : public AudioOutputEngine { public: @@ -64,6 +65,7 @@ public: void post(size_t nsamples); size_t getBufferSize(); + size_t samplerate(); private: void *ptr; @@ -77,6 +79,7 @@ private: output_run_func_t o_run; output_post_func_t o_post; output_bufsize_func_t o_bufsize; + output_samplerate_func_t o_samplerate; bool is_jack_plugin; JackClient *jackclient; diff --git a/drumgizmo/output/jackaudio/jackaudio.cc b/drumgizmo/output/jackaudio/jackaudio.cc index 2afe1ea..b7fa4f9 100644 --- a/drumgizmo/output/jackaudio/jackaudio.cc +++ b/drumgizmo/output/jackaudio/jackaudio.cc @@ -54,6 +54,7 @@ public: void jack_process(jack_nframes_t nframes); size_t bufsize(); + size_t samplerate(); private: JackClient *jackclient; @@ -146,6 +147,11 @@ size_t JackAudio::bufsize() return jack_get_buffer_size(jackclient->jack_client); } +size_t JackAudio::samplerate() +{ + return jack_get_sample_rate(jackclient->jack_client); +} + extern "C" { void *create() { @@ -205,6 +211,12 @@ extern "C" { JackAudio *jack = (JackAudio*)h; return jack->bufsize(); } + + size_t samplerate(void *h) + { + JackAudio *jack = (JackAudio*)h; + return jack->samplerate(); + } } #ifdef TEST_AUDIOINPUTENGINEJACKAUDIO |