libsidplayfp
1.1.0
Main Page
Classes
Files
Examples
File List
builders
residfp-builder
residfp
Voice.h
1
/*
2
* This file is part of libsidplayfp, a SID player engine.
3
*
4
* Copyright 2011-2013 Leandro Nini <drfiemost@users.sourceforge.net>
5
* Copyright 2007-2010 Antti Lankila
6
* Copyright 2004 Dag Lem <resid@nimrod.no>
7
*
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
*/
22
23
#ifndef VOICE_H
24
#define VOICE_H
25
26
#include "siddefs-fp.h"
27
#include "WaveformGenerator.h"
28
#include "EnvelopeGenerator.h"
29
30
namespace
reSIDfp
31
{
32
41
class
Voice
42
{
43
private
:
44
WaveformGenerator
* waveformGenerator;
45
46
EnvelopeGenerator
* envelopeGenerator;
47
48
public
:
63
RESID_INLINE
64
int
output
(
const
WaveformGenerator
* ringModulator)
const
65
{
66
return
waveformGenerator->
output
(ringModulator) * envelopeGenerator->
output
();
67
}
68
72
Voice
() :
73
waveformGenerator(new
WaveformGenerator
()),
74
envelopeGenerator(new
EnvelopeGenerator
()) {}
75
76
~
Voice
()
77
{
78
delete
waveformGenerator;
79
delete
envelopeGenerator;
80
}
81
82
WaveformGenerator* wave()
const
{
return
waveformGenerator; }
83
84
EnvelopeGenerator* envelope()
const
{
return
envelopeGenerator; }
85
86
// ----------------------------------------------------------------------------
87
// Register functions.
88
// ----------------------------------------------------------------------------
89
95
void
writeCONTROL_REG
(
unsigned
char
control)
96
{
97
waveformGenerator->
writeCONTROL_REG
(control);
98
envelopeGenerator->
writeCONTROL_REG
(control);
99
}
100
104
void
reset
()
105
{
106
waveformGenerator->
reset
();
107
envelopeGenerator->
reset
();
108
}
109
};
110
111
}
// namespace reSIDfp
112
113
#endif
Generated on Tue Oct 22 2013 09:14:39 for libsidplayfp by
1.8.4