| 1 | // ---------------------------------------------------------------------------cxx . . $ `<file>/src/resid-fp/extfiltfp.cpp`/ |
| 2 | // This file is part of reSID, a MOS6581 SID emulator engine. |
| 3 | // Copyright (C) 2004 Dag Lem <[email protected]> |
| 4 | // |
| 5 | // This program is free software; you can redistribute it and/or modify |
| 6 | // it under the terms of the GNU General Public License as published by |
| 7 | // the Free Software Foundation; either version 2 of the License, or |
| 8 | // (at your option) any later version. |
| 9 | // |
| 10 | // This program is distributed in the hope that it will be useful, |
| 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | // GNU General Public License for more details. |
| 14 | // |
| 15 | // You should have received a copy of the GNU General Public License |
| 16 | // along with this program; if not, write to the Free Software |
| 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | // --------------------------------------------------------------------------- |
| 19 | |
| 20 | #include "extfiltfp.h"cxx . . $ `<file>/src/resid-fp/extfiltfp.h`/ |
| 21 | |
| 22 | const float pass_frequencycxx . . $ pass_frequency. = 15915.6f; |
| 23 | |
| 24 | // ---------------------------------------------------------------------------- |
| 25 | // Constructor. |
| 26 | // ---------------------------------------------------------------------------- |
| 27 | ExternalFilterFPcxx . . $ ExternalFilterFP#::ExternalFilterFPcxx . . $ ExternalFilterFP#ExternalFilterFP(49f6e7a06ebc5aa8).() |
| 28 | { |
| 29 | resetcxx . . $ ExternalFilterFP#reset(49f6e7a06ebc5aa8).(); |
| 30 | set_clock_frequencycxx . . $ ExternalFilterFP#set_clock_frequency(9364e6e7bff7660).(1e6f); |
| 31 | } |
| 32 | |
| 33 | // ---------------------------------------------------------------------------- |
| 34 | // Setup of the external filter sampling parameters. |
| 35 | // ---------------------------------------------------------------------------- |
| 36 | void ExternalFilterFPcxx . . $ ExternalFilterFP#::set_clock_frequencycxx . . $ ExternalFilterFP#set_clock_frequency(9364e6e7bff7660).(float clock_frequency) |
| 37 | { |
| 38 | // Low-pass: R = 10kOhm, C = 1000pF; w0l = 1/RC = 1/(1e4*1e-9) = 100000 |
| 39 | // High-pass: R = 1kOhm, C = 10uF; w0h = 1/RC = 1/(1e3*1e-5) = 100 |
| 40 | w0hpcxx . . $ ExternalFilterFP#w0hp. = 100.f / clock_frequency; |
| 41 | w0lpcxx . . $ ExternalFilterFP#w0lp. = pass_frequencycxx . . $ pass_frequency. * 2.f * static_cast<float>(M_PIcxx . . $ `src/resid/siddefs.h:25:9`!) / clock_frequency; |
| 42 | } |
| 43 | |
| 44 | // ---------------------------------------------------------------------------- |
| 45 | // SID reset. |
| 46 | // ---------------------------------------------------------------------------- |
| 47 | void ExternalFilterFPcxx . . $ ExternalFilterFP#::resetcxx . . $ ExternalFilterFP#reset(49f6e7a06ebc5aa8).() |
| 48 | { |
| 49 | // State of filter. |
| 50 | Vlpcxx . . $ ExternalFilterFP#Vlp. = 0; |
| 51 | Vhpcxx . . $ ExternalFilterFP#Vhp. = 0; |
| 52 | } |