psg.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Fred Klaus                                      *
00003  *   frednet@web.de                                                        *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef PSG_H
00021 #define PSG_H
00022 
00023 #include "types.h"
00024 
00025 class Sound;
00026 
00028 class Psg
00029 {
00030 
00031 public:
00032         Psg();
00033         ~Psg() {}
00034 
00035         void init();
00036 
00037         UBYTE control()  {return mControl;}
00038         UBYTE selected() {return mSelected;}
00039         UBYTE registerAY(int num) const {return mRegisterAY[num];}
00040         UBYTE registerAY()        const {return mRegisterAY[mSelected];}
00041 
00042         UBYTE tonALo()     const {return mRegisterAY[0];}
00043         UBYTE tonAHi()     const {return mRegisterAY[1];}
00044         UBYTE tonBLo()     const {return mRegisterAY[2];}
00045         UBYTE tonBHi()     const {return mRegisterAY[3];}
00046         UBYTE tonCLo()     const {return mRegisterAY[4];}
00047         UBYTE tonCHi()     const {return mRegisterAY[5];}
00048         UBYTE noise()      const {return mRegisterAY[6];}
00049         UBYTE mixer()      const {return mRegisterAY[7];}
00050         UBYTE amplitudeA() const {return mRegisterAY[8];}
00051         UBYTE amplitudeB() const {return mRegisterAY[9];}
00052         UBYTE amplitudeC() const {return mRegisterAY[10];}
00053         UBYTE envelopeLo() const {return mRegisterAY[11];}
00054         UBYTE envelopeHi() const {return mRegisterAY[12];}
00055         UBYTE envType()    const {return mRegisterAY[13];}
00056         UBYTE portA()      const {return mRegisterAY[14];}
00057         UBYTE portB()      const {return mRegisterAY[15];}
00058 
00059         WORD tonALoW()     const {return *(WORD*) &mRegisterAY[0];}
00060         WORD tonAHiW()     const {return *(WORD*) &mRegisterAY[1];}
00061         WORD tonBLoW()     const {return *(WORD*) &mRegisterAY[2];}
00062         WORD tonBHiW()     const {return *(WORD*) &mRegisterAY[3];}
00063         WORD tonCLoW()     const {return *(WORD*) &mRegisterAY[4];}
00064         WORD tonCHiW()     const {return *(WORD*) &mRegisterAY[5];}
00065         WORD envelopeLoW() const {return *(WORD*) &mRegisterAY[11];}
00066 
00067         int  amplitudeEnv() const {return mAmplitudeEnv;}
00068         bool firstPeriod()  const {return mFirstPeriod;}
00069 
00070         void setControl (UBYTE val)            {mControl = val;}
00071         void setSelected(UBYTE val)            {mSelected = val;}
00072         void setRegisterAY(int num, UBYTE val) {mRegisterAY[num]=val;}
00073 
00074         void setTonALo(UBYTE value)     {mRegisterAY[0]=value;}
00075         void setTonAHi(UBYTE value)     {mRegisterAY[1]=value;}
00076         void setTonBLo(UBYTE value)     {mRegisterAY[2]=value;}
00077         void setTonBHi(UBYTE value)     {mRegisterAY[3]=value;}
00078         void setTonCLo(UBYTE value)     {mRegisterAY[4]=value;}
00079         void setTonCHi(UBYTE value)     {mRegisterAY[5]=value;}
00080         void setNoise(UBYTE value)      {mRegisterAY[6]=value;}
00081         void setMixer(UBYTE value)      {mRegisterAY[7]=value;}
00082         void setAmplitudeA(UBYTE value) {mRegisterAY[8]=value;}
00083         void setAmplitudeB(UBYTE value) {mRegisterAY[9]=value;}
00084         void setAmplitudeC(UBYTE value) {mRegisterAY[10]=value;}
00085         void setEnvelopeLo(UBYTE value) {mRegisterAY[11]=value;}
00086         void setEnvelopeHi(UBYTE value) {mRegisterAY[12]=value;}
00087         void setEnvType(UBYTE value)    {mRegisterAY[13]=value;}
00088         void setPortA(UBYTE value)      {mRegisterAY[14]=value;}
00089         void setPortB(UBYTE value)      {mRegisterAY[15]=value;}
00090 
00091         void setAmplitudeEnv(int value)  {mAmplitudeEnv=value;}
00092         void setFirstPeriod (bool value) {mFirstPeriod =value;}
00093 
00094 private:
00095 
00096         UBYTE mControl;
00097         UBYTE mSelected;
00098 
00099         UBYTE mRegisterAY[16];
00100 
00101         int   mAmplitudeEnv;
00102         bool  mFirstPeriod;
00103 
00104 };
00105 
00106 #endif

Generated on Fri Mar 16 21:30:28 2007 for roland.kdevelop by  doxygen 1.5.0