Debian Codegraph @

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

raw
1 /***************************************************/
2 /*! \class PluckTwo
3 \brief STK enhanced plucked string model class.
4
5 This class implements an enhanced two-string,
6 plucked physical model, a la Jaffe-Smith,
7 Smith, and others.
8
9 PluckTwo is an abstract class, with no excitation
10 specified. Therefore, it can't be directly
11 instantiated.
12
13 This is a digital waveguide model, making its
14 use possibly subject to patents held by
15 Stanford University, Yamaha, and others.
16
17 by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
18 */
19 /***************************************************/
20
21 #ifndef STK_PLUCKTWO_H
22 #define STK_PLUCKTWO_H
23
24 #include "Instrmnt.h"
25 #include "DelayL.h"
26 #include "DelayA.h"
27 #include "OneZero.h"
28
29 namespace Nyq
30 {
31
32 class PluckTwo : public Instrmnt
33 {
34 public:
35 //! Class constructor, taking the lowest desired playing frequency.
36 PluckTwo(StkFloat lowestFrequency);
37
38 //! Class destructor.
39 virtual ~PluckTwo();
40
41 //! Reset and clear all internal state.
42 void clear();
43
44 //! Set instrument parameters for a particular frequency.
45 virtual void setFrequency(StkFloat frequency);
46
47 //! Detune the two strings by the given factor. A value of 1.0 produces unison strings.
48 void setDetune(StkFloat detune);
49
50 //! Efficient combined setting of frequency and detuning.
51 void setFreqAndDetune(StkFloat frequency, StkFloat detune);
52
53 //! Set the pluck or "excitation" position along the string (0.0 - 1.0).
54 void setPluckPosition(StkFloat position);
55
56 //! Set the base loop gain.
57 /*!
58 The actual loop gain is set according to the frequency.
59 Because of high-frequency loop filter roll-off, higher
60 frequency settings have greater loop gains.
61 */
62 void setBaseLoopGain(StkFloat aGain);
63
64 //! Stop a note with the given amplitude (speed of decay).
65 virtual void noteOff(StkFloat amplitude);
66
67 protected:
68
69 virtual StkFloat computeSample( void ) = 0;
70
71 DelayA delayLine_;
72 DelayA delayLine2_;
73 DelayL combDelay_;
74 OneZero filter_;
75 OneZero filter2_;
76
77 unsigned long length_;
78 StkFloat loopGain_;
79 StkFloat baseLoopGain_;
80 StkFloat lastFrequency_;
81 StkFloat lastLength_;
82 StkFloat detuning_;
83 StkFloat pluckAmplitude_;
84 StkFloat pluckPosition_;
85
86 };
87
88 } // namespace Nyq
89
90 #endif