Skip to content

Commit 365cde5

Browse files
committed
Synced updates from the OPL3 Bank Editor
1 parent cde912b commit 365cde5

19 files changed

+1489
-390
lines changed

src/chips/LICENSE.txt

Lines changed: 504 additions & 0 deletions
Large diffs are not rendered by default.

src/chips/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# OPL2/OPL3 Chipset for C++
2+
3+
A bundle of various OPL2 and OPL3 emulators wrapped as unified C++ interface
4+
with the polymorphism and resampling.
5+
6+
Primarily used with the libADLMIDI and OPL3 Bank Editor projects.
7+
8+
This module supports C++98 and higher. However, the use of YMFM emualtors
9+
requires the support for C++14 standard by compilers.
10+
11+
# How to use
12+
- Include the desired emulator's header (or multiple) into your project (for example "nuked_opl3.h")
13+
- Have the pointer of type `OPLChipBase` that will hold the initialized emulator's instance.
14+
- Use emulator through the API at the `OPLChipBase` pointer:
15+
- Set the output sample rate.
16+
- Set properties like enable or disable simulated full-panning stereo.
17+
- Write data to register addresses.
18+
- Generate the output using one of available methods: single sample, or stream.
19+
- Delete chip by deleting the heap object via previous pointer. It's fine to use smart pointers.
20+
- You can use different chip emulators through the same interface.
21+
- Among emulators, you will find various interfaces over hardware outputs, they require additional setup like hardware address or COM port setup.
22+
23+
# License
24+
- The API itself is licensed under LGPLv2.1+.
25+
- Included chip emulators has various licenses:
26+
- **GPLv2+**:
27+
- DosBox OPL3 is licensed under GPLv2+.
28+
- LLE-OPL2 and LLE-OPL3 has the GPLv2+.
29+
- MAME OPL2 is licensed under GPLv2+.
30+
- **LGPLv2.1+**:
31+
- ESFMu is licensed under LGPLv2.1+.
32+
- Java OPL3 is licensed under LGPLv2.1+.
33+
- Nuked OPL3 emulator has LGPLv2.1+.
34+
- **Permissive**:
35+
- Opal OPL3 is public domain.
36+
- YMFM emulators has BSD-3-Clause license.

