Debian Codegraph @

src/resid-fp/voicefp.cpp

raw symbols SCIP
1 // ---------------------------------------------------------------------------cxx . . $ `<file>/src/resid-fp/voicefp.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 "voicefp.h"cxx . . $ `<file>/src/resid-fp/voicefp.h`/
21
22 // ----------------------------------------------------------------------------
23 // Constructor.
24 // ----------------------------------------------------------------------------
25 VoiceFPcxx . . $ VoiceFP#::VoiceFPcxx . . $ VoiceFP#VoiceFP(49f6e7a06ebc5aa8).()
26 {
27 set_chip_modelcxx . . $ VoiceFP#set_chip_model(cea143c94d31b99f).(MOS6581cxx . . $ MOS6581.);
28 }
29
30 // ----------------------------------------------------------------------------
31 // Set chip model.
32 // ----------------------------------------------------------------------------
33 void VoiceFPcxx . . $ VoiceFP#::set_chip_modelcxx . . $ VoiceFP#set_chip_model(cea143c94d31b99f).(chip_modelcxx . . $ chip_model# model)
34 {
35 wavecxx . . $ VoiceFP#wave..set_chip_modelcxx . . $ WaveformGeneratorFP#set_chip_model(cea143c94d31b99f).(model);
36
37 if (model == MOS6581cxx . . $ MOS6581.) {
38 /* there is some level from each voice even if the env is down and osc
39 * is stopped. You can hear this by routing a voice into filter (filter
40 * should be kept disabled for this) as the master level changes. This
41 * tunable affects the volume of digis. */
42 voice_DCcxx . . $ VoiceFP#voice_DC. = static_cast<float>(0x800 * 0xff);
43 /* In 8580 the waveforms seem well centered, but on the 6581 there is some
44 * offset change as envelope grows, indicating that the waveforms are not
45 * perfectly centered. The likely cause for this is the follows:
46 *
47 * The waveform DAC generates a voltage between 5 and 12 V corresponding
48 * to oscillator state 0 .. 4095.
49 *
50 * The envelope DAC generates a voltage between waveform gen output and
51 * the 5V level.
52 *
53 * The outputs are amplified against the 12V voltage and sent to the
54 * mixer.
55 *
56 * The SID virtual ground is around 6.5 V. */
57 }
58 else {
59 voice_DCcxx . . $ VoiceFP#voice_DC. = 0.f;
60 }
61 }
62
63 // ----------------------------------------------------------------------------
64 // Register functions.
65 // ----------------------------------------------------------------------------
66 void VoiceFPcxx . . $ VoiceFP#::writeCONTROL_REGcxx . . $ VoiceFP#writeCONTROL_REG(9dc1848052cb5733).(WaveformGeneratorFPcxx . . $ WaveformGeneratorFP#& source, reg8cxx . . $ reg8# control)
67 {
68 wavecxx . . $ VoiceFP#wave..writeCONTROL_REGcxx . . $ WaveformGeneratorFP#writeCONTROL_REG(9dc1848052cb5733).(source, control);
69 envelopecxx . . $ VoiceFP#envelope..writeCONTROL_REGcxx . . $ EnvelopeGeneratorFP#writeCONTROL_REG(cb2f890c2fdad230).(control);
70 }
71
72 // ----------------------------------------------------------------------------
73 // SID reset.
74 // ----------------------------------------------------------------------------
75 void VoiceFPcxx . . $ VoiceFP#::resetcxx . . $ VoiceFP#reset(49f6e7a06ebc5aa8).()
76 {
77 wavecxx . . $ VoiceFP#wave..resetcxx . . $ WaveformGeneratorFP#reset(49f6e7a06ebc5aa8).();
78 envelopecxx . . $ VoiceFP#envelope..resetcxx . . $ EnvelopeGeneratorFP#reset(49f6e7a06ebc5aa8).();
79 }
80
81
82 // ----------------------------------------------------------------------------
83 // VoiceFP mute.
84 // ----------------------------------------------------------------------------
85 void VoiceFPcxx . . $ VoiceFP#::mutecxx . . $ VoiceFP#mute(b45ddcbc8423892c).(bool enable)
86 {
87 envelopecxx . . $ VoiceFP#envelope..mutecxx . . $ EnvelopeGeneratorFP#mute(b45ddcbc8423892c).(enable);
88 }