Debian Codegraph @

src/resid/extfilt.cpp

raw symbols SCIP
1 // ---------------------------------------------------------------------------cxx . . $ `<file>/src/resid/extfilt.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 #define __EXTFILT_CC__cxx . . $ `src/resid/extfilt.cpp:20:9`!
21 #include "extfilt.h"cxx . . $ `<file>/src/resid/extfilt.h`/
22
23
24 // ----------------------------------------------------------------------------
25 // Constructor.
26 // ----------------------------------------------------------------------------
27 ExternalFiltercxx . . $ ExternalFilter#::ExternalFiltercxx . . $ ExternalFilter#ExternalFilter(49f6e7a06ebc5aa8).()
28 {
29 resetcxx . . $ ExternalFilter#reset(49f6e7a06ebc5aa8).();
30 enable_filtercxx . . $ ExternalFilter#enable_filter(b45ddcbc8423892c).(true);
31 set_chip_modelcxx . . $ ExternalFilter#set_chip_model(cea143c94d31b99f).(MOS6581cxx . . $ MOS6581.);
32
33 // Low-pass: R = 10kOhm, C = 1000pF; w0l = 1/RC = 1/(1e4*1e-9) = 100000
34 // High-pass: R = 1kOhm, C = 10uF; w0h = 1/RC = 1/(1e3*1e-5) = 100
35 // Multiply with 1.048576 to facilitate division by 1 000 000 by right-
36 // shifting 20 times (2 ^ 20 = 1048576).
37
38 w0lpcxx . . $ ExternalFilter#w0lp. = 104858;
39 w0hpcxx . . $ ExternalFilter#w0hp. = 105;
40 }
41
42
43 // ----------------------------------------------------------------------------
44 // Enable filter.
45 // ----------------------------------------------------------------------------
46 void ExternalFiltercxx . . $ ExternalFilter#::enable_filtercxx . . $ ExternalFilter#enable_filter(b45ddcbc8423892c).(bool enable)
47 {
48 enabledcxx . . $ ExternalFilter#enabled. = enable;
49 }
50
51
52 // ----------------------------------------------------------------------------
53 // Set chip model.
54 // ----------------------------------------------------------------------------
55 void ExternalFiltercxx . . $ ExternalFilter#::set_chip_modelcxx . . $ ExternalFilter#set_chip_model(cea143c94d31b99f).(chip_modelcxx . . $ chip_model# model)
56 {
57 if (model == MOS6581cxx . . $ MOS6581.) {
58 // Maximum mixer DC output level; to be removed if the external
59 // filter is turned off: ((wave DC + voice DC)*voices + mixer DC)*volume
60 // See voice.cc and filter.cc for an explanation of the values.
61 mixer_DCcxx . . $ ExternalFilter#mixer_DC. = ((((0x800 - 0x380) + 0x800)*0xff*3 - 0xfff*0xff/18) >> 7)*0x0f;
62 }
63 else {
64 // No DC offsets in the MOS8580.
65 mixer_DCcxx . . $ ExternalFilter#mixer_DC. = 0;
66 }
67 }
68
69
70 // ----------------------------------------------------------------------------
71 // SID reset.
72 // ----------------------------------------------------------------------------
73 void ExternalFiltercxx . . $ ExternalFilter#::resetcxx . . $ ExternalFilter#reset(49f6e7a06ebc5aa8).()
74 {
75 // State of filter.
76 Vlpcxx . . $ ExternalFilter#Vlp. = 0;
77 Vhpcxx . . $ ExternalFilter#Vhp. = 0;
78 Vocxx . . $ ExternalFilter#Vo. = 0;
79 }