LMMS
Loading...
Searching...
No Matches
realopl.h
Go to the documentation of this file.
1/*
2 * AdPlug - Replayer for many OPL2/OPL3 audio file formats.
3 * Copyright (C) 1999 - 2005 Simon Peter <dn.tlp@gmx.net>, et al.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library 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 GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * realopl.h - Real hardware OPL, by Simon Peter <dn.tlp@gmx.net>
20 * - Linux support by Tomas Pollak <tomas@forkhq.com>
21 */
22
23#ifndef H_ADPLUG_REALOPL
24#define H_ADPLUG_REALOPL
25
26#include "opl.h"
27
28#define DFL_ADLIBPORT 0x388 // default adlib baseport
29
30class CRealopl: public Copl {
31 public:
32 CRealopl(unsigned short initport = DFL_ADLIBPORT); // initport = OPL2 hardware baseport
33
34 bool detect(); // returns true if adlib compatible board is found, else false
35 void setvolume(int volume); // set adlib master volume (0 - 63) 0 = loudest, 63 = softest
36 void setquiet(bool quiet = true); // sets the OPL2 quiet, while still writing to the registers
37
38 void setport(unsigned short port) { // set new OPL2 hardware baseport
39 adlport = port;
40 }
41
42 void setnowrite(bool nw = true) { // set hardware write status
43 nowrite = nw;
44 }
45
46 int getvolume() { // get adlib master volume
47 return hardvol;
48 }
49
50 // template methods
51 void write(int reg, int val);
52 void init();
54 currType = type;
55 }
56
57 protected:
58 void hardwrite(int reg, int val); // write to OPL2 hardware registers
59 bool harddetect(); // do real hardware detection
60
61 // the 9 operators as expected by the OPL2
62 static const unsigned char op_table[9];
63
64 unsigned short adlport; // adlib hardware baseport
65 int hardvol, oldvol; // hardware master volume
66 bool bequiet; // quiet status cache
67 char hardvols[2][22][2]; // volume cache
68 bool nowrite; // don't write to hardware, if true
69#ifdef linux
70 bool gotperms; // if we've requested ioperms yet
71#endif
72};
73
74#endif
CAdPlugDatabase::CRecord::RecordType type
Definition adplugdb.cpp:93
int hardvol
Definition realopl.h:65
void setvolume(int volume)
Definition realopl.cpp:136
char hardvols[2][22][2]
Definition realopl.h:67
static const unsigned char op_table[9]
Definition realopl.h:58
void write(int reg, int val)
Definition realopl.cpp:188
void setquiet(bool quiet=true)
Definition realopl.cpp:150
bool detect()
Definition realopl.cpp:106
unsigned short adlport
Definition realopl.h:64
int getvolume()
Definition realopl.h:46
int oldvol
Definition realopl.h:65
bool bequiet
Definition realopl.h:66
void setnowrite(bool nw=true)
Definition realopl.h:42
void setport(unsigned short port)
Definition realopl.h:38
void hardwrite(int reg, int val)
Definition realopl.cpp:161
bool harddetect()
Definition realopl.cpp:86
CRealopl(unsigned short initport=DFL_ADLIBPORT)
Definition realopl.cpp:74
bool nowrite
Definition realopl.h:68
void settype(ChipType type)
Definition realopl.h:53
void init()
Definition realopl.cpp:217
ChipType
Definition opl.h:28
Copl()
Definition opl.h:32
ChipType currType
Definition opl.h:66
int val
Definition jpeglib.h:956
static float volume(float level)
Definition nekobee_voice_render.c:99
#define DFL_ADLIBPORT
Definition realopl.h:28