diff options
Diffstat (limited to 'src/audiooutputengine.h')
-rw-r--r-- | src/audiooutputengine.h | 45 |
1 files changed, 23 insertions, 22 deletions
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 <cstddef> #include <string> -#include <stdlib.h> + #include <audiotypes.h> #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) {} +}; |