ofxPDSP
Preparable.h
1 
2 // Preparable.h
3 // ofxPDSP
4 // Nicola Pisanti, MIT License, 2016
5 
6 
7 #ifndef PDSP_CORE_ENGINEINTERFACE_H_INCLUDED
8 #define PDSP_CORE_ENGINEINTERFACE_H_INCLUDED
9 
10 
11 #include <vector>
12 #include <math.h>
13 #include "../../math/header.h"
14 #include "../pdspConstants.h"
15 #include "../../messages/Clockable.h"
16 
17 namespace pdsp{
18 
19 
23 void prepareAllToPlay(int expectedBufferSize, double sampleRate);
24 
28 void releaseAll();
29 
33 void setInitOversample(int initOversample);
34 
35 
36 class Preparable{
37  friend void prepareAllToPlay(int expectedBufferSize, double sampleRate);
38  friend void releaseAll();
39  friend void setInitOversample(int initOversample);
40  friend class Processor;
41 
42 public:
43  Preparable();
44 
45  static double getGlobalSampleRate();
46 
47 protected:
51  virtual void prepareToPlay(int expectedBufferSize, double sampleRate) = 0;
52 
53  virtual void releaseResources() = 0;
54 
55 
56  virtual ~Preparable();
57 
58  static void setTurnBufferSize(int turnBufferSize);
59  static std::vector<Preparable*> constructionVector;
60  static bool dynamicConstruction;
61  static int globalBufferSize;
62  static double globalSampleRate;
63  static int initOversampleLevel;
64  static int turnBufferSize;
65 
69 };
70 
71 
72 
73 }//END NAMESPACE
74 
75 
76 #endif // ENGINEINTERFACE_H_INCLUDED
void releaseAll()
releases the resources of all the Preparable classes
Definition: Preparable.cpp:58
friend void prepareAllToPlay(int expectedBufferSize, double sampleRate)
prepares all the Preparable to play, it is mandatory to be called at least once with the correct samp...
Definition: Preparable.cpp:41
void prepareAllToPlay(int expectedBufferSize, double sampleRate)
prepares all the Preparable to play, it is mandatory to be called at least once with the correct samp...
Definition: Preparable.cpp:41
friend void releaseAll()
releases the resources of all the Preparable classes
Definition: Preparable.cpp:58
Thread-safe value control with smoothing.
Definition: SequencerBridge.h:11
friend void setInitOversample(int initOversample)
changes the default oversample level (default is 1 = no oversampling )
Definition: Preparable.cpp:66
void setInitOversample(int initOversample)
changes the default oversample level (default is 1 = no oversampling )
Definition: Preparable.cpp:66
The bridge between pdsp and the audio callback.
Definition: Processor.h:21
Definition: Preparable.h:36