From 0f18336bc2a597f2625a46ea714e838d03e340b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Gl=C3=B6ckner?= Date: Tue, 29 Mar 2016 10:09:18 +0200 Subject: more consistent style of output engines' getters --- drumgizmo/drumgizmoc.cc | 2 +- drumgizmo/output/alsa.cc | 2 +- drumgizmo/output/alsa.h | 2 +- drumgizmo/output/jackaudio.cc | 4 ++-- drumgizmo/output/jackaudio.h | 4 ++-- drumgizmo/output/wavfile.cc | 2 +- drumgizmo/output/wavfile.h | 2 +- plugin/drumgizmo_plugin.cc | 4 ++-- plugin/drumgizmo_plugin.h | 4 ++-- src/audiooutputengine.h | 6 +++--- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc index 14a71b3..24d16e8 100644 --- a/drumgizmo/drumgizmoc.cc +++ b/drumgizmo/drumgizmoc.cc @@ -398,7 +398,7 @@ int CliMain::run(int argc, char* argv[]) } printf("done.\n"); - gizmo.setSamplerate(oe->samplerate()); + gizmo.setSamplerate(oe->getSamplerate()); if(!gizmo.init()) { diff --git a/drumgizmo/output/alsa.cc b/drumgizmo/output/alsa.cc index 66a78c0..aea80a6 100644 --- a/drumgizmo/output/alsa.cc +++ b/drumgizmo/output/alsa.cc @@ -187,7 +187,7 @@ void AlsaOutputEngine::post(size_t nsamples) snd_pcm_writei(handle, data.data(), nsamples); } -size_t AlsaOutputEngine::samplerate() +size_t AlsaOutputEngine::getSamplerate() const { return srate; } diff --git a/drumgizmo/output/alsa.h b/drumgizmo/output/alsa.h index a769c54..cc28f94 100644 --- a/drumgizmo/output/alsa.h +++ b/drumgizmo/output/alsa.h @@ -49,7 +49,7 @@ public: void pre(size_t nsamples) override; void run(int ch, sample_t* samples, size_t nsamples) override; void post(size_t nsamples) override; - size_t samplerate() override; + size_t getSamplerate() const override; private: snd_pcm_t* handle; diff --git a/drumgizmo/output/jackaudio.cc b/drumgizmo/output/jackaudio.cc index 52e1d41..7710e14 100644 --- a/drumgizmo/output/jackaudio.cc +++ b/drumgizmo/output/jackaudio.cc @@ -113,12 +113,12 @@ void JackAudioOutputEngine::process(jack_nframes_t num_frames) sema.post(); } -size_t JackAudioOutputEngine::getBufferSize() +size_t JackAudioOutputEngine::getBufferSize() const { return client.getBufferSize(); } -size_t JackAudioOutputEngine::samplerate() +size_t JackAudioOutputEngine::getSamplerate() const { return client.getSampleRate(); } diff --git a/drumgizmo/output/jackaudio.h b/drumgizmo/output/jackaudio.h index b71ff8e..324e95a 100644 --- a/drumgizmo/output/jackaudio.h +++ b/drumgizmo/output/jackaudio.h @@ -47,8 +47,8 @@ public: void pre(size_t nsamples) override; void run(int ch, sample_t* samples, size_t nsamples) override; void post(size_t nsamples) override; - size_t getBufferSize() override; - size_t samplerate() override; + size_t getBufferSize() const override; + size_t getSamplerate() const override; // based on JackProcess void process(jack_nframes_t num_frames) override; diff --git a/drumgizmo/output/wavfile.cc b/drumgizmo/output/wavfile.cc index 78f7899..a9d8b0b 100644 --- a/drumgizmo/output/wavfile.cc +++ b/drumgizmo/output/wavfile.cc @@ -125,7 +125,7 @@ void WavfileOutputEngine::post(size_t nsamples) { } -size_t WavfileOutputEngine::samplerate() +size_t WavfileOutputEngine::getSamplerate() const { return info.samplerate; } diff --git a/drumgizmo/output/wavfile.h b/drumgizmo/output/wavfile.h index a0019d3..dfe422c 100644 --- a/drumgizmo/output/wavfile.h +++ b/drumgizmo/output/wavfile.h @@ -47,7 +47,7 @@ public: void pre(size_t nsamples) override; void run(int ch, sample_t* samples, size_t nsamples) override; void post(size_t nsamples) override; - size_t samplerate() override; + size_t getSamplerate() const override; private: SF_INFO info; diff --git a/plugin/drumgizmo_plugin.cc b/plugin/drumgizmo_plugin.cc index b41879d..b8f8822 100644 --- a/plugin/drumgizmo_plugin.cc +++ b/plugin/drumgizmo_plugin.cc @@ -291,7 +291,7 @@ void DrumGizmoPlugin::Output::post(size_t nsamples) { } -sample_t* DrumGizmoPlugin::Output::getBuffer(int ch) +sample_t* DrumGizmoPlugin::Output::getBuffer(int ch) const { assert(plugin.output_samples); @@ -303,7 +303,7 @@ sample_t* DrumGizmoPlugin::Output::getBuffer(int ch) return (*plugin.output_samples)[ch]; } -size_t DrumGizmoPlugin::Output::getBufferSize() +size_t DrumGizmoPlugin::Output::getBufferSize() const { return plugin.getFramesize(); } diff --git a/plugin/drumgizmo_plugin.h b/plugin/drumgizmo_plugin.h index 8cddef6..28a1b8f 100644 --- a/plugin/drumgizmo_plugin.h +++ b/plugin/drumgizmo_plugin.h @@ -141,8 +141,8 @@ private: void run(int ch, sample_t *samples, size_t nsamples) override; void post(size_t nsamples) override; - sample_t *getBuffer(int ch) override; - size_t getBufferSize() override; + sample_t *getBuffer(int ch) const override; + size_t getBufferSize() const override; protected: DrumGizmoPlugin& plugin; diff --git a/src/audiooutputengine.h b/src/audiooutputengine.h index 530ca13..df8b0ee 100644 --- a/src/audiooutputengine.h +++ b/src/audiooutputengine.h @@ -49,14 +49,14 @@ public: virtual void post(size_t nsamples) = 0; // Reimplement this if you wish to use internal buffer directly. - virtual sample_t *getBuffer(int ch) { return NULL; } + virtual sample_t *getBuffer(int ch) const { return NULL; } /* * Overload this method to force engine to use different buffer size. */ - virtual size_t getBufferSize() { return 1024; } + virtual size_t getBufferSize() const { return 1024; } - virtual size_t samplerate() { return 44100; } + virtual size_t getSamplerate() const { return 44100; } }; #endif/*__DRUMGIZMO_AUDIOOUTPUTENGINE_H__*/ -- cgit v1.2.3