ScummVM API documentation
rwopl3.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * Based on RetroWave OPL3 integration code of DOSBox-X
24  */
25 
26 #ifndef AUDIO_SOFTSYNTH_OPL_RWOPL3_H
27 #define AUDIO_SOFTSYNTH_OPL_RWOPL3_H
28 
29 #include "audio/fmopl.h"
30 #include "common/mutex.h"
31 
32 #include <RetroWaveLib/RetroWave.h>
33 
34 namespace OPL {
35 namespace RetroWaveOPL3 {
36 
37 class OPL : public ::OPL::OPL, public Audio::RealChip {
38 private:
39  enum RWConnType {
40  RWCONNTYPE_POSIX_SERIAL,
41  RWCONNTYPE_WIN32_SERIAL,
42  RWCONNTYPE_LINUX_SPI,
43  RWCONNTYPE_WEB_SERIAL
44  };
45 
46  Config::OplType _type;
47  int _activeReg;
48  bool _initialized;
49  RWConnType _connType;
50  bool _useBuffer;
51 
52  RetroWaveContext _retrowaveGlobalContext;
53 
54  Common::Mutex *_rwMutex;
55 
56 public:
57  explicit OPL(Config::OplType type);
58  ~OPL();
59 
60  bool init() override;
61  void reset() override;
62 
63  void write(int portAddress, int value) override;
64 
65  void writeReg(int reg, int value) override;
66 
67 protected:
68  void writeReg(int reg, int value, bool forcePort);
69  void onTimer() override;
70 };
71 
72 } // End of namespace RetroWaveOPL3
73 } // End of namespace OPL
74 
75 #endif
void reset() override
OplType
Definition: fmopl.h:58
Definition: mutex.h:67
Definition: fmopl.h:35
void writeReg(int reg, int value) override
void write(int portAddress, int value) override
Definition: chip.h:81
bool init() override
Definition: fmopl.h:115