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#if defined(__clang__) && defined(__has_warning)
33# if __has_warning("-Wnewline-eof")
34# define COMPILER_HAS_NEWLINE_EOF_WARNING
35# endif
36#endif
37
38#ifdef COMPILER_HAS_NEWLINE_EOF_WARNING
39#pragma GCC diagnostic push
40#pragma GCC diagnostic ignored "-Wnewline-eof"
41#endif
42
43#include <RetroWaveLib/RetroWave.h>
44
45#ifdef COMPILER_HAS_NEWLINE_EOF_WARNING
46#pragma GCC diagnostic pop
47#endif
48
49namespace OPL {
50namespace RetroWaveOPL3 {
51
52class OPL : public ::OPL::OPL, public Audio::RealChip {
53private:
54 enum RWConnType {
55 RWCONNTYPE_POSIX_SERIAL,
56 RWCONNTYPE_WIN32_SERIAL,
57 RWCONNTYPE_LINUX_SPI,
58 RWCONNTYPE_WEB_SERIAL
59 };
60
61 Config::OplType _type;
62 int _activeReg;
63 bool _initialized;
64 RWConnType _connType;
65 bool _useBuffer;
66
67 RetroWaveContext _retrowaveGlobalContext;
68
69 Common::Mutex *_rwMutex;
70
71public:
72 explicit OPL(Config::OplType type);
73 ~OPL();
74
75 bool init() override;
76 void reset() override;
77
78 void write(int portAddress, int value) override;
79
80 void writeReg(int reg, int value) override;
81
82protected:
83 void writeReg(int reg, int value, bool forcePort);
84 void onTimer() override;
85};
86
87} // End of namespace RetroWaveOPL3
88} // End of namespace OPL
89
90#endif
Definition: chip.h:81
Definition: mutex.h:67
OplType
Definition: fmopl.h:58
Definition: fmopl.h:116
Definition: rwopl3.h:52
void reset() override
bool init() override
void write(int portAddress, int value) override
void writeReg(int reg, int value) override