Debian Codegraph @

lib-src/libnyquist/nyquist/nyqstk/include/BandedWG.h

raw
1 /***************************************************/
2 /*! \class BandedWG
3 \brief Banded waveguide modeling class.
4
5 This class uses banded waveguide techniques to
6 model a variety of sounds, including bowed
7 bars, glasses, and bowls. For more
8 information, see Essl, G. and Cook, P. "Banded
9 Waveguides: Towards Physical Modelling of Bar
10 Percussion Instruments", Proceedings of the
11 1999 International Computer Music Conference.
12
13 Control Change Numbers:
14 - Bow Pressure = 2
15 - Bow Motion = 4
16 - Strike Position = 8 (not implemented)
17 - Vibrato Frequency = 11
18 - Gain = 1
19 - Bow Velocity = 128
20 - Set Striking = 64
21 - Instrument Presets = 16
22 - Uniform Bar = 0
23 - Tuned Bar = 1
24 - Glass Harmonica = 2
25 - Tibetan Bowl = 3
26
27 by Georg Essl, 1999 - 2004.
28 Modified for Stk 4.0 by Gary Scavone.
29 */
30 /***************************************************/
31
32 #ifndef STK_BANDEDWG_H
33 #define STK_BANDEDWG_H
34
35 namespace Nyq
36 {
37
38 const int MAX_BANDED_MODES = 20;
39
40 } // namespace Nyq
41
42 #include "Instrmnt.h"
43 #include "DelayL.h"
44 #include "BowTable.h"
45 #include "ADSR.h"
46 #include "BiQuad.h"
47
48 namespace Nyq
49 {
50
51 class BandedWG : public Instrmnt
52 {
53 public:
54 //! Class constructor.
55 BandedWG();
56
57 //! Class destructor.
58 ~BandedWG();
59
60 //! Reset and clear all internal state.
61 void clear();
62
63 //! Set strike position (0.0 - 1.0).
64 void setStrikePosition(StkFloat position);
65
66 //! Select a preset.
67 void setPreset(int preset);
68
69 //! Set instrument parameters for a particular frequency.
70 void setFrequency(StkFloat frequency);
71
72 //! Apply bow velocity/pressure to instrument with given amplitude and rate of increase.
73 void startBowing(StkFloat amplitude, StkFloat rate);
74
75 //! Decrease bow velocity/breath pressure with given rate of decrease.
76 void stopBowing(StkFloat rate);
77
78 //! Pluck the instrument with given amplitude.
79 void pluck(StkFloat amp);
80
81 //! Start a note with the given frequency and amplitude.
82 void noteOn(StkFloat frequency, StkFloat amplitude);
83
84 //! Stop a note with the given amplitude (speed of decay).
85 void noteOff(StkFloat amplitude);
86
87 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
88 void controlChange(int number, StkFloat value);
89
90 protected:
91
92 StkFloat computeSample( void );
93
94 bool doPluck_;
95 bool trackVelocity_;
96 int nModes_;
97 int presetModes_;
98 BowTable bowTable_;
99 ADSR adsr_;
100 BiQuad bandpass_[MAX_BANDED_MODES];
101 DelayL delay_[MAX_BANDED_MODES];
102 StkFloat maxVelocity_;
103 StkFloat modes_[MAX_BANDED_MODES];
104 StkFloat frequency_;
105 StkFloat baseGain_;
106 StkFloat gains_[MAX_BANDED_MODES];
107 StkFloat basegains_[MAX_BANDED_MODES];
108 StkFloat excitation_[MAX_BANDED_MODES];
109 StkFloat integrationConstant_;
110 StkFloat velocityInput_;
111 StkFloat bowVelocity_;
112 StkFloat bowTarget_;
113 StkFloat bowPosition_;
114 StkFloat strikeAmp_;
115 int strikePosition_;
116
117 };
118
119 } // namespace Nyq
120
121 #endif