From f953e3a435d79f84aa160ad61193c32e3d572fcc Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 13 Jul 2014 17:12:04 +0300 Subject: MT32: Sync with the latest changes in munt This syncs the code with munt commit fa8b4f899d, avoiding usage of a global constructor --- audio/softsynth/mt32/Part.cpp | 8 -------- audio/softsynth/mt32/ROMInfo.cpp | 40 ++++++++++++++++++++++------------------ audio/softsynth/mt32/Synth.cpp | 2 -- 3 files changed, 22 insertions(+), 28 deletions(-) (limited to 'audio/softsynth') 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) -- cgit v1.2.3