diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/audiostream.h | 5 | ||||
-rw-r--r-- | sound/decoders/adpcm.cpp | 13 | ||||
-rw-r--r-- | sound/decoders/adpcm.h | 17 | ||||
-rw-r--r-- | sound/decoders/flac.cpp | 5 | ||||
-rw-r--r-- | sound/decoders/vorbis.cpp | 5 | ||||
-rw-r--r-- | sound/decoders/wave.cpp | 20 | ||||
-rw-r--r-- | sound/mididrv.cpp | 45 | ||||
-rw-r--r-- | sound/mixer.cpp | 1 | ||||
-rw-r--r-- | sound/mods/tfmx.cpp | 4 | ||||
-rw-r--r-- | sound/rate_arm.cpp | 14 | ||||
-rw-r--r-- | sound/softsynth/cms.cpp | 242 | ||||
-rw-r--r-- | sound/softsynth/fmtowns_pc98/towns_audio.cpp | 1 | ||||
-rw-r--r-- | sound/softsynth/fmtowns_pc98/towns_euphony.cpp | 4 | ||||
-rw-r--r-- | sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp | 1 | ||||
-rw-r--r-- | sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp | 1 | ||||
-rw-r--r-- | sound/softsynth/mt32/mt32_file.cpp | 18 | ||||
-rw-r--r-- | sound/softsynth/mt32/mt32_file.h | 2 | ||||
-rw-r--r-- | sound/softsynth/mt32/tables.cpp | 2 |
18 files changed, 208 insertions, 192 deletions
diff --git a/sound/audiostream.h b/sound/audiostream.h index 64ad128931..b2c012841d 100644 --- a/sound/audiostream.h +++ b/sound/audiostream.h @@ -276,11 +276,6 @@ private: * The same caveats apply to SubSeekableAudioStream as do to SeekableAudioStream. * * Manipulating the parent stream directly /will/ mess up a substream. - * - * IMPORTANT: - * Note for engine authors. This object is currently under inspection. In case - * we need to revise the looping API we might drop this. So if you really need - * something like this object, please drop a mail to LordHoto. */ class SubSeekableAudioStream : public SeekableAudioStream { public: diff --git a/sound/decoders/adpcm.cpp b/sound/decoders/adpcm.cpp index c8a907d13e..8a27658e4b 100644 --- a/sound/decoders/adpcm.cpp +++ b/sound/decoders/adpcm.cpp @@ -290,8 +290,8 @@ int Apple_ADPCMStream::readBuffer(int16 *buffer, const int numSamples) { class MSIma_ADPCMStream : public Ima_ADPCMStream { public: - MSIma_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign) - : Ima_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) { + MSIma_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign, bool invertSamples = false) + : Ima_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign), _invertSamples(invertSamples) { if (blockAlign == 0) error("ADPCMStream(): blockAlign isn't specified for MS IMA ADPCM"); } @@ -305,6 +305,9 @@ public: int readBufferMSIMA1(int16 *buffer, const int numSamples); int readBufferMSIMA2(int16 *buffer, const int numSamples); + +private: + bool _invertSamples; // Some implementations invert the way samples are decoded }; int MSIma_ADPCMStream::readBufferMSIMA1(int16 *buffer, const int numSamples) { @@ -324,8 +327,8 @@ int MSIma_ADPCMStream::readBufferMSIMA1(int16 *buffer, const int numSamples) { for (; samples < numSamples && _blockPos[0] < _blockAlign && !_stream->eos() && _stream->pos() < _endpos; samples += 2) { data = _stream->readByte(); _blockPos[0]++; - buffer[samples] = decodeIMA(data & 0x0f); - buffer[samples + 1] = decodeIMA((data >> 4) & 0x0f); + buffer[samples] = decodeIMA(_invertSamples ? (data >> 4) & 0x0f : data & 0x0f); + buffer[samples + 1] = decodeIMA(_invertSamples ? data & 0x0f : (data >> 4) & 0x0f); } } return samples; @@ -733,6 +736,8 @@ RewindableAudioStream *makeADPCMStream(Common::SeekableReadStream *stream, Dispo return new Oki_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign); case kADPCMMSIma: return new MSIma_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign); + case kADPCMMSImaLastExpress: + return new MSIma_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign, true); case kADPCMMS: return new MS_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign); case kADPCMTinsel4: diff --git a/sound/decoders/adpcm.h b/sound/decoders/adpcm.h index 04dbb1a521..edcdc01ce9 100644 --- a/sound/decoders/adpcm.h +++ b/sound/decoders/adpcm.h @@ -50,14 +50,15 @@ class RewindableAudioStream; // Usually, if the audio stream we're trying to play has the FourCC header // string intact, it's easy to discern which encoding is used enum typesADPCM { - kADPCMOki, // Dialogic/Oki ADPCM (aka VOX) - kADPCMMSIma, // Microsoft IMA ADPCM - kADPCMMS, // Microsoft ADPCM - kADPCMTinsel4, // 4-bit ADPCM used by the Tinsel engine - kADPCMTinsel6, // 6-bit ADPCM used by the Tinsel engine - kADPCMTinsel8, // 8-bit ADPCM used by the Tinsel engine - kADPCMIma, // Standard IMA ADPCM - kADPCMApple // Apple QuickTime IMA ADPCM + kADPCMOki, // Dialogic/Oki ADPCM (aka VOX) + kADPCMMSIma, // Microsoft IMA ADPCM + kADPCMMSImaLastExpress, // Microsoft IMA ADPCM (with inverted samples) + kADPCMMS, // Microsoft ADPCM + kADPCMTinsel4, // 4-bit ADPCM used by the Tinsel engine + kADPCMTinsel6, // 6-bit ADPCM used by the Tinsel engine + kADPCMTinsel8, // 8-bit ADPCM used by the Tinsel engine + kADPCMIma, // Standard IMA ADPCM + kADPCMApple // Apple QuickTime IMA ADPCM }; /** diff --git a/sound/decoders/flac.cpp b/sound/decoders/flac.cpp index 560b83e1ee..080141f224 100644 --- a/sound/decoders/flac.cpp +++ b/sound/decoders/flac.cpp @@ -23,6 +23,9 @@ * */ +// Disable symbol overrides for FILE as that is used in FLAC headers +#define FORBIDDEN_SYMBOL_EXCEPTION_FILE + #include "sound/decoders/flac.h" #ifdef USE_FLAC @@ -302,7 +305,7 @@ int FLACStream::readBuffer(int16 *buffer, const int numSamples) { const uint numChannels = getChannels(); if (numChannels == 0) { - warning("FLACStream: Stream not sucessfully initialised, cant playback"); + warning("FLACStream: Stream not successfully initialised, cant playback"); return -1; // streaminfo wasnt read! } diff --git a/sound/decoders/vorbis.cpp b/sound/decoders/vorbis.cpp index 5aeb40c139..425eb6b751 100644 --- a/sound/decoders/vorbis.cpp +++ b/sound/decoders/vorbis.cpp @@ -23,6 +23,11 @@ * */ +// Disable symbol overrides for FILE and fseek as those are used in the +// Vorbis headers. +#define FORBIDDEN_SYMBOL_EXCEPTION_FILE +#define FORBIDDEN_SYMBOL_EXCEPTION_fseek + #include "sound/decoders/vorbis.h" #ifdef USE_VORBIS diff --git a/sound/decoders/wave.cpp b/sound/decoders/wave.cpp index eeab026ae5..fcaace5301 100644 --- a/sound/decoders/wave.cpp +++ b/sound/decoders/wave.cpp @@ -90,15 +90,15 @@ bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate, if (blockAlign_ != 0) *blockAlign_ = blockAlign; #if 0 - printf("WAVE information:\n"); - printf(" total size: %d\n", wavLength); - printf(" fmt size: %d\n", fmtLength); - printf(" type: %d\n", type); - printf(" numChannels: %d\n", numChannels); - printf(" samplesPerSec: %d\n", samplesPerSec); - printf(" avgBytesPerSec: %d\n", avgBytesPerSec); - printf(" blockAlign: %d\n", blockAlign); - printf(" bitsPerSample: %d\n", bitsPerSample); + debug("WAVE information:"); + debug(" total size: %d", wavLength); + debug(" fmt size: %d", fmtLength); + debug(" type: %d", type); + debug(" numChannels: %d", numChannels); + debug(" samplesPerSec: %d", samplesPerSec); + debug(" avgBytesPerSec: %d", avgBytesPerSec); + debug(" blockAlign: %d", blockAlign); + debug(" bitsPerSample: %d", bitsPerSample); #endif if (type != 1 && type != 2 && type != 17) { @@ -152,7 +152,7 @@ bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate, offset = stream.readUint32LE(); #if 0 - printf(" found a '%s' tag of size %d\n", buf, offset); + debug(" found a '%s' tag of size %d", buf, offset); #endif } while (memcmp(buf, "data", 4) != 0); diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp index aa9f8797ba..20d5a4e233 100644 --- a/sound/mididrv.cpp +++ b/sound/mididrv.cpp @@ -209,35 +209,40 @@ MidiDriver::DeviceHandle MidiDriver::detectDevice(int flags) { hdl = getDeviceHandle("auto"); const MusicType type = getMusicType(hdl); - if (type != MT_AUTO && type != MT_INVALID) { - if (flags & MDT_PREFER_MT32) - // If we have a preferred MT32 device we disable the gm/mt32 mapping (more about this in mididrv.h) - _forceTypeMT32 = true; - return hdl; - } + // If have a "Don't use GM/MT-32" setting we skip this part and jump + // to AdLib, PC Speaker etc. detection right away. + if (type != MT_NULL) { + if (type != MT_AUTO && type != MT_INVALID) { + if (flags & MDT_PREFER_MT32) + // If we have a preferred MT32 device we disable the gm/mt32 mapping (more about this in mididrv.h) + _forceTypeMT32 = true; + + return hdl; + } - // If we have no specific device selected (neither in the scummvm nor in the game domain) - // and no preferred MT32 or GM device selected we arrive here. - // If MT32 is preferred we try for the first available device with music type 'MT_MT32' (usually the mt32 emulator) - if (flags & MDT_PREFER_MT32) { + // If we have no specific device selected (neither in the scummvm nor in the game domain) + // and no preferred MT32 or GM device selected we arrive here. + // If MT32 is preferred we try for the first available device with music type 'MT_MT32' (usually the mt32 emulator) + if (flags & MDT_PREFER_MT32) { + for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); ++m) { + MusicDevices i = (**m)->getDevices(); + for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) { + if (d->getMusicType() == MT_MT32) + return d->getHandle(); + } + } + } + + // Now we default to the first available device with music type 'MT_GM' for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); ++m) { MusicDevices i = (**m)->getDevices(); for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) { - if (d->getMusicType() == MT_MT32) + if (d->getMusicType() == MT_GM || d->getMusicType() == MT_GS) return d->getHandle(); } } } - - // Now we default to the first available device with music type 'MT_GM' - for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); ++m) { - MusicDevices i = (**m)->getDevices(); - for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) { - if (d->getMusicType() == MT_GM || d->getMusicType() == MT_GS) - return d->getHandle(); - } - } } MusicType tp = MT_AUTO; diff --git a/sound/mixer.cpp b/sound/mixer.cpp index cb3cc2a0f3..c40aa95d73 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -435,6 +435,7 @@ int MixerImpl::getVolumeForSoundType(SoundType type) const { return _volumeForSoundType[type]; } + #pragma mark - #pragma mark --- Channel implementations --- #pragma mark - diff --git a/sound/mods/tfmx.cpp b/sound/mods/tfmx.cpp index b65a998e82..6ed1abcfb5 100644 --- a/sound/mods/tfmx.cpp +++ b/sound/mods/tfmx.cpp @@ -281,7 +281,7 @@ void Tfmx::macroRun(ChannelContext &channel) { continue; case 0x04: // Wait. Parameters: Ticks to wait(W). - // TODO: some unkown Parameter? (macroPtr[1] & 1) + // TODO: some unknown Parameter? (macroPtr[1] & 1) channel.macroWait = READ_BE_UINT16(¯oPtr[2]); break; @@ -1154,7 +1154,7 @@ void displayMacroStep(const void * const vptr) { if (macroData[0] < ARRAYSIZE(tableMacros)) debug("%s %02X%02X%02X", tableMacros[macroData[0]], macroData[1], macroData[2], macroData[3]); else - debug("Unkown Macro #%02X %02X%02X%02X", macroData[0], macroData[1], macroData[2], macroData[3]); + debug("Unknown Macro #%02X %02X%02X%02X", macroData[0], macroData[1], macroData[2], macroData[3]); } void displayPatternstep(const void * const vptr) { diff --git a/sound/rate_arm.cpp b/sound/rate_arm.cpp index 5bab6ca59d..63008fcb87 100644 --- a/sound/rate_arm.cpp +++ b/sound/rate_arm.cpp @@ -168,18 +168,16 @@ extern "C" int SimpleRate_readFudge(Audio::AudioStream &input, int16 *a, int b) { #ifdef DEBUG_RATECONV - fprintf(stderr, "Reading ptr=%x n%d\n", a, b); - fflush(stderr); + debug("Reading ptr=%x n%d", a, b); #endif - return input.readBuffer(a, b); + return input.readBuffer(a, b); } template<bool stereo, bool reverseStereo> int SimpleRateConverter<stereo, reverseStereo>::flow(AudioStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r) { #ifdef DEBUG_RATECONV -fprintf(stderr, "Simple st=%d rev=%d\n", stereo, reverseStereo); -fflush(stderr); + debug("Simple st=%d rev=%d", stereo, reverseStereo); #endif st_sample_t *ostart = obuf; @@ -318,8 +316,7 @@ template<bool stereo, bool reverseStereo> int LinearRateConverter<stereo, reverseStereo>::flow(AudioStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r) { #ifdef DEBUG_RATECONV -fprintf(stderr, "Linear st=%d rev=%d\n", stereo, reverseStereo); -fflush(stderr); + debug("Linear st=%d rev=%d", stereo, reverseStereo); #endif st_sample_t *ostart = obuf; @@ -393,8 +390,7 @@ public: assert(input.isStereo() == stereo); #ifdef DEBUG_RATECONV -fprintf(stderr, "Copy st=%d rev=%d\n", stereo, reverseStereo); -fflush(stderr); + debug("Copy st=%d rev=%d", stereo, reverseStereo); #endif st_size_t len; st_sample_t *ostart = obuf; diff --git a/sound/softsynth/cms.cpp b/sound/softsynth/cms.cpp index 88f04a1ab9..b307146f14 100644 --- a/sound/softsynth/cms.cpp +++ b/sound/softsynth/cms.cpp @@ -86,35 +86,39 @@ static const int amplitude_lookup[16] = { void CMSEmulator::portWrite(int port, int val) { switch (port) { - case 0x220: - portWriteIntern(0, 1, val); - break; - - case 0x221: - _saa1099[0].selected_reg = val & 0x1f; - if (_saa1099[0].selected_reg == 0x18 || _saa1099[0].selected_reg == 0x19) { - /* clock the envelope channels */ - if (_saa1099[0].env_clock[0]) envelope(0, 0); - if (_saa1099[0].env_clock[1]) envelope(0, 1); - } - break; - - case 0x222: - portWriteIntern(1, 1, val); - break; - - case 0x223: - _saa1099[1].selected_reg = val & 0x1f; - if (_saa1099[1].selected_reg == 0x18 || _saa1099[1].selected_reg == 0x19) { - /* clock the envelope channels */ - if (_saa1099[1].env_clock[0]) envelope(1, 0); - if (_saa1099[1].env_clock[1]) envelope(1, 1); - } - break; + case 0x220: + portWriteIntern(0, 1, val); + break; + + case 0x221: + _saa1099[0].selected_reg = val & 0x1f; + if (_saa1099[0].selected_reg == 0x18 || _saa1099[0].selected_reg == 0x19) { + /* clock the envelope channels */ + if (_saa1099[0].env_clock[0]) + envelope(0, 0); + if (_saa1099[0].env_clock[1]) + envelope(0, 1); + } + break; + + case 0x222: + portWriteIntern(1, 1, val); + break; + + case 0x223: + _saa1099[1].selected_reg = val & 0x1f; + if (_saa1099[1].selected_reg == 0x18 || _saa1099[1].selected_reg == 0x19) { + /* clock the envelope channels */ + if (_saa1099[1].env_clock[0]) + envelope(1, 0); + if (_saa1099[1].env_clock[1]) + envelope(1, 1); + } + break; - default: - warning("CMSEmulator got port: 0x%X", port); - break; + default: + warning("CMSEmulator got port: 0x%X", port); + break; } } @@ -177,10 +181,10 @@ void CMSEmulator::update(int chip, int16 *buffer, int length) { for (ch = 0; ch < 2; ch++) { switch (saa->noise_params[ch]) { - case 0: saa->noise[ch].freq = 31250.0 * 2; break; - case 1: saa->noise[ch].freq = 15625.0 * 2; break; - case 2: saa->noise[ch].freq = 7812.5 * 2; break; - case 3: saa->noise[ch].freq = saa->channels[ch * 3].freq; break; + case 0: saa->noise[ch].freq = 31250.0 * 2; break; + case 1: saa->noise[ch].freq = 15625.0 * 2; break; + case 2: saa->noise[ch].freq = 7812.5 * 2; break; + case 3: saa->noise[ch].freq = saa->channels[ch * 3].freq; break; } } @@ -254,95 +258,95 @@ void CMSEmulator::portWriteIntern(int chip, int offset, int data) { int ch; switch (reg) { - /* channel i amplitude */ - case 0x00: - case 0x01: - case 0x02: - case 0x03: - case 0x04: - case 0x05: - ch = reg & 7; - saa->channels[ch].amplitude[LEFT] = amplitude_lookup[data & 0x0f]; - saa->channels[ch].amplitude[RIGHT] = amplitude_lookup[(data >> 4) & 0x0f]; - break; - - /* channel i frequency */ - case 0x08: - case 0x09: - case 0x0a: - case 0x0b: - case 0x0c: - case 0x0d: - ch = reg & 7; - saa->channels[ch].frequency = data & 0xff; - break; - - /* channel i octave */ - case 0x10: - case 0x11: - case 0x12: - ch = (reg - 0x10) << 1; - saa->channels[ch + 0].octave = data & 0x07; - saa->channels[ch + 1].octave = (data >> 4) & 0x07; - break; - - /* channel i frequency enable */ - case 0x14: - saa->channels[0].freq_enable = data & 0x01; - saa->channels[1].freq_enable = data & 0x02; - saa->channels[2].freq_enable = data & 0x04; - saa->channels[3].freq_enable = data & 0x08; - saa->channels[4].freq_enable = data & 0x10; - saa->channels[5].freq_enable = data & 0x20; - break; - - /* channel i noise enable */ - case 0x15: - saa->channels[0].noise_enable = data & 0x01; - saa->channels[1].noise_enable = data & 0x02; - saa->channels[2].noise_enable = data & 0x04; - saa->channels[3].noise_enable = data & 0x08; - saa->channels[4].noise_enable = data & 0x10; - saa->channels[5].noise_enable = data & 0x20; - break; - - /* noise generators parameters */ - case 0x16: - saa->noise_params[0] = data & 0x03; - saa->noise_params[1] = (data >> 4) & 0x03; - break; - - /* envelope generators parameters */ - case 0x18: - case 0x19: - ch = reg - 0x18; - saa->env_reverse_right[ch] = data & 0x01; - saa->env_mode[ch] = (data >> 1) & 0x07; - saa->env_bits[ch] = data & 0x10; - saa->env_clock[ch] = data & 0x20; - saa->env_enable[ch] = data & 0x80; - /* reset the envelope */ - saa->env_step[ch] = 0; - break; - - /* channels enable & reset generators */ - case 0x1c: - saa->all_ch_enable = data & 0x01; - saa->sync_state = data & 0x02; - if (data & 0x02) { - int i; - /* Synch & Reset generators */ - for (i = 0; i < 6; i++) { - saa->channels[i].level = 0; - saa->channels[i].counter = 0.0; - } + /* channel i amplitude */ + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + ch = reg & 7; + saa->channels[ch].amplitude[LEFT] = amplitude_lookup[data & 0x0f]; + saa->channels[ch].amplitude[RIGHT] = amplitude_lookup[(data >> 4) & 0x0f]; + break; + + /* channel i frequency */ + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + case 0x0c: + case 0x0d: + ch = reg & 7; + saa->channels[ch].frequency = data & 0xff; + break; + + /* channel i octave */ + case 0x10: + case 0x11: + case 0x12: + ch = (reg - 0x10) << 1; + saa->channels[ch + 0].octave = data & 0x07; + saa->channels[ch + 1].octave = (data >> 4) & 0x07; + break; + + /* channel i frequency enable */ + case 0x14: + saa->channels[0].freq_enable = data & 0x01; + saa->channels[1].freq_enable = data & 0x02; + saa->channels[2].freq_enable = data & 0x04; + saa->channels[3].freq_enable = data & 0x08; + saa->channels[4].freq_enable = data & 0x10; + saa->channels[5].freq_enable = data & 0x20; + break; + + /* channel i noise enable */ + case 0x15: + saa->channels[0].noise_enable = data & 0x01; + saa->channels[1].noise_enable = data & 0x02; + saa->channels[2].noise_enable = data & 0x04; + saa->channels[3].noise_enable = data & 0x08; + saa->channels[4].noise_enable = data & 0x10; + saa->channels[5].noise_enable = data & 0x20; + break; + + /* noise generators parameters */ + case 0x16: + saa->noise_params[0] = data & 0x03; + saa->noise_params[1] = (data >> 4) & 0x03; + break; + + /* envelope generators parameters */ + case 0x18: + case 0x19: + ch = reg - 0x18; + saa->env_reverse_right[ch] = data & 0x01; + saa->env_mode[ch] = (data >> 1) & 0x07; + saa->env_bits[ch] = data & 0x10; + saa->env_clock[ch] = data & 0x20; + saa->env_enable[ch] = data & 0x80; + /* reset the envelope */ + saa->env_step[ch] = 0; + break; + + /* channels enable & reset generators */ + case 0x1c: + saa->all_ch_enable = data & 0x01; + saa->sync_state = data & 0x02; + if (data & 0x02) { + int i; + /* Synch & Reset generators */ + for (i = 0; i < 6; i++) { + saa->channels[i].level = 0; + saa->channels[i].counter = 0.0; } - break; + } + break; - default: - // The CMS allows all registers to be written, so we just output some debug - // message here - debug(5, "CMS Unkown write to reg %x with %x",reg, data); + default: + // The CMS allows all registers to be written, so we just output some debug + // message here + debug(5, "CMS Unknown write to reg %x with %x",reg, data); } } diff --git a/sound/softsynth/fmtowns_pc98/towns_audio.cpp b/sound/softsynth/fmtowns_pc98/towns_audio.cpp index e6da237881..a9e67c5266 100644 --- a/sound/softsynth/fmtowns_pc98/towns_audio.cpp +++ b/sound/softsynth/fmtowns_pc98/towns_audio.cpp @@ -225,7 +225,6 @@ TownsAudioInterface::TownsAudioInterface(Audio::Mixer *mixer, TownsAudioInterfac } TownsAudioInterface::~TownsAudioInterface() { - reset(); _ready = false; deinit(); diff --git a/sound/softsynth/fmtowns_pc98/towns_euphony.cpp b/sound/softsynth/fmtowns_pc98/towns_euphony.cpp index 7b52b4594f..e6f94b29b5 100644 --- a/sound/softsynth/fmtowns_pc98/towns_euphony.cpp +++ b/sound/softsynth/fmtowns_pc98/towns_euphony.cpp @@ -36,17 +36,15 @@ TownsEuphonyDriver::TownsEuphonyDriver(Audio::Mixer *mixer) : _activeChannels(0) } TownsEuphonyDriver::~TownsEuphonyDriver() { + delete _intf; delete[] _activeChannels; delete[] _sustainChannels; delete[] _assignedChannels; - delete[] _tEnable; delete[] _tMode; delete[] _tOrdr; delete[] _tLevel; delete[] _tTranspose; - - delete _intf; } bool TownsEuphonyDriver::init() { diff --git a/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp b/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp index 8047616dbf..303f08e6b1 100644 --- a/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp +++ b/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp @@ -1053,7 +1053,6 @@ TownsPC98_AudioDriver::TownsPC98_AudioDriver(Audio::Mixer *mixer, EmuType type) } TownsPC98_AudioDriver::~TownsPC98_AudioDriver() { - reset(); _ready = false; deinit(); diff --git a/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp b/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp index e779812c42..62f7d39771 100644 --- a/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp +++ b/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp @@ -1180,7 +1180,6 @@ int TownsPC98_FmSynth::readBuffer(int16 *buffer, const int numSamples) { void TownsPC98_FmSynth::deinit() { _ready = false; _mixer->stopHandle(_soundHandle); - Common::StackLock lock(_mutex); _timers[0].cb = _timers[1].cb = &TownsPC98_FmSynth::idleTimerCallback; } diff --git a/sound/softsynth/mt32/mt32_file.cpp b/sound/softsynth/mt32/mt32_file.cpp index f4eba73d33..ce5c2874c4 100644 --- a/sound/softsynth/mt32/mt32_file.cpp +++ b/sound/softsynth/mt32/mt32_file.cpp @@ -19,6 +19,12 @@ * IN THE SOFTWARE. */ + +// FIXME: Disable symbol overrides so that we can use system headers. +// But we *really* should get rid of this usage of FILE, fopen etc. +#define FORBIDDEN_SYMBOL_ALLOW_ALL + + #include <stdio.h> #include "mt32emu.h" @@ -37,15 +43,15 @@ namespace MT32Emu { } void ANSIFile::close() { - fclose(fp); + fclose((FILE *)fp); } size_t ANSIFile::read(void *in, size_t size) { - return fread(in, 1, size, fp); + return fread(in, 1, size, (FILE *)fp); } bool ANSIFile::readBit8u(Bit8u *in) { - int c = fgetc(fp); + int c = fgetc((FILE *)fp); if (c == EOF) return false; *in = (Bit8u)c; @@ -69,11 +75,11 @@ namespace MT32Emu { } size_t ANSIFile::write(const void *out, size_t size) { - return fwrite(out, 1, size, fp); + return fwrite(out, 1, size, (FILE *)fp); } bool ANSIFile::writeBit8u(Bit8u out) { - return fputc(out, fp) != EOF; + return fputc(out, (FILE *)fp) != EOF; } bool File::writeBit16u(Bit16u out) { @@ -103,6 +109,6 @@ namespace MT32Emu { } bool ANSIFile::isEOF() { - return feof(fp) != 0; + return feof((FILE *)fp) != 0; } } diff --git a/sound/softsynth/mt32/mt32_file.h b/sound/softsynth/mt32/mt32_file.h index 27c8ccbe46..b311ad9626 100644 --- a/sound/softsynth/mt32/mt32_file.h +++ b/sound/softsynth/mt32/mt32_file.h @@ -49,7 +49,7 @@ public: class ANSIFile: public File { private: - FILE *fp; + void *fp; public: bool open(const char *filename, OpenMode mode); void close(); diff --git a/sound/softsynth/mt32/tables.cpp b/sound/softsynth/mt32/tables.cpp index b0414154dc..722a5e3c41 100644 --- a/sound/softsynth/mt32/tables.cpp +++ b/sound/softsynth/mt32/tables.cpp @@ -587,7 +587,7 @@ File *Tables::initNote(Synth *synth, NoteLookup *noteLookup, float note, float r initSaw(noteLookup, noteLookup->div2); //synth->printDebug("Note %f; freq=%f, div=%f", note, freq, rate / freq); - file = initWave(synth, noteLookup, (const float)WGAMP, div2, file); + file = initWave(synth, noteLookup, WGAMP, div2, file); // Create the pitch tables if (noteLookup->wavTable == NULL) |