aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt93
-rw-r--r--README.md34
-rw-r--r--src/adlmidi.cpp25
-rw-r--r--src/adlmidi_load.cpp8
-rw-r--r--src/adlmidi_midiplay.cpp30
-rw-r--r--src/adlmidi_mus2mid.c2
-rw-r--r--src/adlmidi_private.hpp25
-rw-r--r--src/chips/dosbox/dbopl.cpp54
-rw-r--r--src/chips/nuked/nukedopl3_174.c206
-rw-r--r--src/chips/nuked/nukedopl3_174.h2
-rw-r--r--src/fraction.hpp9
-rw-r--r--utils/adlmidi-2/9x15.hpp10
-rw-r--r--utils/adlmidi-2/midiplay.cc1
-rw-r--r--utils/adlmidi-2/puzzlegame.cc2
-rwxr-xr-xutils/adlmidi-2/puzzlegame.hpp2
-rw-r--r--utils/dumpbank/dumpbank.cpp7
-rw-r--r--utils/dumpmiles/dumpmiles.cpp9
-rw-r--r--utils/vlc_codec/libadlmidi.c32
18 files changed, 310 insertions, 241 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0bf7719..21fd643 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,27 +56,29 @@ function(set_legacy_standard destTarget)
endfunction()
#===========================================================================================
-option(WITH_MIDIPLAY "Build also demo MIDI player" OFF)
-option(MIDIPLAY_WAVE_ONLY "Build Demo MIDI player without support of real time playing. It will output into WAV only." OFF)
-option(WITH_ADLMIDI2 "Build also classic ADLMIDI player [EXPERIMENTAL]" OFF)
-option(WITH_VLC_PLUGIN "Build also a plugin for VLC Media Player" OFF)
-option(WITH_OLD_UTILS "Build also old utilities" OFF)
-option(WITH_EMBEDDED_BANKS "Use embedded banks" ON)
-option(WITH_GENADLDATA "Build and run full rebuild of embedded banks cache" OFF)
-option(WITH_GENADLDATA_COMMENTS "Enable comments in generated ADLDATA cache file" OFF)
-option(USE_DOSBOX_EMULATOR "Use DosBox 0.74 OPL3 emulator (semi-accurate, suggested for slow or mobile platforms)" ON)
-option(USE_NUKED_EMULATOR "Use Nuked OPL3 emulator (most accurate, powerful)" ON)
+option(libADLMIDI_STATIC "Build static library of libADLMIDI" ON)
+option(libADLMIDI_SHARED "Build shared library of libADLMIDI" OFF)
+
option(WITH_CPP_EXTRAS "Build with support for C++ extras (features are can be found in 'adlmidi.hpp' header)" OFF)
option(WITH_MIDI_SEQUENCER "Build with embedded MIDI sequencer. Disable this if you want use library in real-time MIDI drivers or plugins.)" ON)
+option(WITH_EMBEDDED_BANKS "Use embedded banks" ON)
+option(WITH_HQ_RESAMPLER "Build with support for high quality resampling" OFF)
option(WITH_MUS_SUPPORT "Build with support for DMX MUS files)" ON)
option(WITH_XMI_SUPPORT "Build with support for AIL XMI files)" ON)
-option(WITH_HQ_RESAMPLER "Build with support for high quality resampling" OFF)
+option(USE_DOSBOX_EMULATOR "Use DosBox 0.74 OPL3 emulator (semi-accurate, suggested for slow or mobile platforms)" ON)
+option(USE_NUKED_EMULATOR "Use Nuked OPL3 emulator (most accurate, powerful)" ON)
-option(libADLMIDI_STATIC "Build static library of libADLMIDI" ON)
-option(libADLMIDI_SHARED "Build shared library of libADLMIDI" OFF)
+option(WITH_GENADLDATA "Build and run full rebuild of embedded banks cache" OFF)
+option(WITH_GENADLDATA_COMMENTS "Enable comments in generated ADLDATA cache file" OFF)
+option(WITH_MIDIPLAY "Build also demo MIDI player" OFF)
+option(MIDIPLAY_WAVE_ONLY "Build Demo MIDI player without support of real time playing. It will output into WAV only." OFF)
+option(WITH_ADLMIDI2 "Build also classic ADLMIDI player [EXPERIMENTAL]" OFF)
+option(WITH_VLC_PLUGIN "Build also a plugin for VLC Media Player" OFF)
+option(WITH_OLD_UTILS "Build also old utilities" OFF)
option(EXAMPLE_SDL2_AUDIO "Build also a simple SDL2 demo MIDI player" OFF)
+
if(CMAKE_VERSION VERSION_EQUAL "3.1" OR CMAKE_VERSION VERSION_GREATER "3.1")
set(CMAKE_CXX_STANDARD 11)
endif()
@@ -277,9 +279,9 @@ endif()
add_library(ADLMIDI INTERFACE)
if(libADLMIDI_SHARED)
- target_link_libraries(ADLMIDI INTERFACE ADLMIDI_shared)
+ target_link_libraries(ADLMIDI INTERFACE ADLMIDI_shared)
else()
- target_link_libraries(ADLMIDI INTERFACE ADLMIDI_static)
+ target_link_libraries(ADLMIDI INTERFACE ADLMIDI_static)
endif()
if(WITH_MIDIPLAY)
@@ -339,6 +341,8 @@ if(WITH_MIDIPLAY)
endif()
if(WITH_ADLMIDI2)
+ find_package(OpenMP)
+
if(NOT WIN32 AND NOT DJGPP AND NOT MSDOS)
find_library(SDL2_LIBRARY SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIR})
@@ -350,6 +354,7 @@ if(WITH_ADLMIDI2)
set(ADLMIDI2_VIDEO_OUT_SUPPORT "TRUE")
endif()
+
set(adlmidi2_src)
list(APPEND adlmidi2_src
${libADLMIDI_SOURCE_DIR}/utils/adlmidi-2/midiplay.cc
@@ -362,11 +367,11 @@ if(WITH_ADLMIDI2)
add_executable(adlmidi2 ${adlmidi2_src})
if(ADLMIDI2_HAS_PUZZLE_GAME)
- target_compile_options(adlmidi2 PUBLIC "-DSUPPORT_PUZZLE_GAME")
+ target_compile_definitions(adlmidi2 PUBLIC "-DSUPPORT_PUZZLE_GAME")
endif()
if(ADLMIDI2_VIDEO_OUT_SUPPORT)
- target_compile_options(adlmidi2 PUBLIC "-DSUPPORT_VIDEO_OUTPUT")
+ target_compile_definitions(adlmidi2 PUBLIC "-DSUPPORT_VIDEO_OUTPUT")
endif()
if(WIN32)
@@ -392,6 +397,10 @@ if(WITH_ADLMIDI2)
CXX_STANDARD 11
CXX_STANDARD_REQUIRED YES)
endif()
+ if(OPENMP_FOUND)
+ target_compile_options(adlmidi2 PUBLIC "-fopenmp")
+ target_link_libraries(adlmidi2 "-fopenmp")
+ endif()
else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message("Turned on C++11 on MSVC")
target_compile_options(adlmidi2 PUBLIC "/std:c++latest")
@@ -400,7 +409,7 @@ if(WITH_ADLMIDI2)
if(libADLMIDI_SHARED)
add_dependencies(adlmidi2 ADLMIDI_shared)
# ========= WIP =========
- # set_target_properties(adlmidiplay PROPERTIES COMPILE_FLAGS "-Wl,-rpath='$$ORIGIN/../lib'")
+ set_target_properties(adlmidi2 PROPERTIES COMPILE_FLAGS "-Wl,-rpath='$$ORIGIN/../lib'")
else()
if(NOT libADLMIDI_STATIC)
message(FATAL_ERROR "libADLMIDI is required to be built!")
@@ -482,14 +491,14 @@ if(WITH_VLC_PLUGIN)
endif()
if(WITH_HQ_RESAMPLER)
- find_library(ZITA_RESAMPLER_LIBRARY "zita-resampler" REQUIRED)
- add_definitions(-DADLMIDI_ENABLE_HQ_RESAMPLER)
- if(libADLMIDI_SHARED)
- target_link_libraries(ADLMIDI_shared PUBLIC "${ZITA_RESAMPLER_LIBRARY}")
- endif()
- if(libADLMIDI_STATIC)
- target_link_libraries(ADLMIDI_static PUBLIC "${ZITA_RESAMPLER_LIBRARY}")
- endif()
+ find_library(ZITA_RESAMPLER_LIBRARY "zita-resampler" REQUIRED)
+ add_definitions(-DADLMIDI_ENABLE_HQ_RESAMPLER)
+ if(libADLMIDI_SHARED)
+ target_link_libraries(ADLMIDI_shared PUBLIC "${ZITA_RESAMPLER_LIBRARY}")
+ endif()
+ if(libADLMIDI_STATIC)
+ target_link_libraries(ADLMIDI_static PUBLIC "${ZITA_RESAMPLER_LIBRARY}")
+ endif()
endif()
install(TARGETS ${libADLMIDI_INSTALLS}
@@ -510,22 +519,26 @@ if(WITH_UNIT_TESTS)
endif()
message("==== libADLMIDI options ====")
+message("libADLMIDI_STATIC = ${libADLMIDI_STATIC}")
+message("libADLMIDI_SHARED = ${libADLMIDI_SHARED}")
+message("WITH_UNIT_TESTS = ${WITH_UNIT_TESTS}")
+
+message("WITH_CPP_EXTRAS = ${WITH_CPP_EXTRAS}")
+message("WITH_MIDI_SEQUENCER = ${WITH_MIDI_SEQUENCER}")
+message("WITH_EMBEDDED_BANKS = ${WITH_EMBEDDED_BANKS}")
+message("WITH_HQ_RESAMPLER = ${WITH_HQ_RESAMPLER}")
+message("WITH_MUS_SUPPORT = ${WITH_MUS_SUPPORT}")
+message("WITH_XMI_SUPPORT = ${WITH_XMI_SUPPORT}")
+message("USE_DOSBOX_EMULATOR = ${USE_DOSBOX_EMULATOR}")
+message("USE_NUKED_EMULATOR = ${USE_NUKED_EMULATOR}")
+
+message("===== Utils and extras =====")
+message("WITH_GENADLDATA = ${WITH_GENADLDATA}")
+message("WITH_GENADLDATA_COMMENTS = ${WITH_GENADLDATA_COMMENTS}")
+
message("WITH_MIDIPLAY = ${WITH_MIDIPLAY}")
-message("WITH_VLC_PLUGIN = ${WITH_VLC_PLUGIN}")
message("MIDIPLAY_WAVE_ONLY = ${MIDIPLAY_WAVE_ONLY}")
message("WITH_ADLMIDI2 = ${WITH_ADLMIDI2}")
+message("WITH_VLC_PLUGIN = ${WITH_VLC_PLUGIN}")
message("WITH_OLD_UTILS = ${WITH_OLD_UTILS}")
-message("WITH_EMBEDDED_BANKS = ${WITH_EMBEDDED_BANKS}")
-message("WITH_GENADLDATA = ${WITH_GENADLDATA}")
-message("WITH_GENADLDATA_COMMENTS = ${WITH_GENADLDATA_COMMENTS}")
-message("USE_DOSBOX_EMULATOR = ${USE_DOSBOX_EMULATOR}")
-message("USE_NUKED_EMULATOR = ${USE_NUKED_EMULATOR}")
-message("WITH_MIDI_SEQUENCER = ${WITH_MIDI_SEQUENCER}")
-message("WITH_CPP_EXTRAS = ${WITH_CPP_EXTRAS}")
-message("WITH_MUS_SUPPORT = ${WITH_MUS_SUPPORT}")
-message("WITH_XMI_SUPPORT = ${WITH_XMI_SUPPORT}")
-message("WITH_HQ_RESAMPLER = ${WITH_HQ_RESAMPLER}")
-message("libADLMIDI_STATIC = ${libADLMIDI_STATIC}")
-message("libADLMIDI_SHARED = ${libADLMIDI_SHARED}")
message("EXAMPLE_SDL2_AUDIO = ${EXAMPLE_SDL2_AUDIO}")
-message("WITH_UNIT_TESTS = ${WITH_UNIT_TESTS}")
diff --git a/README.md b/README.md
index 74e66d0..37a0cd4 100644
--- a/README.md
+++ b/README.md
@@ -57,20 +57,35 @@ sudo make install
## Available CMake options
+
+### Library options
* **CMAKE_PREFIX_PATH** - destinition folder where libADLMIDI will be installed. On Linux it is /usr/local/ by default.
* **CMAKE_BUILD_TYPE** - Build types: **Debug** or **Release**
-* **WITH_MIDIPLAY** - (ON/OFF, default OFF) Build demo MIDI player (Requires SDL2 and also pthread on Windows with MinGW)
-* **WITH_VLC_PLUGIN** - (ON/OFF, default OFF) Compile VLC plugin. For now, works on Linux and VLC version 2.2.2. Support for newer VLC versions and other platforms comming soon!
-* **WITH_ADLMIDI2** - (ON/OFF, default OFF) Build Classic ADLMIDI MIDI player (Requires SDL2 on Linux and macOS, requires pthread on Windows with MinGW, SDL doesn't required on Windows. Also, the **WITH_CPP_EXTRAS** flag must be enabled)
+
+* **libADLMIDI_STATIC** - (ON/OFF, default ON) Build static library
+* **libADLMIDI_SHARED** - (ON/OFF, default OFF) Build shared library
+* **WITH_UNIT_TESTS** - (ON/OFF, default OFF) Enable unit testing
+
* **WITH_CPP_EXTRAS** - (ON/OFF, default OFF) Build libADLMIDI with some extra public features for C++ language (for example, instrument testing API is available for C++ only).
-* **WITH_OLD_UTILS** - (ON/OFF, default OFF) Build old utilities to dump some bank formats, made by original creator of ADLMIDI
+* **WITH_MIDI_SEQUENCER** - (ON/OFF, default ON) Build with embedded MIDI sequencer. Disable this if you want use library in real-time MIDI drivers or plugins.)
* **WITH_EMBEDDED_BANKS** - (ON/OFF, default ON) Enable or disable embedded banks (Original ADLMIDI and older versions of libADLMIDI are had embedded-only banks with no ability to load custom banks in runtime).
-* **WITH_GENADLDATA** - (ON/OFF, default OFF) Build and execute the utility which will rebuild the embedded banks database (which is an adldata.cpp file).
+* **WITH_HQ_RESAMPLER** - (ON/OFF, default OFF) Build with support for high quality resampling (requires zita-resampler to be installed)
+* **WITH_MUS_SUPPORT** - (ON/OFF, default ON) Build with support for DMX MUS files)
+* **WITH_XMI_SUPPORT** - (ON/OFF, default ON) Build with support for AIL XMI files)
* **USE_DOSBOX_EMULATOR** - (ON/OFF, default ON) Enable support for DosBox 0.74 emulator. (Well-accurate and fast)
* **USE_NUKED_EMULATOR** - (ON/OFF, default ON) Enable support for Nuked OPL3 emulator. (Very-accurate, needs more CPU power)
-* **libADLMIDI_STATIC** - (ON/OFF, default ON) Build static library
-* **libADLMIDI_SHARED** - (ON/OFF, default OFF) Build shared library
+
+### Utils and extras
+* **WITH_GENADLDATA** - (ON/OFF, default OFF) Build and execute the utility which will rebuild the embedded banks database (which is an adldata.cpp file).
+* **WITH_GENADLDATA_COMMENTS** - (ON/OFF, default OFF) Enable comments in generated ADLDATA cache file
+
+* **WITH_MIDIPLAY** - (ON/OFF, default OFF) Build demo MIDI player (Requires SDL2 and also pthread on Windows with MinGW)
+* **MIDIPLAY_WAVE_ONLY** - (ON/OFF, default OFF) Build Demo MIDI player without support of real time playing. It will output into WAV only.
+* **WITH_ADLMIDI2** - (ON/OFF, default OFF) Build Classic ADLMIDI MIDI player (Requires SDL2 on Linux and macOS, requires pthread on Windows with MinGW, SDL doesn't required on Windows. Also, the **WITH_CPP_EXTRAS** flag must be enabled)
+* **WITH_VLC_PLUGIN** - (ON/OFF, default OFF) Compile VLC plugin. For now, works on Linux and VLC. Support for other platforms comming soon!
+* **WITH_OLD_UTILS** - (ON/OFF, default OFF) Build old utilities to dump some bank formats, made by original creator of ADLMIDI
+* **EXAMPLE_SDL2_AUDIO** - (ON/OFF, default OFF) Build also a simple SDL2 demo MIDI player
## You also can build library manually:
@@ -143,8 +158,9 @@ To build that example you will need to have installed SDL2 library.
* Fixed an incorrect processing of auto-flags
* Fixed incorrect initial MIDI tempo when MIDI file doesn't includes the tempo event
* Channel and Note Aftertouch features are now supported correctly! Aftertouch is the tremolo / vibrato, NOT A VOLUME!
- * Updated DosBox OPL3 emulator up to r4111 of official DosBox trunk
- * The automatical choosing of 4 operator channels count has been improved
+ * Updated DosBox OPL3 emulator up to r4111 of official DosBox trunk (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
+ * The automatical choosing of 4 operator channels count has been improved (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
+ * Added optional HQ resampler for Nuked OPL3 emulators which does usage of Zita-Resampler library (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!)
## 1.3.2 2018-04-24
* Added ability to disable MUS and XMI converters
diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp
index f9891a8..e90680a 100644
--- a/src/adlmidi.cpp
+++ b/src/adlmidi.cpp
@@ -313,7 +313,9 @@ ADLMIDI_EXPORT void adl_setPercMode(ADL_MIDIPlayer *device, int percmod)
if(!device) return;
MIDIplay *play = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer);
play->m_setup.AdlPercussionMode = percmod;
- play->opl.AdlPercussionMode = play->m_setup.AdlPercussionMode;
+ play->opl.AdlPercussionMode = play->m_setup.AdlPercussionMode < 0 ?
+ play->opl.dynamic_bank_setup.adLibPercussions :
+ (play->m_setup.AdlPercussionMode != 0);
play->opl.updateFlags();
}
@@ -322,7 +324,9 @@ ADLMIDI_EXPORT void adl_setHVibrato(ADL_MIDIPlayer *device, int hvibro)
if(!device) return;
MIDIplay *play = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer);
play->m_setup.HighVibratoMode = hvibro;
- play->opl.HighVibratoMode = play->m_setup.HighVibratoMode;
+ play->opl.HighVibratoMode = play->m_setup.HighVibratoMode < 0 ?
+ play->opl.dynamic_bank_setup.deepVibrato :
+ (play->m_setup.HighVibratoMode != 0);
play->opl.updateDeepFlags();
}
@@ -331,7 +335,9 @@ ADLMIDI_EXPORT void adl_setHTremolo(ADL_MIDIPlayer *device, int htremo)
if(!device) return;
MIDIplay *play = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer);
play->m_setup.HighTremoloMode = htremo;
- play->opl.HighTremoloMode = play->m_setup.HighTremoloMode;
+ play->opl.HighTremoloMode = play->m_setup.HighTremoloMode < 0 ?
+ play->opl.dynamic_bank_setup.deepTremolo :
+ (play->m_setup.HighTremoloMode != 0);
play->opl.updateDeepFlags();
}
@@ -340,14 +346,16 @@ ADLMIDI_EXPORT void adl_setScaleModulators(ADL_MIDIPlayer *device, int smod)
if(!device) return;
MIDIplay *play = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer);
play->m_setup.ScaleModulators = smod;
- play->opl.ScaleModulators = play->m_setup.ScaleModulators;
+ play->opl.ScaleModulators = play->m_setup.ScaleModulators < 0 ?
+ play->opl.dynamic_bank_setup.scaleModulators :
+ (play->m_setup.ScaleModulators != 0);
}
ADLMIDI_EXPORT void adl_setFullRangeBrightness(struct ADL_MIDIPlayer *device, int fr_brightness)
{
if(!device) return;
MIDIplay *play = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer);
- play->m_setup.fullRangeBrightnessCC74 = fr_brightness;
+ play->m_setup.fullRangeBrightnessCC74 = (fr_brightness != 0);
}
ADLMIDI_EXPORT void adl_setLoopEnabled(ADL_MIDIPlayer *device, int loopEn)
@@ -362,7 +370,7 @@ ADLMIDI_EXPORT void adl_setLogarithmicVolumes(struct ADL_MIDIPlayer *device, int
{
if(!device) return;
MIDIplay *play = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer);
- play->m_setup.LogarithmicVolumes = logvol;
+ play->m_setup.LogarithmicVolumes = (logvol != 0);
if(play->m_setup.LogarithmicVolumes)
play->opl.ChangeVolumeRangesModel(ADLMIDI_VolumeModel_NativeOPL3);
}
@@ -372,7 +380,10 @@ ADLMIDI_EXPORT void adl_setVolumeRangeModel(struct ADL_MIDIPlayer *device, int v
if(!device) return;
MIDIplay *play = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer);
play->m_setup.VolumeModel = volumeModel;
- play->opl.ChangeVolumeRangesModel(static_cast<ADLMIDI_VolumeModels>(volumeModel));
+ if(play->m_setup.VolumeModel == ADLMIDI_VolumeModel_AUTO)//Use bank default volume model
+ play->opl.m_volumeScale = (OPL3::VolumesScale)play->opl.dynamic_bank_setup.volumeModel;
+ else
+ play->opl.ChangeVolumeRangesModel(static_cast<ADLMIDI_VolumeModels>(volumeModel));
}
ADLMIDI_EXPORT int adl_openBankFile(struct ADL_MIDIPlayer *device, const char *filePath)
diff --git a/src/adlmidi_load.cpp b/src/adlmidi_load.cpp
index c75bed4..9e19ab6 100644
--- a/src/adlmidi_load.cpp
+++ b/src/adlmidi_load.cpp
@@ -93,7 +93,7 @@ static void cvt_generic_to_FMIns(adlinsdata2 &ins, const WOPLI &in)
ins.flags|= (in.inst_flags & WOPL_Ins_IsBlank) ? adlinsdata::Flag_NoSound : 0;
bool fourOps = (in.inst_flags & WOPL_Ins_4op) || (in.inst_flags & WOPL_Ins_Pseudo4op);
- for(size_t op = 0, slt = 0; op < (fourOps ? 4 : 2); op++, slt++)
+ for(size_t op = 0, slt = 0; op < static_cast<size_t>(fourOps ? 4 : 2); op++, slt++)
{
ins.adl[slt].carrier_E862 =
((static_cast<uint32_t>(in.operators[op].waveform_E0) << 24) & 0xFF000000) //WaveForm
@@ -111,13 +111,13 @@ static void cvt_generic_to_FMIns(adlinsdata2 &ins, const WOPLI &in)
ins.adl[slt].modulator_40 = in.operators[op].ksl_l_40;//KSLL
}
- ins.adl[0].finetune = in.note_offset1;
+ ins.adl[0].finetune = static_cast<int8_t>(in.note_offset1);
ins.adl[0].feedconn = in.fb_conn1_C0;
if(!fourOps)
ins.adl[1] = ins.adl[0];
else
{
- ins.adl[1].finetune = in.note_offset2;
+ ins.adl[1].finetune = static_cast<int8_t>(in.note_offset2);
ins.adl[1].feedconn = in.fb_conn2_C0;
}
@@ -151,7 +151,7 @@ static void cvt_FMIns_to_generic(WOPLI &ins, const adlinsdata2 &in)
ins.inst_flags|= (in.flags & adlinsdata::Flag_Pseudo4op) ? WOPL_Ins_Pseudo4op : 0;
ins.inst_flags|= (in.flags & adlinsdata::Flag_NoSound) ? WOPL_Ins_IsBlank : 0;
- for(size_t op = 0, slt = 0; op < (fourOps ? 4 : 2); op++, slt++)
+ for(size_t op = 0, slt = 0; op < static_cast<size_t>(fourOps ? 4 : 2); op++, slt++)
{
ins.operators[op].waveform_E0 = static_cast<uint8_t>(in.adl[slt].carrier_E862 >> 24);
ins.operators[op].susrel_80 = static_cast<uint8_t>(in.adl[slt].carrier_E862 >> 16);
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp
index 07bcc6a..3c94d76 100644
--- a/src/adlmidi_midiplay.cpp
+++ b/src/adlmidi_midiplay.cpp
@@ -680,7 +680,8 @@ bool MIDIplay::buildTrackData()
MIDIplay::MIDIplay(unsigned long sampleRate):
- cmf_percussion_mode(false)
+ cmf_percussion_mode(false),
+ m_arpeggioCounter(0)
#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
, fullSongTimeLength(0.0),
postSongWaitDelay(1.0),
@@ -731,16 +732,16 @@ void MIDIplay::applySetup()
opl.HighTremoloMode = m_setup.HighTremoloMode < 0 ?
opl.dynamic_bank_setup.deepTremolo :
- (bool)m_setup.HighTremoloMode;
+ (m_setup.HighTremoloMode != 0);
opl.HighVibratoMode = m_setup.HighVibratoMode < 0 ?
opl.dynamic_bank_setup.deepVibrato :
- (bool)m_setup.HighVibratoMode;
+ (m_setup.HighVibratoMode != 0);
opl.AdlPercussionMode = m_setup.AdlPercussionMode < 0 ?
opl.dynamic_bank_setup.adLibPercussions :
- (bool)m_setup.AdlPercussionMode;
+ (m_setup.AdlPercussionMode != 0);
opl.ScaleModulators = m_setup.ScaleModulators < 0 ?
opl.dynamic_bank_setup.scaleModulators :
- (bool)m_setup.ScaleModulators;
+ (m_setup.ScaleModulators != 0);
if(m_setup.LogarithmicVolumes)
opl.ChangeVolumeRangesModel(ADLMIDI_VolumeModel_NativeOPL3);
opl.m_musicMode = OPL3::MODE_MIDI;
@@ -755,6 +756,9 @@ void MIDIplay::applySetup()
opl.Reset(m_setup.emulator, m_setup.PCM_RATE);
ch.clear();
ch.resize(opl.NumChannels);
+
+ // Reset the arpeggio counter
+ m_arpeggioCounter = 0;
}
#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
@@ -1441,7 +1445,7 @@ void MIDIplay::NoteUpdate(uint16_t MidCh,
MIDIchannel::NoteInfo &info = *i;
const int16_t tone = info.tone;
const uint8_t vol = info.vol;
- const int midiins = info.midiins;
+ const int midiins = static_cast<int>(info.midiins);
const adlinsdata2 &ains = *info.ains;
AdlChannel::Location my_loc;
my_loc.MidCh = MidCh;
@@ -2151,7 +2155,7 @@ void MIDIplay::HandleEvent(size_t tk, const MIDIplay::MidiEvent &evt, int &statu
}
#endif /* ADLMIDI_DISABLE_MIDI_SEQUENCER */
-int64_t MIDIplay::CalculateAdlChannelGoodness(unsigned c, const MIDIchannel::NoteInfo::Phys &ins, uint16_t) const
+int64_t MIDIplay::CalculateAdlChannelGoodness(size_t c, const MIDIchannel::NoteInfo::Phys &ins, uint16_t) const
{
int64_t s = -ch[c].koff_time_until_neglible;
@@ -2198,7 +2202,7 @@ int64_t MIDIplay::CalculateAdlChannelGoodness(unsigned c, const MIDIchannel::Not
// increase the score slightly.
unsigned n_evacuation_stations = 0;
- for(unsigned c2 = 0; c2 < opl.NumChannels; ++c2)
+ for(size_t c2 = 0; c2 < static_cast<size_t>(opl.NumChannels); ++c2)
{
if(c2 == c) continue;
@@ -2299,11 +2303,11 @@ void MIDIplay::KillOrEvacuate(size_t from_channel,
hooks.onNote(hooks.onNote_userData,
(int)from_channel,
i->tone,
- i->midiins, 0, 0.0);
+ static_cast<int>(i->midiins), 0, 0.0);
hooks.onNote(hooks.onNote_userData,
(int)c,
i->tone,
- i->midiins,
+ static_cast<int>(i->midiins),
i->vol, 0.0);
}
@@ -2490,8 +2494,8 @@ void MIDIplay::UpdateArpeggio(double) // amount = amount of time passed
arpeggio_cache = 0.0;
# endif
#endif
- static unsigned arpeggio_counter = 0;
- ++arpeggio_counter;
+
+ ++m_arpeggioCounter;
for(uint32_t c = 0; c < opl.NumChannels; ++c)
{
@@ -2512,7 +2516,7 @@ retry_arpeggio:
if(n_users >= 4)
rate_reduction = 1;
- for(unsigned count = (arpeggio_counter / rate_reduction) % n_users,
+ for(size_t count = (m_arpeggioCounter / rate_reduction) % n_users,
n = 0; n < count; ++n)
i = i->next;
diff --git a/src/adlmidi_mus2mid.c b/src/adlmidi_mus2mid.c
index 8268198..3f3e1b8 100644
--- a/src/adlmidi_mus2mid.c
+++ b/src/adlmidi_mus2mid.c
@@ -416,7 +416,7 @@ int AdlMidi_mus2midi(uint8_t *in, uint32_t insize,
memcpy(ctx.dst_ptr, temp_buffer, out_local - temp_buffer);
ctx.dst_ptr += out_local - temp_buffer;
- ctx.dstrem -= out_local - temp_buffer;
+ ctx.dstrem -= (uint32_t)(out_local - temp_buffer);
}
if (event & 128) {
diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp
index 63b4854..0584587 100644
--- a/src/adlmidi_private.hpp
+++ b/src/adlmidi_private.hpp
@@ -131,13 +131,6 @@ typedef int32_t ssize_t;
#define INT32_MAX 0x7fffffff
#endif
-#ifdef _MSC_VER
-#pragma warning(disable:4319)
-#pragma warning(disable:4267)
-#pragma warning(disable:4244)
-#pragma warning(disable:4146)
-#endif
-
#include "fraction.hpp"
#ifndef ADLMIDI_HW_OPL
#include "chips/opl_chip_base.h"
@@ -167,12 +160,14 @@ inline Real adl_cvtReal(int32_t x)
{
return x * ((Real)1 / INT16_MAX);
}
+
inline int32_t adl_cvtS16(int32_t x)
{
- x = (x < INT16_MIN) ? INT16_MIN : x;
- x = (x > INT16_MAX) ? INT16_MAX : x;
+ x = (x < INT16_MIN) ? (INT16_MIN) : x;
+ x = (x > INT16_MAX) ? (INT16_MAX) : x;
return x;
}
+
inline int32_t adl_cvtS8(int32_t x)
{
return adl_cvtS16(x) / 256;
@@ -485,7 +480,7 @@ public:
bool eof()
{
if(fp)
- return std::feof(fp);
+ return (std::feof(fp) != 0);
else
return mp_tell >= mp_size;
}
@@ -592,9 +587,9 @@ public:
}
void phys_erase_at(const Phys *ph)
{
- unsigned pos = ph - chip_channels;
- assert(pos < chip_channels_count);
- for(unsigned i = pos + 1; i < chip_channels_count; ++i)
+ intptr_t pos = ph - chip_channels;
+ assert(pos < static_cast<intptr_t>(chip_channels_count));
+ for(intptr_t i = pos + 1; i < static_cast<intptr_t>(chip_channels_count); ++i)
chip_channels[i - 1] = chip_channels[i];
--chip_channels_count;
}
@@ -976,6 +971,8 @@ private:
char ____padding[7];
std::vector<AdlChannel> ch;
+ //! Counter of arpeggio processing
+ size_t m_arpeggioCounter;
#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
std::vector<std::vector<uint8_t> > TrackData;
@@ -1199,7 +1196,7 @@ private:
// Determine how good a candidate this adlchannel
// would be for playing a note from this instrument.
- int64_t CalculateAdlChannelGoodness(unsigned c, const MIDIchannel::NoteInfo::Phys &ins, uint16_t /*MidCh*/) const;
+ int64_t CalculateAdlChannelGoodness(size_t c, const MIDIchannel::NoteInfo::Phys &ins, uint16_t /*MidCh*/) const;
// A new note will be played on this channel using this instrument.
// Kill existing notes on this channel (or don't, if we do arpeggio)
diff --git a/src/chips/dosbox/dbopl.cpp b/src/chips/dosbox/dbopl.cpp
index 098eb13..7d78c5f 100644
--- a/src/chips/dosbox/dbopl.cpp
+++ b/src/chips/dosbox/dbopl.cpp
@@ -819,7 +819,7 @@ INLINE void Channel::GeneratePercussion( Chip* chip, Bit32s* output ) {
//BassDrum
Bit32s mod = (Bit32u)((old[0] + old[1])) >> feedback;
old[0] = old[1];
- old[1] = Op(0)->GetSample( mod );
+ old[1] = static_cast<Bit32u>(Op(0)->GetSample( mod ));
//When bassdrum is in AM mode first operator is ignoed
if ( chan->regC0 & 1 ) {
@@ -827,35 +827,35 @@ INLINE void Channel::GeneratePercussion( Chip* chip, Bit32s* output ) {
} else {
mod = old[0];
}
- Bit32s sample = Op(1)->GetSample( mod );
+ Bit32s sample = static_cast<Bit32u>(Op(1)->GetSample( mod ));
//Precalculate stuff used by other outputs
Bit32u noiseBit = chip->ForwardNoise() & 0x1;
- Bit32u c2 = Op(2)->ForwardWave();
- Bit32u c5 = Op(5)->ForwardWave();
+ Bit32u c2 = static_cast<Bit32u>(Op(2)->ForwardWave());
+ Bit32u c5 = static_cast<Bit32u>(Op(5)->ForwardWave());
Bit32u phaseBit = (((c2 & 0x88) ^ ((c2<<5) & 0x80)) | ((c5 ^ (c5<<2)) & 0x20)) ? 0x02 : 0x00;
//Hi-Hat
- Bit32u hhVol = Op(2)->ForwardVolume();
+ Bit32u hhVol = static_cast<Bit32u>(Op(2)->ForwardVolume());
if ( !ENV_SILENT( hhVol ) ) {
Bit32u hhIndex = (phaseBit<<8) | (0x34 << ( phaseBit ^ (noiseBit << 1 )));
- sample += Op(2)->GetWave( hhIndex, hhVol );
+ sample += static_cast<Bit32u>(Op(2)->GetWave( hhIndex, hhVol ));
}
//Snare Drum
- Bit32u sdVol = Op(3)->ForwardVolume();
+ Bit32u sdVol = static_cast<Bit32u>(Op(3)->ForwardVolume());
if ( !ENV_SILENT( sdVol ) ) {
Bit32u sdIndex = ( 0x100 + (c2 & 0x100) ) ^ ( noiseBit << 8 );
- sample += Op(3)->GetWave( sdIndex, sdVol );
+ sample += static_cast<Bit32u>(Op(3)->GetWave( sdIndex, sdVol ));
}
//Tom-tom
- sample += Op(4)->GetSample( 0 );
+ sample += static_cast<Bit32u>(Op(4)->GetSample( 0 ));
//Top-Cymbal
- Bit32u tcVol = Op(5)->ForwardVolume();
+ Bit32u tcVol = static_cast<Bit32u>(Op(5)->ForwardVolume());
if ( !ENV_SILENT( tcVol ) ) {
Bit32u tcIndex = (1 + phaseBit) << 8;
- sample += Op(5)->GetWave( tcIndex, tcVol );
+ sample += static_cast<Bit32u>(Op(5)->GetWave( tcIndex, tcVol ));
}
sample <<= 1;
if ( opl3Mode ) {
@@ -934,31 +934,31 @@ Channel* Channel::BlockTemplate( Chip* chip, Bit32u samples, Bit32s* output ) {
//Do unsigned shift so we can shift out all bits but still stay in 10 bit range otherwise
Bit32s mod = (Bit32u)((old[0] + old[1])) >> feedback;
old[0] = old[1];
- old[1] = Op(0)->GetSample( mod );
+ old[1] = static_cast<Bit32u>(Op(0)->GetSample( mod ));
Bit32s sample;
Bit32s out0 = old[0];
if ( mode == sm2AM || mode == sm3AM ) {
- sample = out0 + Op(1)->GetSample( 0 );
+ sample = static_cast<Bit32u>(out0 + Op(1)->GetSample( 0 ));
} else if ( mode == sm2FM || mode == sm3FM ) {
- sample = Op(1)->GetSample( out0 );
+ sample = static_cast<Bit32u>(Op(1)->GetSample( out0 ));
} else if ( mode == sm3FMFM ) {
Bits next = Op(1)->GetSample( out0 );
next = Op(2)->GetSample( next );
- sample = Op(3)->GetSample( next );
+ sample = static_cast<Bit32u>(Op(3)->GetSample( next ));
} else if ( mode == sm3AMFM ) {
sample = out0;
Bits next = Op(1)->GetSample( 0 );
next = Op(2)->GetSample( next );
- sample += Op(3)->GetSample( next );
+ sample += static_cast<Bit32u>(Op(3)->GetSample( next ));
} else if ( mode == sm3FMAM ) {
- sample = Op(1)->GetSample( out0 );
+ sample = static_cast<Bit32u>(Op(1)->GetSample( out0 ));
Bits next = Op(2)->GetSample( 0 );
- sample += Op(3)->GetSample( next );
+ sample += static_cast<Bit32u>(Op(3)->GetSample( next ));
} else if ( mode == sm3AMAM ) {
sample = out0;
Bits next = Op(1)->GetSample( 0 );
- sample += Op(2)->GetSample( next );
- sample += Op(3)->GetSample( 0 );
+ sample += static_cast<Bit32u>(Op(2)->GetSample( next ));
+ sample += static_cast<Bit32u>(Op(3)->GetSample( 0 ));
}
switch( mode ) {
case sm2AM:
@@ -1213,7 +1213,7 @@ Bit32u Chip::WriteAddr( Bit32u port, Bit8u val ) {
void Chip::GenerateBlock2( Bitu total, Bit32s* output ) {
while ( total > 0 ) {
- Bit32u samples = ForwardLFO( total );
+ Bit32u samples = ForwardLFO( static_cast<Bit32u>(total) );
memset(output, 0, sizeof(Bit32s) * samples);
// int count = 0;
for( Channel* ch = chan; ch < chan + 9; ) {
@@ -1227,7 +1227,7 @@ void Chip::GenerateBlock2( Bitu total, Bit32s* output ) {
void Chip::GenerateBlock2_Mix( Bitu total, Bit32s* output ) {
while ( total > 0 ) {
- Bit32u samples = ForwardLFO( total );
+ Bit32u samples = ForwardLFO( static_cast<Bit32u>(total) );
// int count = 0;
for( Channel* ch = chan; ch < chan + 9; ) {
// count++;
@@ -1240,7 +1240,7 @@ void Chip::GenerateBlock2_Mix( Bitu total, Bit32s* output ) {
void Chip::GenerateBlock3( Bitu total, Bit32s* output ) {
while ( total > 0 ) {
- Bit32u samples = ForwardLFO( total );
+ Bit32u samples = ForwardLFO( static_cast<Bit32u>(total) );
memset(output, 0, sizeof(Bit32s) * samples *2);
// int count = 0;
for( Channel* ch = chan; ch < chan + 18; ) {
@@ -1254,7 +1254,7 @@ void Chip::GenerateBlock3( Bitu total, Bit32s* output ) {
void Chip::GenerateBlock3_Mix( Bitu total, Bit32s* output ) {
while ( total > 0 ) {
- Bit32u samples = ForwardLFO( total );
+ Bit32u samples = ForwardLFO( static_cast<Bit32u>(total) );
// int count = 0;
for( Channel* ch = chan; ch < chan + 18; ) {
// count++;
@@ -1500,7 +1500,7 @@ void InitTables( void ) {
if ( i >= 16 )
index += 9;
Bitu blah = reinterpret_cast<Bitu>( &(chip->chan[ index ]) );
- ChanOffsetTable[i] = blah;
+ ChanOffsetTable[i] = static_cast<Bit16u>(blah);
}
//Same for operators
for ( Bitu i = 0; i < 64; i++ ) {
@@ -1515,7 +1515,7 @@ void InitTables( void ) {
Bitu opNum = ( i % 8 ) / 3;
DBOPL::Channel* chan = 0;
Bitu blah = reinterpret_cast<Bitu>( &(chan->op[opNum]) );
- OpOffsetTable[i] = ChanOffsetTable[ chNum ] + blah;
+ OpOffsetTable[i] = static_cast<Bit16u>(ChanOffsetTable[ chNum ] + blah);
}
#if 0
//Stupid checks if table's are correct
@@ -1611,7 +1611,7 @@ void Handler::GenerateArrMix(Bit16s *out, Bitu *samples)
void Handler::Init( Bitu rate ) {
InitTables();
- chip.Setup( rate );
+ chip.Setup( static_cast<Bit32u>(rate) );
}
diff --git a/src/chips/nuked/nukedopl3_174.c b/src/chips/nuked/nukedopl3_174.c
index 401089c..99eab16 100644
--- a/src/chips/nuked/nukedopl3_174.c
+++ b/src/chips/nuked/nukedopl3_174.c
@@ -638,18 +638,18 @@ static void OPL3_ChannelUpdateRhythm(opl3_chip *chip, Bit8u data)
channel6 = &chip->channel[6];
channel7 = &chip->channel[7];
channel8 = &chip->channel[8];
- channel6->out[0] = &channel6->slots[1]->out;
- channel6->out[1] = &channel6->slots[1]->out;
+ channel6->out[0] = &channel6->slotz[1]->out;
+ channel6->out[1] = &channel6->slotz[1]->out;
channel6->out[2] = &chip->zeromod;
channel6->out[3] = &chip->zeromod;
- channel7->out[0] = &channel7->slots[0]->out;
- channel7->out[1] = &channel7->slots[0]->out;
- channel7->out[2] = &channel7->slots[1]->out;
- channel7->out[3] = &channel7->slots[1]->out;
- channel8->out[0] = &channel8->slots[0]->out;
- channel8->out[1] = &channel8->slots[0]->out;
- channel8->out[2] = &channel8->slots[1]->out;
- channel8->out[3] = &channel8->slots[1]->out;
+ channel7->out[0] = &channel7->slotz[0]->out;
+ channel7->out[1] = &channel7->slotz[0]->out;
+ channel7->out[2] = &channel7->slotz[1]->out;
+ channel7->out[3] = &channel7->slotz[1]->out;
+ channel8->out[0] = &channel8->slotz[0]->out;
+ channel8->out[1] = &channel8->slotz[0]->out;
+ channel8->out[2] = &channel8->slotz[1]->out;
+ channel8->out[3] = &channel8->slotz[1]->out;
for (chnum = 6; chnum < 9; chnum++)
{
chip->channel[chnum].chtype = ch_drum;
@@ -658,49 +658,49 @@ static void OPL3_ChannelUpdateRhythm(opl3_chip *chip, Bit8u data)
/*hh*/
if (chip->rhy & 0x01)
{
- OPL3_EnvelopeKeyOn(channel7->slots[0], egk_drum);
+ OPL3_EnvelopeKeyOn(channel7->slotz[0], egk_drum);
}
else
{
- OPL3_EnvelopeKeyOff(channel7->slots[0], egk_drum);
+ OPL3_EnvelopeKeyOff(channel7->slotz[0], egk_drum);
}
/*tc*/
if (chip->rhy & 0x02)
{
- OPL3_EnvelopeKeyOn(channel8->slots[1], egk_drum);
+ OPL3_EnvelopeKeyOn(channel8->slotz[1], egk_drum);
}
else
{
- OPL3_EnvelopeKeyOff(channel8->slots[1], egk_drum);
+ OPL3_EnvelopeKeyOff(channel8->slotz[1], egk_drum);
}
/*tom*/
if (chip->rhy & 0x04)
{
- OPL3_EnvelopeKeyOn(channel8->slots[0], egk_drum);
+ OPL3_EnvelopeKeyOn(channel8->slotz[0], egk_drum);
}
else
{
- OPL3_EnvelopeKeyOff(channel8->slots[0], egk_drum);
+ OPL3_EnvelopeKeyOff(channel8->slotz[0], egk_drum);
}
/*sd*/
if (chip->rhy & 0x08)
{
- OPL3_EnvelopeKeyOn(channel7->slots[1], egk_drum);
+ OPL3_EnvelopeKeyOn(channel7->slotz[1], egk_drum);
}
else
{
- OPL3_EnvelopeKeyOff(channel7->slots[1], egk_drum);
+ OPL3_EnvelopeKeyOff(channel7->slotz[1], egk_drum);
}
/*bd*/
if (chip->rhy & 0x10)
{
- OPL3_EnvelopeKeyOn(channel6->slots[0], egk_drum);
- OPL3_EnvelopeKeyOn(channel6->slots[1], egk_drum);
+ OPL3_EnvelopeKeyOn(channel6->slotz[0], egk_drum);
+ OPL3_EnvelopeKeyOn(channel6->slotz[1], egk_drum);
}
else
{
- OPL3_EnvelopeKeyOff(channel6->slots[0], egk_drum);
- OPL3_EnvelopeKeyOff(channel6->slots[1], egk_drum);
+ OPL3_EnvelopeKeyOff(channel6->slotz[0], egk_drum);
+ OPL3_EnvelopeKeyOff(channel6->slotz[1], egk_drum);
}
}
else
@@ -709,8 +709,8 @@ static void OPL3_ChannelUpdateRhythm(opl3_chip *chip, Bit8u data)
{
chip->channel[chnum].chtype = ch_2op;
OPL3_ChannelSetupAlg(&chip->channel[chnum]);
- OPL3_EnvelopeKeyOff(chip->channel[chnum].slots[0], egk_drum);
- OPL3_EnvelopeKeyOff(chip->channel[chnum].slots[1], egk_drum);
+ OPL3_EnvelopeKeyOff(chip->channel[chnum].slotz[0], egk_drum);
+ OPL3_EnvelopeKeyOff(chip->channel[chnum].slotz[1], egk_drum);
}
}
}
@@ -724,18 +724,18 @@ static void OPL3_ChannelWriteA0(opl3_channel *channel, Bit8u data)
channel->f_num = (channel->f_num & 0x300) | data;
channel->ksv = (channel->block << 1)
| ((channel->f_num >> (0x09 - channel->chip->nts)) & 0x01);
- OPL3_EnvelopeUpdateKSL(channel->slots[0]);
- OPL3_EnvelopeUpdateKSL(channel->slots[1]);
- OPL3_EnvelopeUpdateRate(channel->slots[0]);
- OPL3_EnvelopeUpdateRate(channel->slots[1]);
+ OPL3_EnvelopeUpdateKSL(channel->slotz[0]);
+ OPL3_EnvelopeUpdateKSL(channel->slotz[1]);
+ OPL3_EnvelopeUpdateRate(channel->slotz[0]);
+ OPL3_EnvelopeUpdateRate(channel->slotz[1]);
if (channel->chip->newm && channel->chtype == ch_4op)
{
channel->pair->f_num = channel->f_num;
channel->pair->ksv = channel->ksv;
- OPL3_EnvelopeUpdateKSL(channel->pair->slots[0]);
- OPL3_EnvelopeUpdateKSL(channel->pair->slots[1]);
- OPL3_EnvelopeUpdateRate(channel->pair->slots[0]);
- OPL3_EnvelopeUpdateRate(channel->pair->slots[1]);
+ OPL3_EnvelopeUpdateKSL(channel->pair->slotz[0]);
+ OPL3_EnvelopeUpdateKSL(channel->pair->slotz[1]);
+ OPL3_EnvelopeUpdateRate(channel->pair->slotz[0]);
+ OPL3_EnvelopeUpdateRate(channel->pair->slotz[1]);
}
}
@@ -749,19 +749,19 @@ static void OPL3_ChannelWriteB0(opl3_channel *channel, Bit8u data)
channel->block = (data >> 2) & 0x07;
channel->ksv = (channel->block << 1)
| ((channel->f_num >> (0x09 - channel->chip->nts)) & 0x01);
- OPL3_EnvelopeUpdateKSL(channel->slots[0]);
- OPL3_EnvelopeUpdateKSL(channel->slots[1]);
- OPL3_EnvelopeUpdateRate(channel->slots[0]);
- OPL3_EnvelopeUpdateRate(channel->slots[1]);
+ OPL3_EnvelopeUpdateKSL(channel->slotz[0]);
+ OPL3_EnvelopeUpdateKSL(channel->slotz[1]);
+ OPL3_EnvelopeUpdateRate(channel->slotz[0]);
+ OPL3_EnvelopeUpdateRate(channel->slotz[1]);
if (channel->chip->newm && channel->chtype == ch_4op)
{
channel->pair->f_num = channel->f_num;
channel->pair->block = channel->block;
channel->pair->ksv = channel->ksv;
- OPL3_EnvelopeUpdateKSL(channel->pair->slots[0]);
- OPL3_EnvelopeUpdateKSL(channel->pair->slots[1]);
- OPL3_EnvelopeUpdateRate(channel->pair->slots[0]);
- OPL3_EnvelopeUpdateRate(channel->pair->slots[1]);
+ OPL3_EnvelopeUpdateKSL(channel->pair->slotz[0]);
+ OPL3_EnvelopeUpdateKSL(channel->pair->slotz[1]);
+ OPL3_EnvelopeUpdateRate(channel->pair->slotz[0]);
+ OPL3_EnvelopeUpdateRate(channel->pair->slotz[1]);
}
}
@@ -772,12 +772,12 @@ static void OPL3_ChannelSetupAlg(opl3_channel *channel)
switch (channel->alg & 0x01)
{
case 0x00:
- channel->slots[0]->mod = &channel->slots[0]->fbmod;
- channel->slots[1]->mod = &channel->slots[0]->out;
+ channel->slotz[0]->mod = &channel->slotz[0]->fbmod;
+ channel->slotz[1]->mod = &channel->slotz[0]->out;
break;
case 0x01:
- channel->slots[0]->mod = &channel->slots[0]->fbmod;
- channel->slots[1]->mod = &channel->chip->zeromod;
+ channel->slotz[0]->mod = &channel->slotz[0]->fbmod;
+ channel->slotz[1]->mod = &channel->chip->zeromod;
break;
}
return;
@@ -795,43 +795,43 @@ static void OPL3_ChannelSetupAlg(opl3_channel *channel)
switch (channel->alg & 0x03)
{
case 0x00:
- channel->pair->slots[0]->mod = &channel->pair->slots[0]->fbmod;
- channel->pair->slots[1]->mod = &channel->pair->slots[0]->out;
- channel->slots[0]->mod = &channel->pair->slots[1]->out;
- channel->slots[1]->mod = &channel->slots[0]->out;
- channel->out[0] = &channel->slots[1]->out;
+ channel->pair->slotz[0]->mod = &channel->pair->slotz[0]->fbmod;
+ channel->pair->slotz[1]->mod = &channel->pair->slotz[0]->out;
+ channel->slotz[0]->mod = &channel->pair->slotz[1]->out;
+ channel->slotz[1]->mod = &channel->slotz[0]->out;
+ channel->out[0] = &channel->slotz[1]->out;
channel->out[1] = &channel->chip->zeromod;
channel->out[2] = &channel->chip->zeromod;
channel->out[3] = &channel->chip->zeromod;
break;
case 0x01:
- channel->pair->slots[0]->mod = &channel->pair->slots[0]->fbmod;
- channel->pair->slots[1]->mod = &channel->pair->slots[0]->out;
- channel->slots[0]->mod = &channel->chip->zeromod;
- channel->slots[1]->mod = &channel->slots[0]->out;
- channel->out[0] = &channel->pair->slots[1]->out;
- channel->out[1] = &channel->slots[1]->out;
+ channel->pair->slotz[0]->mod = &channel->pair->slotz[0]->fbmod;
+ channel->pair->slotz[1]->mod = &channel->pair->slotz[0]->out;
+ channel->slotz[0]->mod = &channel->chip->zeromod;
+ channel->slotz[1]->mod = &channel->slotz[0]->out;
+ channel->out[0] = &channel->pair->slotz[1]->out;
+ channel->out[1] = &channel->slotz[1]->out;
channel->out[2] = &channel->chip->zeromod;
channel->out[3] = &channel->chip->zeromod;
break;
case 0x02:
- channel->pair->slots[0]->mod = &channel->pair->slots[0]->fbmod;
- channel->pair->slots[1]->mod = &channel->chip->zeromod;
- channel->slots[0]->mod = &channel->pair->slots[1]->out;
- channel->slots[1]->mod = &channel->slots[0]->out;
- channel->out[0] = &channel->pair->slots[0]->out;
- channel->out[1] = &channel->slots[1]->out;
+ channel->pair->slotz[0]->mod = &channel->pair->slotz[0]->fbmod;
+ channel->pair->slotz[1]->mod = &channel->chip->zeromod;
+ channel->slotz[0]->mod = &channel->pair->slotz[1]->out;
+ channel->slotz[1]->mod = &channel->slotz[0]->out;
+ channel->out[0] = &channel->pair->slotz[0]->out;
+ channel->out[1] = &channel->slotz[1]->out;
channel->out[2] = &channel->chip->zeromod;
channel->out[3] = &channel->chip->zeromod;
break;
case 0x03:
- channel->pair->slots[0]->mod = &channel->pair->slots[0]->fbmod;
- channel->pair->slots[1]->mod = &channel->chip->zeromod;
- channel->slots[0]->mod = &channel->pair->slots[1]->out;
- channel->slots[1]->mod = &channel->chip->zeromod;
- channel->out[0] = &channel->pair->slots[0]->out;
- channel->out[1] = &channel->slots[0]->out;
- channel->out[2] = &channel->slots[1]->out;
+ channel->pair->slotz[0]->mod = &channel->pair->slotz[0]->fbmod;
+ channel->pair->slotz[1]->mod = &channel->chip->zeromod;
+ channel->slotz[0]->mod = &channel->pair->slotz[1]->out;
+ channel->slotz[1]->mod = &channel->chip->zeromod;
+ channel->out[0] = &channel->pair->slotz[0]->out;
+ channel->out[1] = &channel->slotz[0]->out;
+ channel->out[2] = &channel->slotz[1]->out;
channel->out[3] = &channel->chip->zeromod;
break;
}
@@ -841,18 +841,18 @@ static void OPL3_ChannelSetupAlg(opl3_channel *channel)
switch (channel->alg & 0x01)
{
case 0x00:
- channel->slots[0]->mod = &channel->slots[0]->fbmod;
- channel->slots[1]->mod = &channel->slots[0]->out;
- channel->out[0] = &channel->slots[1]->out;
+ channel->slotz[0]->mod = &channel->slotz[0]->fbmod;
+ channel->slotz[1]->mod = &channel->slotz[0]->out;
+ channel->out[0] = &channel->slotz[1]->out;
channel->out[1] = &channel->chip->zeromod;
channel->out[2] = &channel->chip->zeromod;
channel->out[3] = &channel->chip->zeromod;
break;
case 0x01:
- channel->slots[0]->mod = &channel->slots[0]->fbmod;
- channel->slots[1]->mod = &channel->chip->zeromod;
- channel->out[0] = &channel->slots[0]->out;
- channel->out[1] = &channel->slots[1]->out;
+ channel->slotz[0]->mod = &channel->slotz[0]->fbmod;
+ channel->slotz[1]->mod = &channel->chip->zeromod;
+ channel->out[0] = &channel->slotz[0]->out;
+ channel->out[1] = &channel->slotz[1]->out;
channel->out[2] = &channel->chip->zeromod;
channel->out[3] = &channel->chip->zeromod;
break;
@@ -905,21 +905,21 @@ static void OPL3_ChannelKeyOn(opl3_channel *channel)
{
if (channel->chtype == ch_4op)
{
- OPL3_EnvelopeKeyOn(channel->slots[0], egk_norm);
- OPL3_EnvelopeKeyOn(channel->slots[1], egk_norm);
- OPL3_EnvelopeKeyOn(channel->pair->slots[0], egk_norm);
- OPL3_EnvelopeKeyOn(channel->pair->slots[1], egk_norm);
+ OPL3_EnvelopeKeyOn(channel->slotz[0], egk_norm);
+ OPL3_EnvelopeKeyOn(channel->slotz[1], egk_norm);
+ OPL3_EnvelopeKeyOn(channel->pair->slotz[0], egk_norm);
+ OPL3_EnvelopeKeyOn(channel->pair->slotz[1], egk_norm);
}
else if (channel->chtype == ch_2op || channel->chtype == ch_drum)
{
- OPL3_EnvelopeKeyOn(channel->slots[0], egk_norm);
- OPL3_EnvelopeKeyOn(channel->slots[1], egk_norm);
+ OPL3_EnvelopeKeyOn(channel->slotz[0], egk_norm);
+ OPL3_EnvelopeKeyOn(channel->slotz[1], egk_norm);
}
}
else
{
- OPL3_EnvelopeKeyOn(channel->slots[0], egk_norm);
- OPL3_EnvelopeKeyOn(channel->slots[1], egk_norm);
+ OPL3_EnvelopeKeyOn(channel->slotz[0], egk_norm);
+ OPL3_EnvelopeKeyOn(channel->slotz[1], egk_norm);
}
}
@@ -929,21 +929,21 @@ static void OPL3_ChannelKeyOff(opl3_channel *channel)
{
if (channel->chtype == ch_4op)
{
- OPL3_EnvelopeKeyOff(channel->slots[0], egk_norm);
- OPL3_EnvelopeKeyOff(channel->slots[1], egk_norm);
- OPL3_EnvelopeKeyOff(channel->pair->slots[0], egk_norm);
- OPL3_EnvelopeKeyOff(channel->pair->slots[1], egk_norm);
+ OPL3_EnvelopeKeyOff(channel->slotz[0], egk_norm);
+ OPL3_EnvelopeKeyOff(channel->slotz[1], egk_norm);
+ OPL3_EnvelopeKeyOff(channel->pair->slotz[0], egk_norm);
+ OPL3_EnvelopeKeyOff(channel->pair->slotz[1], egk_norm);
}
else if (channel->chtype == ch_2op || channel->chtype == ch_drum)
{
- OPL3_EnvelopeKeyOff(channel->slots[0], egk_norm);
- OPL3_EnvelopeKeyOff(channel->slots[1], egk_norm);
+ OPL3_EnvelopeKeyOff(channel->slotz[0], egk_norm);
+ OPL3_EnvelopeKeyOff(channel->slotz[1], egk_norm);
}
}
else
{
- OPL3_EnvelopeKeyOff(channel->slots[0], egk_norm);
- OPL3_EnvelopeKeyOff(channel->slots[1], egk_norm);
+ OPL3_EnvelopeKeyOff(channel->slotz[0], egk_norm);
+ OPL3_EnvelopeKeyOff(channel->slotz[1], egk_norm);
}
}
@@ -997,9 +997,9 @@ static void OPL3_GenerateRhythm1(opl3_chip *chip)
channel6 = &chip->channel[6];
channel7 = &chip->channel[7];
channel8 = &chip->channel[8];
- OPL3_SlotGenerate(channel6->slots[0]);
- phase14 = (channel7->slots[0]->pg_phase >> 9) & 0x3ff;
- phase17 = (channel8->slots[1]->pg_phase >> 9) & 0x3ff;
+ OPL3_SlotGenerate(channel6->slotz[0]);
+ phase14 = (channel7->slotz[0]->pg_phase >> 9) & 0x3ff;
+ phase17 = (channel8->slotz[1]->pg_phase >> 9) & 0x3ff;
phase = 0x00;
/*hh tc phase bit*/
phasebit = ((phase14 & 0x08) | (((phase14 >> 5) ^ phase14) & 0x04)
@@ -1007,9 +1007,9 @@ static void OPL3_GenerateRhythm1(opl3_chip *chip)
/*hh*/
phase = (phasebit << 9)
| (0x34 << ((phasebit ^ (chip->noise & 0x01)) << 1));
- OPL3_SlotGeneratePhase(channel7->slots[0], phase);
+ OPL3_SlotGeneratePhase(channel7->slotz[0], phase);
/*tt*/
- OPL3_SlotGenerateZM(channel8->slots[0]);
+ OPL3_SlotGenerateZM(channel8->slotz[0]);
}
static void OPL3_GenerateRhythm2(opl3_chip *chip)
@@ -1025,19 +1025,19 @@ static void OPL3_GenerateRhythm2(opl3_chip *chip)
channel6 = &chip->channel[6];
channel7 = &chip->channel[7];
channel8 = &chip->channel[8];
- OPL3_SlotGenerate(channel6->slots[1]);
- phase14 = (channel7->slots[0]->pg_phase >> 9) & 0x3ff;
- phase17 = (channel8->slots[1]->pg_phase >> 9) & 0x3ff;
+ OPL3_SlotGenerate(channel6->slotz[1]);
+ phase14 = (channel7->slotz[0]->pg_phase >> 9) & 0x3ff;
+ phase17 = (channel8->slotz[1]->pg_phase >> 9) & 0x3ff;
phase = 0x00;
/*hh tc phase bit*/
phasebit = ((phase14 & 0x08) | (((phase14 >> 5) ^ phase14) & 0x04)
| (((phase17 >> 2) ^ phase17) & 0x08)) ? 0x01 : 0x00;
/*sd*/
phase = (0x100 << ((phase14 >> 8) & 0x01)) ^ ((chip->noise & 0x01) << 8);
- OPL3_SlotGeneratePhase(channel7->slots[1], phase);
+ OPL3_SlotGeneratePhase(channel7->slotz[1], phase);
/*tc*/
phase = 0x100 | (phasebit << 9);
- OPL3_SlotGeneratePhase(channel8->slots[1], phase);
+ OPL3_SlotGeneratePhase(channel8->slotz[1], phase);
}
void OPL3v17_Generate(opl3_chip *chip, Bit16s *buf)
@@ -1202,8 +1202,8 @@ void OPL3v17_Reset(opl3_chip *chip, Bit32u samplerate)
}
for (channum = 0; channum < 18; channum++)
{
- chip->channel[channum].slots[0] = &chip->chipslot[ch_slot[channum]];
- chip->channel[channum].slots[1] = &chip->chipslot[ch_slot[channum] + 3];
+ chip->channel[channum].slotz[0] = &chip->chipslot[ch_slot[channum]];
+ chip->channel[channum].slotz[1] = &chip->chipslot[ch_slot[channum] + 3];
chip->chipslot[ch_slot[channum]].channel = &chip->channel[channum];
chip->chipslot[ch_slot[channum] + 3].channel = &chip->channel[channum];
if ((channum % 9) < 3)
diff --git a/src/chips/nuked/nukedopl3_174.h b/src/chips/nuked/nukedopl3_174.h
index 43e4a6e..240802f 100644
--- a/src/chips/nuked/nukedopl3_174.h
+++ b/src/chips/nuked/nukedopl3_174.h
@@ -91,7 +91,7 @@ struct _opl3_slot {
};
struct _opl3_channel {
- opl3_slot *slots[2];
+ opl3_slot *slotz[2];/*Don't use "slots" keyword to avoid conflict with Qt applications*/
opl3_channel *pair;
opl3_chip *chip;
Bit16s *out[4];
diff --git a/src/fraction.hpp b/src/fraction.hpp
index 1ec10ab..1c0a38d 100644
--- a/src/fraction.hpp
+++ b/src/fraction.hpp
@@ -4,6 +4,7 @@
#include <cmath>
#include <limits>
+
/* Fraction number handling.
* Copyright (C) 1992,2001 Bisqwit (http://iki.fi/bisqwit/)
*/
@@ -82,6 +83,10 @@ public:
self &operator= (long double orig);
};
+#ifdef _MSC_VER
+#pragma warning(disable:4146)
+#endif
+
template<typename inttype>
void fraction<inttype>::Optim()
{
@@ -110,6 +115,10 @@ void fraction<inttype>::Optim()
//fprintf(stderr, "result: %d/%d\n\n", nom(), denom());
}
+#ifdef _MSC_VER
+#pragma warning(default:4146)
+#endif
+
template<typename inttype>
inline const fraction<inttype> abs(const fraction<inttype> &f)
{
diff --git a/utils/adlmidi-2/9x15.hpp b/utils/adlmidi-2/9x15.hpp
index e535d49..76e0660 100644
--- a/utils/adlmidi-2/9x15.hpp
+++ b/utils/adlmidi-2/9x15.hpp
@@ -160,8 +160,8 @@ struct font9x15: public UIfontBase
virtual unsigned GetIndex(char32_t c) const { return ns_font9x15::unicode_to_bitmap_index[c]; }
};
-static UIfontBase* Getfont9x15()
-{
- static font9x15 f;
- return &f;
-}
+//static UIfontBase* Getfont9x15()
+//{
+// static font9x15 f;
+// return &f;
+//}
diff --git a/utils/adlmidi-2/midiplay.cc b/utils/adlmidi-2/midiplay.cc
index dfdeb5a..74806eb 100644
--- a/utils/adlmidi-2/midiplay.cc
+++ b/utils/adlmidi-2/midiplay.cc
@@ -1593,6 +1593,7 @@ int main(int argc, char **argv)
UI.Color(7);
std::fflush(stderr);
std::printf(
+ "\n\n"
"Usage: adlmidi <midifilename> [ <options> ] [ <banknumber> [ <numcards> [ <numfourops>] ] ]\n"
" adlmidi <midifilename> -1 To enter instrument tester\n"
" -p Enables adlib percussion instrument mode (use with CMF files)\n"
diff --git a/utils/adlmidi-2/puzzlegame.cc b/utils/adlmidi-2/puzzlegame.cc
index e9d2b9b..f8fa57c 100644
--- a/utils/adlmidi-2/puzzlegame.cc
+++ b/utils/adlmidi-2/puzzlegame.cc
@@ -4,6 +4,8 @@
#include "input.hpp"
#include "puzzlegame.hpp"
+char ADLMIDI_PuzzleGame::peeked_input = 0;
+
unsigned long ADLMIDI_PuzzleGame::TimerRead()
{
static std::chrono::time_point<std::chrono::system_clock> begin = std::chrono::system_clock::now();
diff --git a/utils/adlmidi-2/puzzlegame.hpp b/utils/adlmidi-2/puzzlegame.hpp
index 03ad921..a35f1cb 100755
--- a/utils/adlmidi-2/puzzlegame.hpp
+++ b/utils/adlmidi-2/puzzlegame.hpp
@@ -36,7 +36,7 @@ namespace ADLMIDI_PuzzleGame
void Sound(unsigned/*freq*/, unsigned/*duration*/);
void PutCell(int x, int y, unsigned cell);
void ScreenPutString(const char* str, unsigned attr, unsigned column, unsigned row);
- static char peeked_input = 0;
+ extern char peeked_input;
bool kbhit();
char getch();
diff --git a/utils/dumpbank/dumpbank.cpp b/utils/dumpbank/dumpbank.cpp
index 84283e7..d2df74a 100644
--- a/utils/dumpbank/dumpbank.cpp
+++ b/utils/dumpbank/dumpbank.cpp
@@ -190,5 +190,12 @@ static void LoadBNK(const char* fn)
int main(int argc, const char* const* argv)
{
+ if(argc < 2)
+ {
+ std::printf("Usage: \n"
+ " %s filename.bnk\n"
+ "\n", argv[0]);
+ return 1;
+ }
LoadBNK(argv[1]);
}
diff --git a/utils/dumpmiles/dumpmiles.cpp b/utils/dumpmiles/dumpmiles.cpp
index 0c2d51b..a1a3816 100644
--- a/utils/dumpmiles/dumpmiles.cpp
+++ b/utils/dumpmiles/dumpmiles.cpp
@@ -49,5 +49,14 @@ static void LoadMiles(const char* fn)
int main(int argc, const char* const* argv)
{
+ if(argc < 2)
+ {
+ std::printf("Usage: \n"
+ " %s filename.opl\n"
+ "or:\n"
+ " %s filename.opl\n"
+ "\n", argv[0], argv[0]);
+ return 1;
+ }
LoadMiles(argv[1]);
}
diff --git a/utils/vlc_codec/libadlmidi.c b/utils/vlc_codec/libadlmidi.c
index eb20227..aedd718 100644
--- a/utils/vlc_codec/libadlmidi.c
+++ b/utils/vlc_codec/libadlmidi.c
@@ -18,10 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
-//#ifdef HAVE_CONFIG_H
-//# include "config.h"
-//#endif
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
@@ -44,18 +40,20 @@
#define SOUNDFONT_LONGTEXT N_( \
"Custom bank file to use for software synthesis." )
-//#define CHORUS_TEXT N_("Chorus")
+#if 0 /* Old code */
+#define CHORUS_TEXT N_("Chorus")
-//#define GAIN_TEXT N_("Synthesis gain")
-//#define GAIN_LONGTEXT N_("This gain is applied to synthesis output. " \
-// "High values may cause saturation when many notes are played at a time." )
+#define GAIN_TEXT N_("Synthesis gain")
+#define GAIN_LONGTEXT N_("This gain is applied to synthesis output. " \
+ "High values may cause saturation when many notes are played at a time." )
-//#define POLYPHONY_TEXT N_("Polyphony")
-//#define POLYPHONY_LONGTEXT N_( \
-// "The polyphony defines how many voices can be played at a time. " \
-// "Larger values require more processing power.")
+#define POLYPHONY_TEXT N_("Polyphony")
+#define POLYPHONY_LONGTEXT N_( \
+ "The polyphony defines how many voices can be played at a time. " \
+ "Larger values require more processing power.")
-//#define REVERB_TEXT N_("Reverb")
+#define REVERB_TEXT N_("Reverb")
+#endif
#define SAMPLE_RATE_TEXT N_("Sample rate")
@@ -179,8 +177,11 @@ static void Close (vlc_object_t *p_this)
static void Flush (decoder_t *p_dec)
{
decoder_sys_t *p_sys = p_dec->p_sys;
-
+#if (LIBVLC_VERSION_MAJOR >= 3)
date_Set (&p_sys->end_date, VLC_TS_INVALID);
+#else
+ date_Set (&p_sys->end_date, 0);
+#endif
adl_panic(p_sys->synth);
}
@@ -225,8 +226,7 @@ static block_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block)
return VLCDEC_SUCCESS;
}
#else
- date_Set (&p_sys->end_date, 0);
- adl_panic(p_sys->synth);
+ Flush (p_dec);
#endif
}