Debian Codegraph @

src/engine/platform/sound/sid2/voice.cc

raw
1 // ---------------------------------------------------------------------------
2 // This file is part of reSID, a MOS6581_2 SID2 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 __VOICE_CC__
21 #include "voice.h"
22
23 // ----------------------------------------------------------------------------
24 // Constructor.
25 // ----------------------------------------------------------------------------
26 Voice2::Voice2()
27 {
28 set_chip_model(MOS6581_2);
29 }
30
31 // ----------------------------------------------------------------------------
32 // Set chip model.
33 // ----------------------------------------------------------------------------
34 void Voice2::set_chip_model(chip_model2 model)
35 {
36 wave.set_chip_model(model);
37 wave_zero = 0x800;
38 voice_DC = 0;
39 }
40
41 // ----------------------------------------------------------------------------
42 // Set sync source.
43 // ----------------------------------------------------------------------------
44 void Voice2::set_sync_source(Voice2* source)
45 {
46 wave.set_sync_source(&source->wave);
47 }
48
49 // ----------------------------------------------------------------------------
50 // Register functions.
51 // ----------------------------------------------------------------------------
52 void Voice2::writeCONTROL_REG(reg8 control)
53 {
54 wave.writeCONTROL_REG(control);
55 envelope.writeCONTROL_REG(control);
56 }
57
58 // ----------------------------------------------------------------------------
59 // SID2 reset.
60 // ----------------------------------------------------------------------------
61 void Voice2::reset()
62 {
63 wave.reset();
64 envelope.reset();
65 }