summaryrefslogtreecommitdiff
path: root/src/drumgizmo.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/drumgizmo.h')
-rw-r--r--src/drumgizmo.h71
1 files changed, 38 insertions, 33 deletions
diff --git a/src/drumgizmo.h b/src/drumgizmo.h
index 5e58ba5..2778092 100644
--- a/src/drumgizmo.h
+++ b/src/drumgizmo.h
@@ -24,8 +24,7 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#ifndef __DRUMGIZMO_DRUMGIZMO_H__
-#define __DRUMGIZMO_DRUMGIZMO_H__
+#pragma once
#include <string>
#include <list>
@@ -38,6 +37,7 @@
#include "drumkit.h"
#include "drumkitloader.h"
+#include "audiocache.h"
#include "mutex.h"
@@ -51,52 +51,57 @@
#define MAX_NUM_CHANNELS 64
#define REFSFILE "refs.conf"
+#define RESAMPLER_INPUT_BUFFER 64
-class DrumGizmo : public MessageReceiver {
+class DrumGizmo
+ : public MessageReceiver
+{
public:
- DrumGizmo(AudioOutputEngine *outputengine, AudioInputEngine *inputengine);
- virtual ~DrumGizmo();
+ DrumGizmo(AudioOutputEngine *outputengine, AudioInputEngine *inputengine);
+ virtual ~DrumGizmo();
- bool loadkit(std::string kitfile);
+ bool loadkit(std::string kitfile);
- bool init();
+ bool init();
- /**
- * @param endpos number of samples to process, -1 := never stop.
- */
- void run(int endpos);
- bool run(size_t pos, sample_t *samples, size_t nsamples);
- void stop();
+ void run(int endpos);
+ bool run(size_t pos, sample_t *samples, size_t nsamples);
+ void stop();
- void getSamples(int ch, int pos, sample_t *s, size_t sz);
+ void getSamples(int ch, int pos, sample_t *s, size_t sz);
- std::string configString();
- bool setConfigString(std::string cfg);
+ std::string configString();
+ bool setConfigString(std::string cfg);
- void handleMessage(Message *msg);
+ void handleMessage(Message *msg);
- int samplerate();
- void setSamplerate(int samplerate);
+ int samplerate();
+ void setSamplerate(int samplerate);
-private:
- DrumKitLoader loader;
+ void setFrameSize(size_t framesize);
- Mutex mutex;
- bool is_stopping; ///< Is set to true when a TYPE_STOP event has been seen.
+ void setFreeWheel(bool freewheel);
- AudioOutputEngine *oe;
- AudioInputEngine *ie;
+protected:
+ DrumKitLoader loader;
- std::list< Event* > activeevents[MAX_NUM_CHANNELS];
+ Mutex mutex;
+ bool is_stopping; ///< Is set to true when a TYPE_STOP event has been seen.
- CHResampler resampler[MAX_NUM_CHANNELS];
- sample_t resampler_output_buffer[MAX_NUM_CHANNELS][4096];
- sample_t resampler_input_buffer[MAX_NUM_CHANNELS][64];
+ AudioOutputEngine *oe;
+ AudioInputEngine *ie;
- std::map<std::string, AudioFile *> audiofiles;
+ std::list< Event* > activeevents[MAX_NUM_CHANNELS];
- DrumKit kit;
-};
+ CHResampler resampler[MAX_NUM_CHANNELS];
+ sample_t resampler_output_buffer[MAX_NUM_CHANNELS][4096];
+ sample_t resampler_input_buffer[MAX_NUM_CHANNELS][RESAMPLER_INPUT_BUFFER];
+
+ std::map<std::string, AudioFile *> audiofiles;
+ AudioCache audioCache;
+ DrumKit kit;
-#endif/*__DRUMGIZMO_DRUMGIZMO_H__*/
+ size_t framesize;
+ bool freewheel;
+};