| 1 | #cxx . . $ `<file>/dwtools/Resonator.h`/ifndef _Resonator_h_ |
| 2 | #define _Resonator_h_cxx . . $ `dwtools/Resonator.h:2:9`! |
| 3 | /* Resonator.h |
| 4 | * |
| 5 | * Copyright (C) 2008-2019 David Weenink |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 15 | * See the GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | /* |
| 22 | * djmw 20081029 |
| 23 | * djmw 20110306 Latest modification |
| 24 | */ |
| 25 | |
| 26 | #include "Sound.h"cxx . . $ `<file>/fon/Sound.h`/ |
| 27 | |
| 28 | Thing_definecxx . . $ theClassInfo_Filter. (Filter, Daata) { |
| 29 | double samplingPeriodcxx . . $ structFilter#samplingPeriod.; |
| 30 | double acxx . . $ structFilter#a., bcxx . . $ structFilter#b., ccxx . . $ structFilter#c.; |
| 31 | double p1cxx . . $ structFilter#p1., p2cxx . . $ structFilter#p2.; |
| 32 | |
| 33 | virtual double v_getOutputcxx . . $ structFilter#v_getOutput(447c67c6676f75c3). (double input); |
| 34 | virtual void v_setCoefficientscxx . . $ structFilter#v_setCoefficients(bc12c9ec15586e6a). (double frequency, double bandwidth); |
| 35 | virtual void v_resetMemorycxx . . $ structFilter#v_resetMemory(49f6e7a06ebc5aa8). (); |
| 36 | }; |
| 37 | |
| 38 | Thing_definecxx . . $ SomeThingHandle# (Resonator, Filter) { |
| 39 | bool normaliseAtDCcxx . . $ structResonator#normaliseAtDC.; |
| 40 | |
| 41 | void v_setCoefficientscxx . . $ structResonator#v_setCoefficients(bc12c9ec15586e6a). (double frequency, double bandwidth) |
| 42 | override; |
| 43 | }; |
| 44 | |
| 45 | Thing_definecxx . . $ ClassInfo# (AntiResonator, Resonator) { |
| 46 | double v_getOutputcxx . . $ structAntiResonator#v_getOutput(447c67c6676f75c3). (double input) |
| 47 | override; |
| 48 | void v_setCoefficientscxx . . $ structAntiResonator#v_setCoefficients(bc12c9ec15586e6a). (double frequency, double bandwidth) |
| 49 | override; |
| 50 | }; |
| 51 | |
| 52 | Thing_definecxx . . $ constConstantGainResonator# (ConstantGainResonator, Filter) { |
| 53 | double dcxx . . $ structConstantGainResonator#d.; |
| 54 | double p3cxx . . $ structConstantGainResonator#p3., p4cxx . . $ structConstantGainResonator#p4.; |
| 55 | |
| 56 | double v_getOutputcxx . . $ structConstantGainResonator#v_getOutput(447c67c6676f75c3). (double input) |
| 57 | override; |
| 58 | void v_setCoefficientscxx . . $ structConstantGainResonator#v_setCoefficients(bc12c9ec15586e6a). (double frequency, double bandwidth) |
| 59 | override; |
| 60 | void v_resetMemorycxx . . $ structConstantGainResonator#v_resetMemory(49f6e7a06ebc5aa8). () |
| 61 | override; |
| 62 | }; |
| 63 | |
| 64 | autoResonatorcxx . . $ autoResonator# Resonator_createcxx . . $ Resonator_create(15e8c0c410711d65). (double samplingPeriod, bool normaliseAtDC); |
| 65 | |
| 66 | autoConstantGainResonatorcxx . . $ autoConstantGainResonator# ConstantGainResonator_createcxx . . $ ConstantGainResonator_create(ab00f84e06522bfd). (double samplingPeriod); |
| 67 | |
| 68 | autoAntiResonatorcxx . . $ autoAntiResonator# AntiResonator_createcxx . . $ AntiResonator_create(473e4a3e2f0be5f0). (double samplingPeriod); |
| 69 | |
| 70 | /* |
| 71 | Set a,b,c |
| 72 | normaliseAtDC == true: H(0) = 1 -> a = 1 - b - c |
| 73 | normaliseAtDC == false: H(Fmax) = 1 -> a = (1 + c)sin(2*pi*F*T) |
| 74 | */ |
| 75 | void Filter_setCoefficientscxx . . $ Filter_setCoefficients(8c9469244f9d62e9). (Filtercxx . . $ Filter# me, double frequency, double bandwidth); |
| 76 | |
| 77 | double Filter_getOutputcxx . . $ Filter_getOutput(3b7ebd8f53a54cf6). (Filtercxx . . $ Filter# me, double input); |
| 78 | |
| 79 | void Filter_resetMemorycxx . . $ Filter_resetMemory(ab2cc5e70e4bc2ca). (Filtercxx . . $ Filter# me); |
| 80 | |
| 81 | #endif /* _Resonator_h_ */ |
| 82 |