From 633bac9e82aef192a803666aaf3d3dcff920ac0c Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 13 Jul 2016 11:25:59 +0200 Subject: Use the latency reported by the engine in the jack and wavfile output modules. --- src/audiooutputengine.h | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/audiooutputengine.h b/src/audiooutputengine.h index df8b0ee..338b5cd 100644 --- a/src/audiooutputengine.h +++ b/src/audiooutputengine.h @@ -24,39 +24,40 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifndef __DRUMGIZMO_AUDIOOUTPUTENGINE_H__ -#define __DRUMGIZMO_AUDIOOUTPUTENGINE_H__ +#pragma once +#include #include -#include + #include #include "channel.h" -class AudioOutputEngine { +class AudioOutputEngine +{ public: - virtual ~AudioOutputEngine() {} + virtual ~AudioOutputEngine() = default; - virtual bool init(const Channels& channels) = 0; + virtual bool init(const Channels& channels) = 0; - virtual void setParm(const std::string& parm, const std::string& value) = 0; + virtual void setParm(const std::string& parm, const std::string& value) = 0; - virtual bool start() = 0; - virtual void stop() = 0; + virtual bool start() = 0; + virtual void stop() = 0; - virtual void pre(size_t nsamples) = 0; - virtual void run(int ch, sample_t *samples, size_t nsamples) = 0; - virtual void post(size_t nsamples) = 0; + virtual void pre(std::size_t nsamples) = 0; + virtual void run(int ch, sample_t *samples, std::size_t nsamples) = 0; + virtual void post(std::size_t nsamples) = 0; - // Reimplement this if you wish to use internal buffer directly. - virtual sample_t *getBuffer(int ch) const { return NULL; } + //! Overload this method to use internal buffer directly. + virtual sample_t *getBuffer(int ch) const { return NULL; } - /* - * Overload this method to force engine to use different buffer size. - */ - virtual size_t getBufferSize() const { return 1024; } - - virtual size_t getSamplerate() const { return 44100; } -}; + //! Overload this method to force engine to use different buffer size. + virtual std::size_t getBufferSize() const { return 1024; } -#endif/*__DRUMGIZMO_AUDIOOUTPUTENGINE_H__*/ + virtual std::size_t getSamplerate() const { return 44100; } + + //! Overload this method to get notification of latency changes. + //! \param latency The new latency in samples. + virtual void onLatencyChange(std::size_t latency) {} +}; -- cgit v1.2.3