src/chips/chipset.cmake

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
set(CHIPS_SOURCES
2+
"${CMAKE_CURRENT_LIST_DIR}/dosbox_opl3.cpp"
3+
"${CMAKE_CURRENT_LIST_DIR}/dosbox_opl3.h"
4+
"${CMAKE_CURRENT_LIST_DIR}/esfmu_opl3.cpp"
5+
"${CMAKE_CURRENT_LIST_DIR}/esfmu_opl3.h"
6+
"${CMAKE_CURRENT_LIST_DIR}/java_opl3.cpp"
7+
"${CMAKE_CURRENT_LIST_DIR}/java_opl3.h"
8+
"${CMAKE_CURRENT_LIST_DIR}/mame_opl2.h"
9+
"${CMAKE_CURRENT_LIST_DIR}/mame_opl2.cpp"
10+
"${CMAKE_CURRENT_LIST_DIR}/nuked_opl3.cpp"
11+
"${CMAKE_CURRENT_LIST_DIR}/nuked_opl3.h"
12+
"${CMAKE_CURRENT_LIST_DIR}/opal_opl3.cpp"
13+
"${CMAKE_CURRENT_LIST_DIR}/opal_opl3.h"
14+
"${CMAKE_CURRENT_LIST_DIR}/opal/opal.c"
15+
"${CMAKE_CURRENT_LIST_DIR}/opal/opal.h"
16+
"${CMAKE_CURRENT_LIST_DIR}/esfmu/esfm.c"
17+
"${CMAKE_CURRENT_LIST_DIR}/esfmu/esfm.h"
18+
"${CMAKE_CURRENT_LIST_DIR}/esfmu/esfm_registers.c"
19+
"${CMAKE_CURRENT_LIST_DIR}/nuked/nukedopl3.c"
20+
"${CMAKE_CURRENT_LIST_DIR}/nuked/nukedopl3.h"
21+
"${CMAKE_CURRENT_LIST_DIR}/mame/opl.h"
22+
"${CMAKE_CURRENT_LIST_DIR}/mame/mame_fmopl.cpp"
23+
"${CMAKE_CURRENT_LIST_DIR}/dosbox/dbopl.cpp"
24+
"${CMAKE_CURRENT_LIST_DIR}/dosbox/dbopl.h"
25+
"${CMAKE_CURRENT_LIST_DIR}/nuked_opl3_v174.cpp"
26+
"${CMAKE_CURRENT_LIST_DIR}/nuked_opl3_v174.h"
27+
"${CMAKE_CURRENT_LIST_DIR}/nuked/nukedopl3_174.c"
28+
"${CMAKE_CURRENT_LIST_DIR}/nuked/nukedopl3_174.h"
29+
"${CMAKE_CURRENT_LIST_DIR}/ymf262_lle.cpp"
30+
"${CMAKE_CURRENT_LIST_DIR}/ymf262_lle.h"
31+
"${CMAKE_CURRENT_LIST_DIR}/ymf262_lle/nuked_fmopl3.c"
32+
"${CMAKE_CURRENT_LIST_DIR}/ymf262_lle/nuked_fmopl3.h"
33+
"${CMAKE_CURRENT_LIST_DIR}/ymf262_lle/nopl3.c"
34+
"${CMAKE_CURRENT_LIST_DIR}/ymf262_lle/nopl3.h"
35+
"${CMAKE_CURRENT_LIST_DIR}/ym3812_lle.cpp"
36+
"${CMAKE_CURRENT_LIST_DIR}/ym3812_lle.h"
37+
"${CMAKE_CURRENT_LIST_DIR}/ym3812_lle/nuked_fmopl2.c"
38+
"${CMAKE_CURRENT_LIST_DIR}/ym3812_lle/nuked_fmopl2.h"
39+
"${CMAKE_CURRENT_LIST_DIR}/ym3812_lle/nopl2.c"
40+
"${CMAKE_CURRENT_LIST_DIR}/ym3812_lle/nopl2.h"
41+
)
42+
43+
if(COMPILER_SUPPORTS_CXX14) # YMFM can be built in only condition when C++14 and newer were available
44+
set(YMFM_SOURCES
45+
"${CMAKE_CURRENT_LIST_DIR}/ymfm_opl2.cpp"
46+
"${CMAKE_CURRENT_LIST_DIR}/ymfm_opl2.h"
47+
"${CMAKE_CURRENT_LIST_DIR}/ymfm_opl3.cpp"
48+
"${CMAKE_CURRENT_LIST_DIR}/ymfm_opl3.h"
49+
"${CMAKE_CURRENT_LIST_DIR}/ymfm/ymfm.h"
50+
"${CMAKE_CURRENT_LIST_DIR}/ymfm/ymfm_opl.cpp"
51+
"${CMAKE_CURRENT_LIST_DIR}/ymfm/ymfm_opl.h"
52+
"${CMAKE_CURRENT_LIST_DIR}/ymfm/ymfm_misc.cpp"
53+
"${CMAKE_CURRENT_LIST_DIR}/ymfm/ymfm_misc.h"
54+
"${CMAKE_CURRENT_LIST_DIR}/ymfm/ymfm_pcm.cpp"
55+
"${CMAKE_CURRENT_LIST_DIR}/ymfm/ymfm_pcm.h"
56+
"${CMAKE_CURRENT_LIST_DIR}/ymfm/ymfm_adpcm.cpp"
57+
"${CMAKE_CURRENT_LIST_DIR}/ymfm/ymfm_adpcm.h"
58+
"${CMAKE_CURRENT_LIST_DIR}/ymfm/ymfm_ssg.cpp"
59+
"${CMAKE_CURRENT_LIST_DIR}/ymfm/ymfm_ssg.h"
60+
)
61+
if(DEFINED FLAG_CPP14)
62+
set_source_files_properties(${YMFM_SOURCES} COMPILE_FLAGS ${FLAG_CPP14})
63+
endif()
64+
list(APPEND CHIPS_SOURCES ${YMFM_SOURCES})
65+
endif()
66+
67+
if(ENABLE_OPL3_PROXY)
68+
list(APPEND CHIPS_SOURCES
69+
"${CMAKE_CURRENT_LIST_DIR}/win9x_opl_proxy.cpp"
70+
"${CMAKE_CURRENT_LIST_DIR}/win9x_opl_proxy.h"
71+
)
72+
endif()
73+
74+
if(ENABLE_SERIAL_PORT)
75+
list(APPEND CHIPS_SOURCES
76+
"${CMAKE_CURRENT_LIST_DIR}/opl_serial_port.cpp"
77+
"${CMAKE_CURRENT_LIST_DIR}/opl_serial_port.h"
78+
)
79+
endif()

