YSE sound engine  1.0
cross platform sound engine
 All Classes Namespaces Functions Pages
dspObject.hpp
1 /*
2  ==============================================================================
3 
4  source.h
5  Created: 31 Jan 2014 2:53:05pm
6  Author: yvan
7 
8  ==============================================================================
9 */
10 
11 #ifndef SOURCE_H_INCLUDED
12 #define SOURCE_H_INCLUDED
13 
14 
15 #include <vector>
16 #include "sample.hpp"
17 #include "../headers/enums.hpp"
18 
19 namespace YSE {
20  namespace DSP {
21 
22  // simple base class for a chainable dsp object
23 
24  class API dspObject {
25  public:
26  virtual void process(MULTICHANNELBUFFER & buffer) = 0;
27 
28  // link the output of this dsp to another dsp.
29  // If the dsp is already linked, the new dsp will
30  // be put between this object and the current next
31  // object.
32  void link(dspObject& next);
33  dspObject * link();
34 
35  dspObject();
36  ~dspObject();
37 
38  dspObject& bypass(Bool value) { _bypass = value; return *this; }
39  Bool bypass() { return _bypass; }
40 
41  dspObject ** calledfrom; // consider this private for now
42  private:
43  dspObject * next;
44  dspObject * previous;
45  Bool _bypass;
46  };
47 
48  // simple base class for a dsp object with sound generation
49  // DSPSource can be by sounds for sound generation. This is
50  // why some virtual functions have to be implemented.
51  class API dspSourceObject {
52  public:
53  std::vector<sample> buffer;
54  dspSourceObject(Int buffers = 1);
55 
56  // intent is what we should do (playing, start playing, start stopping etc...
57  virtual void process(SOUND_STATUS & intent) = 0;
58  virtual void frequency(Flt value) = 0;
59  };
60 
61  }
62 }
63 
64 
65 
66 
67 #endif // SOURCE_H_INCLUDED