Debian Codegraph @

src/resid-fp/voicefp.h

raw symbols SCIP
1 // ---------------------------------------------------------------------------
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 #ifndef __VOICEFP_H__
21 #define __VOICEFP_H__
22
23 #include "siddefsfp.h"
24 #include "wavefp.h"
25 #include "envelopefp.h"
26
27 class VoiceFP
28 {
29 public:
30 VoiceFP();
31
32 void set_chip_model(chip_model model);
33 void reset();
34 void mute(bool enable);
35
36 void writeCONTROL_REG(WaveformGeneratorFP& source, reg8 value);
37
38 // Amplitude modulated waveform output.
39 // Range [-2048*255, 2047*255].
40 inline float output(WaveformGeneratorFP& source);
41
42 protected:
43 WaveformGeneratorFP wave;
44 EnvelopeGeneratorFP envelope;
45
46 // Multiplying D/A DC offset.
47 float voice_DC;
48 friend class SIDFP;
49 };
50
51 // ----------------------------------------------------------------------------
52 // Amplitude modulated waveform output.
53 // Ideal range [-2048*255, 2047*255].
54 // ----------------------------------------------------------------------------
55
56 inline
57 float VoiceFP::output(WaveformGeneratorFP& source)
58 {
59 return wave.output(source) * envelope.output() + voice_DC;
60 }
61
62 #endif // not __VOICEFP_H__