src/chips/chipset.pri

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
SOURCES+= \
2+
$$PWD/dosbox_opl3.cpp \
3+
$$PWD/esfmu_opl3.cpp \
4+
$$PWD/java_opl3.cpp \
5+
$$PWD/mame_opl2.cpp \
6+
$$PWD/mame/mame_fmopl.cpp \
7+
$$PWD/nuked_opl3.cpp \
8+
$$PWD/opal_opl3.cpp \
9+
$$PWD/esfmu/esfm.c \
10+
$$PWD/esfmu/esfm_registers.c \
11+
$$PWD/opal/opal.c \
12+
$$PWD/nuked/nukedopl3.c \
13+
$$PWD/dosbox/dbopl.cpp \
14+
$$PWD/nuked_opl3_v174.cpp \
15+
$$PWD/nuked/nukedopl3_174.c \
16+
$$PWD/ymf262_lle.cpp \
17+
$$PWD/ymf262_lle/nuked_fmopl3.c \
18+
$$PWD/ymf262_lle/nopl3.c \
19+
$$PWD/ym3812_lle.cpp \
20+
$$PWD/ym3812_lle/nuked_fmopl2.c \
21+
$$PWD/ym3812_lle/nopl2.c
22+
23+
HEADERS+= \
24+
$$PWD/opl_chip_base.h \
25+
$$PWD/opl_chip_base.tcc \
26+
$$PWD/dosbox_opl3.h \
27+
$$PWD/esfmu_opl3.h \
28+
$$PWD/java_opl3.h \
29+
$$PWD/mame_opl2.h \
30+
$$PWD/mame/opl.h \
31+
$$PWD/nuked_opl3.h \
32+
$$PWD/opal_opl3.h \
33+
$$PWD/opal/opal.h \
34+
$$PWD/opl_chip_base.h \
35+
$$PWD/esfmu/esfm.h \
36+
$$PWD/java/JavaOPL3.hpp \
37+
$$PWD/nuked/nukedopl3.h \
38+
$$PWD/dosbox/dbopl.h \
39+
$$PWD/nuked_opl3_v174.h \
40+
$$PWD/nuked/nukedopl3_174.h \
41+
$$PWD/ymf262_lle.h \
42+
$$PWD/ymf262_lle/nuked_fmopl3.h \
43+
$$PWD/ymf262_lle/nopl3.h \
44+
$$PWD/ym3812_lle.h \
45+
$$PWD/ym3812_lle/nuked_fmopl2.h \
46+
$$PWD/ym3812_lle/nopl2.h
47+
48+
# Available when C++14 is supported
49+
enable_ymfm: {
50+
DEFINES += ENABLE_YMFM_EMULATOR
51+
52+
SOURCES+= \
53+
$$PWD/ymfm_opl2.cpp \
54+
$$PWD/ymfm_opl3.cpp \
55+
$$PWD/ymfm/ymfm_adpcm.cpp \
56+
$$PWD/ymfm/ymfm_misc.cpp \
57+
$$PWD/ymfm/ymfm_opl.cpp \
58+
$$PWD/ymfm/ymfm_pcm.cpp \
59+
$$PWD/ymfm/ymfm_ssg.cpp
60+
61+
HEADERS+= \
62+
$$PWD/ymfm_opl2.h \
63+
$$PWD/ymfm_opl3.h \
64+
$$PWD/ymfm/ymfm.h \
65+
$$PWD/ymfm/ymfm_adpcm.h \
66+
$$PWD/ymfm/ymfm_fm.h \
67+
$$PWD/ymfm/ymfm_fm.ipp \
68+
$$PWD/ymfm/ymfm_misc.h \
69+
$$PWD/ymfm/ymfm_opl.h \
70+
$$PWD/ymfm/ymfm_pcm.h \
71+
$$PWD/ymfm/ymfm_ssg.h
72+
}

