ROLAND  0.70
Amstrad Emulator based on Caprice Source rewritten in C++.
psg.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) by Fred Klaus *
3  * development@fkweb.de *
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 *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 #ifndef PSG_H
21 #define PSG_H
22 
23 #include "compspec.h"
24 #include "types.h"
25 
26 namespace cpcx
27 {
28 
29  class Sound;
30 
32  class Psg final
33  {
34 
35  public:
36  Psg() {init();}
38 
39  void init();
40 
41  tUBYTE control() const {return mControl;}
42  tUBYTE selected() const {return mSelected;}
43  tUBYTE registerAY(int num) const {return mRegisterAY[num];}
45 
46  tUBYTE tonALo() const {return mRegisterAY[0];}
47  tUBYTE tonAHi() const {return mRegisterAY[1];}
48  tUBYTE tonBLo() const {return mRegisterAY[2];}
49  tUBYTE tonBHi() const {return mRegisterAY[3];}
50  tUBYTE tonCLo() const {return mRegisterAY[4];}
51  tUBYTE tonCHi() const {return mRegisterAY[5];}
52  tUBYTE noise() const {return mRegisterAY[6];}
53  tUBYTE mixer() const {return mRegisterAY[7];}
54  tUBYTE amplitudeA() const {return mRegisterAY[8];}
55  tUBYTE amplitudeB() const {return mRegisterAY[9];}
56  tUBYTE amplitudeC() const {return mRegisterAY[10];}
57  tUBYTE envelopeLo() const {return mRegisterAY[11];}
58  tUBYTE envelopeHi() const {return mRegisterAY[12];}
59  tUBYTE envType() const {return mRegisterAY[13];}
60  tUBYTE portA() const {return mRegisterAY[14];}
61  tUBYTE portB() const {return mRegisterAY[15];}
62 
63  tWORD tonALoW() const {return *(tWORD*) &mRegisterAY[0];}
64  tWORD tonAHiW() const {return *(tWORD*) &mRegisterAY[1];}
65  tWORD tonBLoW() const {return *(tWORD*) &mRegisterAY[2];}
66  tWORD tonBHiW() const {return *(tWORD*) &mRegisterAY[3];}
67  tWORD tonCLoW() const {return *(tWORD*) &mRegisterAY[4];}
68  tWORD tonCHiW() const {return *(tWORD*) &mRegisterAY[5];}
69  tWORD envelopeLoW() const {return *(tWORD*) &mRegisterAY[11];}
70 
71  int amplitudeEnv() const {return mAmplitudeEnv;}
72  bool firstPeriod() const {return mFirstPeriod;}
73 
74  void setControl (tUBYTE val) {mControl = val;}
75  void setSelected(tUBYTE val) {mSelected = val;}
76  void setRegisterAY(int num, tUBYTE val) {mRegisterAY[num] = val;}
77 
78  void setTonALo(tUBYTE value) {mRegisterAY[0] = value;}
79  void setTonAHi(tUBYTE value) {mRegisterAY[1] = value;}
80  void setTonBLo(tUBYTE value) {mRegisterAY[2] = value;}
81  void setTonBHi(tUBYTE value) {mRegisterAY[3] = value;}
82  void setTonCLo(tUBYTE value) {mRegisterAY[4] = value;}
83  void setTonCHi(tUBYTE value) {mRegisterAY[5] = value;}
84  void setNoise(tUBYTE value) {mRegisterAY[6] = value;}
85  void setMixer(tUBYTE value) {mRegisterAY[7] = value;}
86  void setAmplitudeA(tUBYTE value) {mRegisterAY[8] = value;}
87  void setAmplitudeB(tUBYTE value) {mRegisterAY[9] = value;}
88  void setAmplitudeC(tUBYTE value) {mRegisterAY[10] = value;}
89  void setEnvelopeLo(tUBYTE value) {mRegisterAY[11] = value;}
90  void setEnvelopeHi(tUBYTE value) {mRegisterAY[12] = value;}
91  void setEnvType(tUBYTE value) {mRegisterAY[13] = value;}
92  void setPortA(tUBYTE value) {mRegisterAY[14] = value;}
93  void setPortB(tUBYTE value) {mRegisterAY[15] = value;}
94 
95  void setAmplitudeEnv(int value) {mAmplitudeEnv = value;}
96  void setFirstPeriod (bool value) {mFirstPeriod = value;}
97 
98  private:
99 
102 
104 
107 
108  };
109 
110 } // cpc
111 
112 #endif
tUBYTE tonCHi() const
Definition: psg.h:51
void setPortB(tUBYTE value)
Definition: psg.h:93
tWORD tonCLoW() const
Definition: psg.h:67
tUBYTE registerAY(int num) const
Definition: psg.h:43
~Psg() ROLAND_DEFAULT void init()
void setControl(tUBYTE val)
Definition: psg.h:74
void init()
Definition: roland.cpp:97
tUBYTE tonAHi() const
Definition: psg.h:47
Definition: psg.h:32
tWORD tonCHiW() const
Definition: psg.h:68
tUBYTE tonBHi() const
Definition: psg.h:49
void setTonCHi(tUBYTE value)
Definition: psg.h:83
void setTonBHi(tUBYTE value)
Definition: psg.h:81
void setAmplitudeB(tUBYTE value)
Definition: psg.h:87
Namespace for all CPC components.
Definition: colours.cpp:22
tUBYTE mControl
Definition: psg.h:100
tUBYTE envelopeLo() const
Definition: psg.h:57
void setFirstPeriod(bool value)
Definition: psg.h:96
tUBYTE tonALo() const
Definition: psg.h:46
tUBYTE mixer() const
Definition: psg.h:53
void setTonCLo(tUBYTE value)
Definition: psg.h:82
tUBYTE amplitudeB() const
Definition: psg.h:55
tUBYTE noise() const
Definition: psg.h:52
void setTonBLo(tUBYTE value)
Definition: psg.h:80
void setEnvelopeLo(tUBYTE value)
Definition: psg.h:89
tUBYTE envelopeHi() const
Definition: psg.h:58
void setAmplitudeC(tUBYTE value)
Definition: psg.h:88
tWORD tonBLoW() const
Definition: psg.h:65
tUBYTE control() const
Definition: psg.h:41
void setRegisterAY(int num, tUBYTE val)
Definition: psg.h:76
void setPortA(tUBYTE value)
Definition: psg.h:92
void setSelected(tUBYTE val)
Definition: psg.h:75
bool firstPeriod() const
Definition: psg.h:72
tUBYTE mRegisterAY[16]
Definition: psg.h:103
void setNoise(tUBYTE value)
Definition: psg.h:84
int mAmplitudeEnv
Definition: psg.h:105
tWORD tonBHiW() const
Definition: psg.h:66
tUBYTE registerAY() const
Definition: psg.h:44
void setEnvelopeHi(tUBYTE value)
Definition: psg.h:90
tUBYTE portA() const
Definition: psg.h:60
tUBYTE tonBLo() const
Definition: psg.h:48
tUBYTE envType() const
Definition: psg.h:59
void setAmplitudeA(tUBYTE value)
Definition: psg.h:86
tUBYTE tonCLo() const
Definition: psg.h:50
void setEnvType(tUBYTE value)
Definition: psg.h:91
tWORD envelopeLoW() const
Definition: psg.h:69
tUBYTE selected() const
Definition: psg.h:42
bool mFirstPeriod
Definition: psg.h:106
#define ROLAND_DEFAULT
Definition: compspec.h:46
uint8_t tUBYTE
Definition: types.h:74
void setTonAHi(tUBYTE value)
Definition: psg.h:79
tWORD tonAHiW() const
Definition: psg.h:64
void setAmplitudeEnv(int value)
Definition: psg.h:95
tUBYTE mSelected
Definition: psg.h:101
int16_t tWORD
Definition: types.h:46
tWORD tonALoW() const
Definition: psg.h:63
Psg()
Definition: psg.h:36
void setMixer(tUBYTE value)
Definition: psg.h:85
void setTonALo(tUBYTE value)
Definition: psg.h:78
tUBYTE portB() const
Definition: psg.h:61
tUBYTE amplitudeA() const
Definition: psg.h:54
int amplitudeEnv() const
Definition: psg.h:71
tUBYTE amplitudeC() const
Definition: psg.h:56