aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/adldata.cpp78
-rw-r--r--src/adlmidi_opl3.cpp57
-rw-r--r--src/adlmidi_opl3.hpp4
-rw-r--r--src/wopl/wopl_file.h3
4 files changed, 95 insertions, 47 deletions
diff --git a/src/adldata.cpp b/src/adldata.cpp
index fbe02f5..c658667 100644
--- a/src/adldata.cpp
+++ b/src/adldata.cpp
@@ -12,7 +12,7 @@ const size_t g_embeddedBanksCount = 76;
const BanksDump::BankEntry g_embeddedBanks[] =
{
- {0x0300, 1, 1, "AIL (Star Control 3, Albion, Empire 2, etc.)", 0, 1},
+ {0x0307, 1, 1, "AIL (Star Control 3, Albion, Empire 2, etc.)", 0, 1},
{0x0300, 1, 1, "Bisqwit (selection of 4op and 2op)", 2, 3},
{0x0300, 1, 1, "HMI (Descent, Asterix)", 4, 5},
{0x0300, 1, 1, "HMI (Descent:: Int)", 6, 7},
@@ -29,49 +29,49 @@ const BanksDump::BankEntry g_embeddedBanks[] =
{0x0002, 1, 1, "DMX (Doom 2)", 28, 29},
{0x0002, 1, 1, "DMX (Hexen, Heretic)", 30, 31},
{0x0002, 1, 1, "DMX (DOOM, MUS Play)", 32, 33},
- {0x0300, 1, 1, "AIL (Discworld, Grandest Fleet, etc.)", 34, 35},
- {0x0300, 1, 1, "AIL (Warcraft 2)", 36, 37},
- {0x0300, 1, 1, "AIL (Syndicate)", 38, 39},
- {0x0300, 1, 1, "AIL (Guilty, Orion Conspiracy, TNSFC ::4op)", 40, 41},
- {0x0300, 1, 1, "AIL (Magic Carpet 2)", 42, 43},
- {0x0300, 1, 1, "AIL (Nemesis)", 44, 45},
- {0x0300, 3, 1, "AIL (Jagged Alliance)", 46, 49},
- {0x0300, 1, 1, "AIL (When Two Worlds War :MISS-INS:)", 50, 51},
- {0x0300, 1, 1, "AIL (Bards Tale Construction :MISS-INS:)", 52, 53},
- {0x0300, 1, 1, "AIL (Return to Zork)", 54, 55},
- {0x0300, 1, 1, "AIL (Theme Hospital)", 56, 57},
- {0x0300, 1, 1, "AIL (National Hockey League PA)", 58, 59},
- {0x0300, 1, 1, "AIL (Inherit The Earth)", 60, 61},
- {0x0300, 1, 1, "AIL (Inherit The Earth, file two)", 62, 63},
- {0x0300, 1, 1, "AIL (Little Big Adventure :: 4op)", 64, 65},
- {0x0300, 1, 1, "AIL (Wreckin Crew)", 66, 67},
- {0x0300, 1, 1, "AIL (Death Gate)", 68, 69},
- {0x0300, 1, 1, "AIL (FIFA International Soccer)", 70, 71},
- {0x0300, 2, 1, "AIL (Starship Invasion)", 72, 74},
- {0x0300, 1, 1, "AIL (Super Street Fighter 2 :4op:)", 75, 76},
- {0x0300, 1, 1, "AIL (Lords of the Realm :MISS-INS:)", 77, 78},
- {0x0300, 1, 1, "AIL (SimFarm, SimHealth :: 4op)", 79, 80},
- {0x0300, 1, 1, "AIL (SimFarm, Settlers, Serf City)", 81, 82},
- {0x0300, 1, 1, "AIL (Caesar 2, :p4op::MISS-INS:)", 83, 84},
- {0x0300, 1, 1, "AIL (Syndicate Wars)", 85, 86},
- {0x0300, 1, 1, "AIL (Bubble Bobble Feat. Rainbow Islands, Z)", 87, 88},
- {0x0300, 1, 1, "AIL (Warcraft)", 89, 90},
- {0x0300, 1, 1, "AIL (Terra Nova Strike Force Centuri :p4op:)", 91, 92},
- {0x0300, 1, 1, "AIL (System Shock :p4op:)", 93, 94},
- {0x0300, 1, 1, "AIL (Advanced Civilization)", 95, 96},
- {0x0300, 1, 1, "AIL (Battle Chess 4000 :p4op:)", 97, 98},
- {0x0300, 1, 1, "AIL (Ultimate Soccer Manager :p4op:)", 99, 100},
- {0x0300, 1, 1, "AIL (Air Bucks, Blue And The Gray, etc)", 101, 102},
- {0x0300, 2, 1, "AIL (Ultima Underworld 2)", 103, 105},
- {0x0300, 1, 1, "AIL (Kasparov's Gambit)", 106, 107},
- {0x0300, 1, 1, "AIL (High Seas Trader :MISS-INS:)", 108, 109},
+ {0x0307, 1, 1, "AIL (Discworld, Grandest Fleet, etc.)", 34, 35},
+ {0x0307, 1, 1, "AIL (Warcraft 2)", 36, 37},
+ {0x0307, 1, 1, "AIL (Syndicate)", 38, 39},
+ {0x0307, 1, 1, "AIL (Guilty, Orion Conspiracy, TNSFC ::4op)", 40, 41},
+ {0x0307, 1, 1, "AIL (Magic Carpet 2)", 42, 43},
+ {0x0307, 1, 1, "AIL (Nemesis)", 44, 45},
+ {0x0307, 3, 1, "AIL (Jagged Alliance)", 46, 49},
+ {0x0307, 1, 1, "AIL (When Two Worlds War :MISS-INS:)", 50, 51},
+ {0x0307, 1, 1, "AIL (Bards Tale Construction :MISS-INS:)", 52, 53},
+ {0x0307, 1, 1, "AIL (Return to Zork)", 54, 55},
+ {0x0307, 1, 1, "AIL (Theme Hospital)", 56, 57},
+ {0x0307, 1, 1, "AIL (National Hockey League PA)", 58, 59},
+ {0x0307, 1, 1, "AIL (Inherit The Earth)", 60, 61},
+ {0x0307, 1, 1, "AIL (Inherit The Earth, file two)", 62, 63},
+ {0x0307, 1, 1, "AIL (Little Big Adventure :: 4op)", 64, 65},
+ {0x0307, 1, 1, "AIL (Wreckin Crew)", 66, 67},
+ {0x0307, 1, 1, "AIL (Death Gate)", 68, 69},
+ {0x0307, 1, 1, "AIL (FIFA International Soccer)", 70, 71},
+ {0x0307, 2, 1, "AIL (Starship Invasion)", 72, 74},
+ {0x0307, 1, 1, "AIL (Super Street Fighter 2 :4op:)", 75, 76},
+ {0x0307, 1, 1, "AIL (Lords of the Realm :MISS-INS:)", 77, 78},
+ {0x0307, 1, 1, "AIL (SimFarm, SimHealth :: 4op)", 79, 80},
+ {0x0307, 1, 1, "AIL (SimFarm, Settlers, Serf City)", 81, 82},
+ {0x0307, 1, 1, "AIL (Caesar 2, :p4op::MISS-INS:)", 83, 84},
+ {0x0307, 1, 1, "AIL (Syndicate Wars)", 85, 86},
+ {0x0307, 1, 1, "AIL (Bubble Bobble Feat. Rainbow Islands, Z)", 87, 88},
+ {0x0307, 1, 1, "AIL (Warcraft)", 89, 90},
+ {0x0307, 1, 1, "AIL (Terra Nova Strike Force Centuri :p4op:)", 91, 92},
+ {0x0307, 1, 1, "AIL (System Shock :p4op:)", 93, 94},
+ {0x0307, 1, 1, "AIL (Advanced Civilization)", 95, 96},
+ {0x0307, 1, 1, "AIL (Battle Chess 4000 :p4op:)", 97, 98},
+ {0x0307, 1, 1, "AIL (Ultimate Soccer Manager :p4op:)", 99, 100},
+ {0x0307, 1, 1, "AIL (Air Bucks, Blue And The Gray, etc)", 101, 102},
+ {0x0307, 2, 1, "AIL (Ultima Underworld 2)", 103, 105},
+ {0x0307, 1, 1, "AIL (Kasparov's Gambit)", 106, 107},
+ {0x0307, 1, 1, "AIL (High Seas Trader :MISS-INS:)", 108, 109},
{0x0300, 1, 1, "AIL (Master of Magic, :4op: std percussion)", 110, 111},
{0x0300, 1, 1, "AIL (Master of Magic, :4op: orchestral percussion)", 112, 113},
{0x0300, 1, 1, "SB (Action Soccer)", 114, 115},
{0x0300, 1, 0, "SB (3d Cyberpuck :: melodic only)", 116, 117},
{0x0300, 1, 0, "SB (Simon the Sorcerer :: melodic only)", 117, 118},
{0x0304, 1, 1, "OP3 (The Fat Man 2op set)", 118, 119},
- {0x0300, 1, 1, "OP3 (The Fat Man 4op set)", 120, 121},
+ {0x0307, 1, 1, "OP3 (The Fat Man 4op set)", 120, 121},
{0x0304, 1, 1, "OP3 (JungleVision 2op set :: melodic only)", 122, 123},
{0x0304, 1, 1, "OP3 (Wallace 2op set, Nitemare 3D :: melodic only)", 124, 125},
{0x0003, 1, 1, "TMB (Duke Nukem 3D)", 126, 127},
@@ -87,7 +87,7 @@ const BanksDump::BankEntry g_embeddedBanks[] =
{0x0000, 11, 3, "WOPL (DMXOPL3 bank by Sneakernets)", 146, 157},
{0x0201, 1, 1, "EA (Cartooners)", 160, 161},
{0x0200, 1, 1, "WOPL (Apogee IMF 90-ish)", 162, 163},
- {0x0300, 3, 1, "The Lost Vikings", 164, 167},
+ {0x0307, 3, 1, "The Lost Vikings", 164, 167},
};
const char* const g_embeddedBankNames[] =
diff --git a/src/adlmidi_opl3.cpp b/src/adlmidi_opl3.cpp
index 522d2fc..43bab86 100644
--- a/src/adlmidi_opl3.cpp
+++ b/src/adlmidi_opl3.cpp
@@ -225,6 +225,13 @@ static const uint_fast32_t W9X_volume_mapping_table[32] =
3, 3, 2, 2, 1, 1, 0, 0
};
+static const uint_fast32_t AIL_vel_graph[16] =
+{
+ 82, 85, 88, 91, 94, 97, 100, 103,
+ 106, 109, 112, 115, 118, 121, 124, 127
+};
+
+
enum
{
MasterVolumeDefault = 127
@@ -497,13 +504,14 @@ void OPL3::touchNote(size_t c,
size_t cmf_offset = ((m_musicMode == MODE_CMF) && cc >= OPL3_CHANNELS_RHYTHM_BASE) ? 10 : 0;
uint16_t o1 = g_operatorsMap[cc * 2 + 0 + cmf_offset];
uint16_t o2 = g_operatorsMap[cc * 2 + 1 + cmf_offset];
- uint8_t x = adli.modulator_40, y = adli.carrier_40;
+ uint8_t srcMod = adli.modulator_40,
+ srcCar = adli.carrier_40;
uint32_t mode = 1; // 2-op AM
- uint_fast32_t kslMod = x & 0xC0;
- uint_fast32_t kslCar = y & 0xC0;
- uint_fast32_t tlMod = x & 0x3F;
- uint_fast32_t tlCar = y & 0x3F;
+ uint_fast32_t kslMod = srcMod & 0xC0;
+ uint_fast32_t kslCar = srcCar & 0xC0;
+ uint_fast32_t tlMod = srcMod & 0x3F;
+ uint_fast32_t tlCar = srcCar & 0x3F;
uint_fast32_t modulator;
uint_fast32_t carrier;
@@ -582,7 +590,6 @@ void OPL3::touchNote(size_t c,
case Synth::VOLUME_APOGEE:
case Synth::VOLUME_APOGEE_FIXED:
{
- volume = 0;
midiVolume = (channelVolume * channelExpression * m_masterVolume / 16129);
}
break;
@@ -593,6 +600,26 @@ void OPL3::touchNote(size_t c,
volume = W9X_volume_mapping_table[volume >> 2];
}
break;
+
+ case Synth::VOLUME_AIL:
+ {
+ midiVolume = (channelVolume * channelExpression) * 2;
+ midiVolume >>= 8;
+ if(midiVolume != 0)
+ midiVolume++;
+
+ velocity = (velocity & 0x7F) >> 3;
+ velocity = AIL_vel_graph[velocity];
+
+ midiVolume = (midiVolume * velocity) * 2;
+ midiVolume >>= 8;
+ if(midiVolume != 0)
+ midiVolume++;
+
+ if(m_masterVolume < 127)
+ midiVolume = (midiVolume * m_masterVolume) / 127;
+ }
+ break;
}
if(volume > 63)
@@ -690,6 +717,19 @@ void OPL3::touchNote(size_t c,
if(tlMod > 0x3F)
tlMod = 0x3F;
}
+ else if(m_volumeScale == Synth::VOLUME_AIL)
+ {
+ uint_fast32_t v0_val = (~srcMod) & 0x3f;
+ uint_fast32_t v1_val = (~srcCar) & 0x3f;
+
+ if(do_modulator)
+ v0_val = (v0_val * midiVolume) / 127;
+ if(do_carrier)
+ v1_val = (v1_val * midiVolume) / 127;
+
+ tlMod = (~v0_val) & 0x3F;
+ tlCar = (~v1_val) & 0x3F;
+ }
else
{
if(do_modulator)
@@ -909,6 +949,9 @@ void OPL3::setVolumeScaleModel(ADLMIDI_VolumeModels volumeModel)
case ADLMIDI_VolumeModel_APOGEE_Fixed:
m_volumeScale = OPL3::VOLUME_APOGEE_FIXED;
break;
+ case ADLMIDI_VolumeModel_AIL:
+ m_volumeScale = OPL3::VOLUME_AIL;
+ break;
}
}
@@ -931,6 +974,8 @@ ADLMIDI_VolumeModels OPL3::getVolumeScaleModel()
return ADLMIDI_VolumeModel_DMX_Fixed;
case OPL3::VOLUME_APOGEE_FIXED:
return ADLMIDI_VolumeModel_APOGEE_Fixed;
+ case OPL3::VOLUME_AIL:
+ return ADLMIDI_VolumeModel_AIL;
}
}
diff --git a/src/adlmidi_opl3.hpp b/src/adlmidi_opl3.hpp
index 247dc01..83db8e1 100644
--- a/src/adlmidi_opl3.hpp
+++ b/src/adlmidi_opl3.hpp
@@ -149,7 +149,9 @@ public:
//! DMX model with a fixed bug of AM voices
VOLUME_DMX_FIXED,
//! Apogee model with a fixed bug of AM voices
- VOLUME_APOGEE_FIXED
+ VOLUME_APOGEE_FIXED,
+ //! Audio Interfaces Library volume scaling model
+ VOLUME_AIL
} m_volumeScale;
//! Reserved
diff --git a/src/wopl/wopl_file.h b/src/wopl/wopl_file.h
index 80a8959..fa76ce7 100644
--- a/src/wopl/wopl_file.h
+++ b/src/wopl/wopl_file.h
@@ -58,7 +58,8 @@ typedef enum WOPL_VolumeModel
WOPL_VM_Apogee,
WOPL_VM_Win9x,
WOPL_VM_DMX_Fixed,
- WOPL_VM_Apogee_Fixed
+ WOPL_VM_Apogee_Fixed,
+ WOPL_VM_AIL
} WOPL_VolumeModel;
typedef enum WOPL_InstrumentFlags