aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorFilippos Karapetis2014-07-13 17:12:04 +0300
committerFilippos Karapetis2014-07-13 17:12:04 +0300
commitf953e3a435d79f84aa160ad61193c32e3d572fcc (patch)
tree26ddc2e3b2804e9d41efa7f682c869268796b3b4 /audio
parentfd40cb22244f68af7e4260b3133f2466607a0efb (diff)
downloadscummvm-rg350-f953e3a435d79f84aa160ad61193c32e3d572fcc.tar.gz
scummvm-rg350-f953e3a435d79f84aa160ad61193c32e3d572fcc.tar.bz2
scummvm-rg350-f953e3a435d79f84aa160ad61193c32e3d572fcc.zip
MT32: Sync with the latest changes in munt
This syncs the code with munt commit fa8b4f899d, avoiding usage of a global constructor
Diffstat (limited to 'audio')
-rw-r--r--audio/softsynth/mt32/Part.cpp8
-rw-r--r--audio/softsynth/mt32/ROMInfo.cpp40
-rw-r--r--audio/softsynth/mt32/Synth.cpp2
3 files changed, 22 insertions, 28 deletions
diff --git a/audio/softsynth/mt32/Part.cpp b/audio/softsynth/mt32/Part.cpp
index 35b6c2bbce..d92473b5db 100644
--- a/audio/softsynth/mt32/Part.cpp
+++ b/audio/softsynth/mt32/Part.cpp
@@ -33,14 +33,6 @@ static const Bit8u PartialMixStruct[13] = {
1, 3, 3, 2, 2, 2, 2
};
-static const float floatKeyfollow[17] = {
- -1.0f, -1.0f / 2.0f, -1.0f / 4.0f, 0.0f,
- 1.0f / 8.0f, 1.0f / 4.0f, 3.0f / 8.0f, 1.0f / 2.0f, 5.0f / 8.0f, 3.0f / 4.0f, 7.0f / 8.0f, 1.0f,
- 5.0f / 4.0f, 3.0f / 2.0f, 2.0f,
- 1.0009765625f, 1.0048828125f
-};
-
-
RhythmPart::RhythmPart(Synth *useSynth, unsigned int usePartNum): Part(useSynth, usePartNum) {
strcpy(name, "Rhythm");
rhythmTemp = &synth->mt32ram.rhythmTemp[0];
diff --git a/audio/softsynth/mt32/ROMInfo.cpp b/audio/softsynth/mt32/ROMInfo.cpp
index 123ac0cc9d..eb9622620f 100644
--- a/audio/softsynth/mt32/ROMInfo.cpp
+++ b/audio/softsynth/mt32/ROMInfo.cpp
@@ -20,23 +20,24 @@
namespace MT32Emu {
-static const ControlROMFeatureSet MT32_COMPATIBLE(true);
-static const ControlROMFeatureSet CM32L_COMPATIBLE(false);
+static const ROMInfo *getKnownROMInfoFromList(unsigned int index) {
+ static const ControlROMFeatureSet MT32_COMPATIBLE(true);
+ static const ControlROMFeatureSet CM32L_COMPATIBLE(false);
-// Known ROMs
-static const ROMInfo CTRL_MT32_V1_04 = {65536, "5a5cb5a77d7d55ee69657c2f870416daed52dea7", ROMInfo::Control, "ctrl_mt32_1_04", "MT-32 Control v1.04", ROMInfo::Full, NULL, &MT32_COMPATIBLE};
-static const ROMInfo CTRL_MT32_V1_05 = {65536, "e17a3a6d265bf1fa150312061134293d2b58288c", ROMInfo::Control, "ctrl_mt32_1_05", "MT-32 Control v1.05", ROMInfo::Full, NULL, &MT32_COMPATIBLE};
-static const ROMInfo CTRL_MT32_V1_06 = {65536, "a553481f4e2794c10cfe597fef154eef0d8257de", ROMInfo::Control, "ctrl_mt32_1_06", "MT-32 Control v1.06", ROMInfo::Full, NULL, &MT32_COMPATIBLE};
-static const ROMInfo CTRL_MT32_V1_07 = {65536, "b083518fffb7f66b03c23b7eb4f868e62dc5a987", ROMInfo::Control, "ctrl_mt32_1_07", "MT-32 Control v1.07", ROMInfo::Full, NULL, &MT32_COMPATIBLE};
-static const ROMInfo CTRL_MT32_BLUER = {65536, "7b8c2a5ddb42fd0732e2f22b3340dcf5360edf92", ROMInfo::Control, "ctrl_mt32_bluer", "MT-32 Control BlueRidge", ROMInfo::Full, NULL, &MT32_COMPATIBLE};
+ // Known ROMs
+ static const ROMInfo CTRL_MT32_V1_04 = {65536, "5a5cb5a77d7d55ee69657c2f870416daed52dea7", ROMInfo::Control, "ctrl_mt32_1_04", "MT-32 Control v1.04", ROMInfo::Full, NULL, &MT32_COMPATIBLE};
+ static const ROMInfo CTRL_MT32_V1_05 = {65536, "e17a3a6d265bf1fa150312061134293d2b58288c", ROMInfo::Control, "ctrl_mt32_1_05", "MT-32 Control v1.05", ROMInfo::Full, NULL, &MT32_COMPATIBLE};
+ static const ROMInfo CTRL_MT32_V1_06 = {65536, "a553481f4e2794c10cfe597fef154eef0d8257de", ROMInfo::Control, "ctrl_mt32_1_06", "MT-32 Control v1.06", ROMInfo::Full, NULL, &MT32_COMPATIBLE};
+ static const ROMInfo CTRL_MT32_V1_07 = {65536, "b083518fffb7f66b03c23b7eb4f868e62dc5a987", ROMInfo::Control, "ctrl_mt32_1_07", "MT-32 Control v1.07", ROMInfo::Full, NULL, &MT32_COMPATIBLE};
+ static const ROMInfo CTRL_MT32_BLUER = {65536, "7b8c2a5ddb42fd0732e2f22b3340dcf5360edf92", ROMInfo::Control, "ctrl_mt32_bluer", "MT-32 Control BlueRidge", ROMInfo::Full, NULL, &MT32_COMPATIBLE};
-static const ROMInfo CTRL_CM32L_V1_00 = {65536, "73683d585cd6948cc19547942ca0e14a0319456d", ROMInfo::Control, "ctrl_cm32l_1_00", "CM-32L/LAPC-I Control v1.00", ROMInfo::Full, NULL, &CM32L_COMPATIBLE};
-static const ROMInfo CTRL_CM32L_V1_02 = {65536, "a439fbb390da38cada95a7cbb1d6ca199cd66ef8", ROMInfo::Control, "ctrl_cm32l_1_02", "CM-32L/LAPC-I Control v1.02", ROMInfo::Full, NULL, &CM32L_COMPATIBLE};
+ static const ROMInfo CTRL_CM32L_V1_00 = {65536, "73683d585cd6948cc19547942ca0e14a0319456d", ROMInfo::Control, "ctrl_cm32l_1_00", "CM-32L/LAPC-I Control v1.00", ROMInfo::Full, NULL, &CM32L_COMPATIBLE};
+ static const ROMInfo CTRL_CM32L_V1_02 = {65536, "a439fbb390da38cada95a7cbb1d6ca199cd66ef8", ROMInfo::Control, "ctrl_cm32l_1_02", "CM-32L/LAPC-I Control v1.02", ROMInfo::Full, NULL, &CM32L_COMPATIBLE};
-static const ROMInfo PCM_MT32 = {524288, "f6b1eebc4b2d200ec6d3d21d51325d5b48c60252", ROMInfo::PCM, "pcm_mt32", "MT-32 PCM ROM", ROMInfo::Full, NULL, NULL};
-static const ROMInfo PCM_CM32L = {1048576, "289cc298ad532b702461bfc738009d9ebe8025ea", ROMInfo::PCM, "pcm_cm32l", "CM-32L/CM-64/LAPC-I PCM ROM", ROMInfo::Full, NULL, NULL};
+ static const ROMInfo PCM_MT32 = {524288, "f6b1eebc4b2d200ec6d3d21d51325d5b48c60252", ROMInfo::PCM, "pcm_mt32", "MT-32 PCM ROM", ROMInfo::Full, NULL, NULL};
+ static const ROMInfo PCM_CM32L = {1048576, "289cc298ad532b702461bfc738009d9ebe8025ea", ROMInfo::PCM, "pcm_cm32l", "CM-32L/CM-64/LAPC-I PCM ROM", ROMInfo::Full, NULL, NULL};
-static const ROMInfo * const ROM_INFOS[] = {
+ static const ROMInfo * const ROM_INFOS[] = {
&CTRL_MT32_V1_04,
&CTRL_MT32_V1_05,
&CTRL_MT32_V1_06,
@@ -48,13 +49,16 @@ static const ROMInfo * const ROM_INFOS[] = {
&PCM_CM32L,
NULL};
+ return ROM_INFOS[index];
+}
+
const ROMInfo* ROMInfo::getROMInfo(Common::File *file) {
size_t fileSize = file->size();
// We haven't added the SHA1 checksum code in ScummVM, as the file size
// suffices for our needs for now.
//const char *fileDigest = file->getSHA1();
- for (int i = 0; ROM_INFOS[i] != NULL; i++) {
- const ROMInfo *romInfo = ROM_INFOS[i];
+ for (int i = 0; getKnownROMInfoFromList(i) != NULL; i++) {
+ const ROMInfo *romInfo = getKnownROMInfoFromList(i);
if (fileSize == romInfo->fileSize /*&& !strcmp(fileDigest, romInfo->sha1Digest)*/) {
return romInfo;
}
@@ -68,7 +72,7 @@ void ROMInfo::freeROMInfo(const ROMInfo *romInfo) {
static int getROMCount() {
int count;
- for(count = 0; ROM_INFOS[count] != NULL; count++) {
+ for(count = 0; getKnownROMInfoFromList(count) != NULL; count++) {
}
return count;
}
@@ -76,8 +80,8 @@ static int getROMCount() {
const ROMInfo** ROMInfo::getROMInfoList(unsigned int types, unsigned int pairTypes) {
const ROMInfo **romInfoList = new const ROMInfo*[getROMCount() + 1];
const ROMInfo **currentROMInList = romInfoList;
- for(int i = 0; ROM_INFOS[i] != NULL; i++) {
- const ROMInfo *romInfo = ROM_INFOS[i];
+ for(int i = 0; getKnownROMInfoFromList(i) != NULL; i++) {
+ const ROMInfo *romInfo = getKnownROMInfoFromList(i);
if ((types & (1 << romInfo->type)) && (pairTypes & (1 << romInfo->pairType))) {
*currentROMInList++ = romInfo;
}
diff --git a/audio/softsynth/mt32/Synth.cpp b/audio/softsynth/mt32/Synth.cpp
index 5ed172f2a8..3bff429875 100644
--- a/audio/softsynth/mt32/Synth.cpp
+++ b/audio/softsynth/mt32/Synth.cpp
@@ -246,7 +246,6 @@ bool Synth::isReversedStereoEnabled() {
}
bool Synth::loadControlROM(const ROMImage &controlROMImage) {
- if (&controlROMImage == NULL) return false;
Common::File *file = controlROMImage.getFile();
const ROMInfo *controlROMInfo = controlROMImage.getROMInfo();
if ((controlROMInfo == NULL)
@@ -282,7 +281,6 @@ bool Synth::loadControlROM(const ROMImage &controlROMImage) {
}
bool Synth::loadPCMROM(const ROMImage &pcmROMImage) {
- if (&pcmROMImage == NULL) return false;
Common::File *file = pcmROMImage.getFile();
const ROMInfo *pcmROMInfo = pcmROMImage.getROMInfo();
if ((pcmROMInfo == NULL)