Debian Codegraph @

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

raw
1 /***************************************************/
2 /*! \class DelayA
3 \brief STK allpass interpolating delay line class.
4
5 This Delay subclass implements a fractional-length digital
6 delay-line using a first-order allpass filter. A fixed maximum
7 length of 4095 and a delay of 0.5 is set using the default
8 constructor. Alternatively, the delay and maximum length can be
9 set during instantiation with an overloaded constructor.
10
11 An allpass filter has unity magnitude gain but variable phase
12 delay properties, making it useful in achieving fractional delays
13 without affecting a signal's frequency magnitude response. In
14 order to achieve a maximally flat phase delay response, the
15 minimum delay possible in this implementation is limited to a
16 value of 0.5.
17
18 by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
19 */
20 /***************************************************/
21
22 #ifndef STK_DELAYA_H
23 #define STK_DELAYA_H
24
25 #include "Delay.h"
26
27 namespace Nyq
28 {
29
30 class DelayA : public Delay
31 {
32 public:
33
34 //! Default constructor creates a delay-line with maximum length of 4095 samples and zero delay.
35 DelayA();
36
37 //! Overloaded constructor which specifies the current and maximum delay-line lengths.
38 /*!
39 An StkError will be thrown if the delay parameter is less than
40 zero, the maximum delay parameter is less than one, or the delay
41 parameter is greater than the maxDelay value.
42 */
43 DelayA(StkFloat delay, unsigned long maxDelay);
44
45 //! Class destructor.
46 ~DelayA();
47
48 //! Clears the internal state of the delay line.
49 void clear();
50
51 //! Set the delay-line length
52 /*!
53 The valid range for \e theDelay is from 0.5 to the maximum delay-line length.
54 */
55 void setDelay(StkFloat delay);
56
57 //! Return the current delay-line length.
58 StkFloat getDelay(void) const;
59
60 //! Return the value which will be output by the next call to tick().
61 /*!
62 This method is valid only for delay settings greater than zero!
63 */
64 StkFloat nextOut(void);
65
66 protected:
67
68 StkFloat computeSample( StkFloat input );
69
70 StkFloat alpha_;
71 StkFloat coeff_;
72 StkFloat apInput_;
73 StkFloat nextOutput_;
74 bool doNextOut_;
75 };
76
77 } // namespace Nyq
78
79 #endif