src/chips/common/mutex.hpp

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
/*
2-
* libADLMIDI is a free Software MIDI synthesizer library with OPL3 emulation
2+
* Interfaces over Yamaha OPL3 (YMF262) chip emulators
33
*
4-
* Original ADLMIDI code: Copyright (c) 2010-2014 Joel Yliluoma <[email protected]>
5-
* ADLMIDI Library API: Copyright (c) 2015-2025 Vitaly Novichkov <[email protected]>
4+
* Copyright (c) 2017-2025 Vitaly Novichkov (Wohlstand)
65
*
7-
* Library is based on the ADLMIDI, a MIDI player for Linux and Windows with OPL3 emulation:
8-
* http://iki.fi/bisqwit/source/adlmidi.html
6+
* This library is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 2.1 of the License, or (at your option) any later version.
910
*
10-
* This program is free software: you can redistribute it and/or modify
11-
* it under the terms of the GNU General Public License as published by
12-
* the Free Software Foundation, either version 3 of the License, or
13-
* any later version.
14-
*
15-
* This program is distributed in the hope that it will be useful,
11+
* This library is distributed in the hope that it will be useful,
1612
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18-
* GNU General Public License for more details.
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
1915
*
20-
* You should have received a copy of the GNU General Public License
21-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
* You should have received a copy of the GNU Lesser General Public
17+
* License along with this library; if not, write to the Free Software
18+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2219
*/
2320

2421
#ifndef DOSBOX_NO_MUTEX

src/chips/common/ptr.hpp

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
/*
2-
* libADLMIDI is a free Software MIDI synthesizer library with OPL3 emulation
2+
* Interfaces over Yamaha OPL3 (YMF262) chip emulators
33
*
4-
* Original ADLMIDI code: Copyright (c) 2010-2014 Joel Yliluoma <[email protected]>
5-
* ADLMIDI Library API: Copyright (c) 2015-2025 Vitaly Novichkov <[email protected]>
4+
* Copyright (c) 2017-2025 Vitaly Novichkov (Wohlstand)
65
*
7-
* Library is based on the ADLMIDI, a MIDI player for Linux and Windows with OPL3 emulation:
8-
* http://iki.fi/bisqwit/source/adlmidi.html
6+
* This library is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 2.1 of the License, or (at your option) any later version.
910
*
10-
* This program is free software: you can redistribute it and/or modify
11-
* it under the terms of the GNU General Public License as published by
12-
* the Free Software Foundation, either version 3 of the License, or
13-
* any later version.
14-
*
15-
* This program is distributed in the hope that it will be useful,
11+
* This library is distributed in the hope that it will be useful,
1612
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18-
* GNU General Public License for more details.
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
1915
*
20-
* You should have received a copy of the GNU General Public License
21-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
* You should have received a copy of the GNU Lesser General Public
17+
* License along with this library; if not, write to the Free Software
18+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2219
*/
2320

2421
#ifndef MY_PTR_HPP_THING

src/chips/opl_serial_misc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ class ChipSerialPort : public ChipSerialPortBase
291291
(int)portPath.size(),
292292
(wchar_t *)wportPath.c_str(),
293293
(int)wportPath.size());
294+
wportPath.resize(newSize);
294295
m_port = CreateFile2(wportPath.c_str(), GENERIC_WRITE, 0, OPEN_EXISTING, NULL);
295296
#else
296297
m_port = CreateFileA(portPath.c_str(), GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);

src/chips/opl_serial_port.pri

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
QT += serialport
2+
3+
HEADERS += $$PWD/opl_serial_port.h
4+
SOURCES += $$PWD/opl_serial_port.cpp

src/chips/sync_from.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
SRC=`realpath $PWD/../../../OPL_ChipSet`
4+
DST=$PWD
5+
6+
if [[ ! -d $SRC ]]; then
7+
echo "Can't sync! You should clone this repository https://github.com/Wohlstand/OPL_ChipSet and place it in the same directory as libADLMIDI's one. It should be named as \"OPL_ChipSet\"."
8+
exit 1
9+
fi
10+
11+
rsync -vArXtU --exclude ".git" --exclude ".gitattributes" "$SRC/"* "$DST/"

src/chips/sync_to.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
DST=`realpath $PWD/../../../OPL_ChipSet`
4+
SRC=$PWD
5+
6+
if [[ ! -d $SRC ]]; then
7+
echo "Can't sync! You should clone this repository https://github.com/Wohlstand/OPL_ChipSet and place it in the same directory as libADLMIDI's one. It should be named as \"OPL_ChipSet\"."
8+
exit 1
9+
fi
10+
11+
rsync -vArXtU --exclude "sync_from.sh" --exclude "sync_to.sh" "$SRC/"* "$DST/"

0 commit comments

Comments
 (0)