YSE sound engine  1.0
cross platform sound engine
 All Classes Namespaces Functions Pages
dspVoice.hpp
1 /*
2  ==============================================================================
3 
4  dspVoice.h
5  Created: 10 Jul 2014 6:08:28pm
6  Author: yvan
7 
8  ==============================================================================
9 */
10 
11 #ifndef DSPVOICE_H_INCLUDED
12 #define DSPVOICE_H_INCLUDED
13 
14 #include "../classes.hpp"
15 #include "../headers/defines.hpp"
16 #include "../dsp/dspObject.hpp"
17 #include "../dsp/math.hpp"
18 
19 namespace YSE {
20  namespace SYNTH {
21 
22  class API dspVoice : public DSP::dspSourceObject {
23  public:
24  dspVoice();
25  virtual ~dspVoice() {}
26 
27  // intent is what we should do (playing, start playing, start stopping etc...
28  virtual void process(SOUND_STATUS & intent) = 0;
29 
30  Flt getFrequency() { return _frequency.load(); }
31  Flt getVelocity () { return _velocity .load(); }
32 
33  //this will be used internally to pass the midi note number
34  void frequency(Flt value) {
35  _frequency.store(DSP::MidiToFreq(value));
36  }
37 
38  void velocity(Flt value) {
39  _velocity.store(value);
40  }
41 
42  // this function is used internally. It should return a base class pointer
43  // to a dynamically created object of your derived class. For instance, if
44  // your derived class is called 'derived', write the function like this:
45  //
46  // virtual dspVoice * clone() {
47  // return new derived();
48  // }
49  virtual dspVoice * clone() = 0;
50 
51  private:
52  aFlt _frequency;
53  aFlt _velocity ;
54  };
55 
56  }
57 }
58 
59 
60 
61 #endif // DSPVOICE_H_INCLUDED