aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi_opl3.cpp
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2020-08-16 04:30:02 +0300
committerWohlstand <admin@wohlnet.ru>2020-08-16 04:30:02 +0300
commit4c902ffd185b552f567abe25dfcc26c09fc27a21 (patch)
treec433aac0f6a860ddc99585a9238d0e82e43d35ce /src/adlmidi_opl3.cpp
parent5b8376c1e8ffc9a52214a4e42bea088a5a0c615a (diff)
downloadlibADLMIDI-4c902ffd185b552f567abe25dfcc26c09fc27a21.tar.gz
libADLMIDI-4c902ffd185b552f567abe25dfcc26c09fc27a21.tar.bz2
libADLMIDI-4c902ffd185b552f567abe25dfcc26c09fc27a21.zip
Tuned the work on hardware OPL3 chip
#230
Diffstat (limited to 'src/adlmidi_opl3.cpp')
-rw-r--r--src/adlmidi_opl3.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/adlmidi_opl3.cpp b/src/adlmidi_opl3.cpp
index 59773d3..7ba4a13 100644
--- a/src/adlmidi_opl3.cpp
+++ b/src/adlmidi_opl3.cpp
@@ -232,6 +232,13 @@ OPL3::OPL3() :
OPL3::~OPL3()
{
+#ifdef ADLMIDI_HW_OPL
+ silenceAll();
+ writeRegI(0, 0x0BD, 0);
+ writeRegI(0, 0x104, 0);
+ writeRegI(0, 0x105, 0);
+ silenceAll();
+#endif
}
bool OPL3::setupLocked()
@@ -275,19 +282,19 @@ void OPL3::writeReg(size_t chip, uint16_t address, uint8_t value)
unsigned o = address >> 8;
unsigned port = OPLBase + o * 2;
- #ifdef __DJGPP__
+# ifdef __DJGPP__
outportb(port, address);
for(unsigned c = 0; c < 6; ++c) inportb(port);
outportb(port + 1, value);
for(unsigned c = 0; c < 35; ++c) inportb(port);
- #endif
+# endif
- #ifdef __WATCOMC__
+# ifdef __WATCOMC__
outp(port, address);
for(uint16_t c = 0; c < 6; ++c) inp(port);
outp(port + 1, value);
for(uint16_t c = 0; c < 35; ++c) inp(port);
- #endif//__WATCOMC__
+# endif//__WATCOMC__
#else//ADLMIDI_HW_OPL
m_chips[chip]->writeReg(address, value);