diff options
author | Strangerke | 2013-06-26 23:11:34 +0200 |
---|---|---|
committer | Strangerke | 2013-06-26 23:11:34 +0200 |
commit | 6e2d567bca53b6ffee771b4105e2e73dbd73f5b4 (patch) | |
tree | 9880f0c496263ffb6928248d495ce4172dabed18 /audio/mods | |
parent | ac387835e4527c1814919093b4e4bc9798d5742d (diff) | |
parent | 6716fa39a6fb2a3925576288c256688c5aadd7e9 (diff) | |
download | scummvm-rg350-6e2d567bca53b6ffee771b4105e2e73dbd73f5b4.tar.gz scummvm-rg350-6e2d567bca53b6ffee771b4105e2e73dbd73f5b4.tar.bz2 scummvm-rg350-6e2d567bca53b6ffee771b4105e2e73dbd73f5b4.zip |
Merge branch 'master' of https://github.com/scummvm/scummvm into mortevielle
Conflicts:
engines/engines.mk
Diffstat (limited to 'audio/mods')
-rw-r--r-- | audio/mods/maxtrax.cpp | 6 | ||||
-rw-r--r-- | audio/mods/maxtrax.h | 2 | ||||
-rw-r--r-- | audio/mods/paula.cpp | 9 | ||||
-rw-r--r-- | audio/mods/protracker.cpp | 16 | ||||
-rw-r--r-- | audio/mods/protracker.h | 8 | ||||
-rw-r--r-- | audio/mods/tfmx.cpp | 2 | ||||
-rw-r--r-- | audio/mods/tfmx.h | 2 |
7 files changed, 35 insertions, 10 deletions
diff --git a/audio/mods/maxtrax.cpp b/audio/mods/maxtrax.cpp index 8ed51ae5c3..a2d470cdbf 100644 --- a/audio/mods/maxtrax.cpp +++ b/audio/mods/maxtrax.cpp @@ -105,7 +105,7 @@ inline uint32 pow2Fixed(int32 val) { } #endif -} // End of namespace +} // End of anonymous namespace namespace Audio { @@ -211,7 +211,7 @@ void MaxTrax::interrupt() { goto endOfEventLoop; case 0xA0: // SPECIAL - switch (curEvent->stopTime >> 8){ + switch (curEvent->stopTime >> 8) { case 0x01: // SPECIAL_SYNC _playerCtx.syncCallBack(curEvent->stopTime & 0xFF); break; @@ -1032,6 +1032,6 @@ void MaxTrax::outPutEvent(const Event &ev, int num) {} void MaxTrax::outPutScore(const Score &sc, int num) {} #endif // #ifndef NDEBUG -} // End of namespace Audio +} // End of namespace Audio #endif // #if defined(AUDIO_MODS_MAXTRAX_H) diff --git a/audio/mods/maxtrax.h b/audio/mods/maxtrax.h index ffb176c241..8288aef186 100644 --- a/audio/mods/maxtrax.h +++ b/audio/mods/maxtrax.h @@ -214,6 +214,6 @@ private: static void outPutEvent(const Event &ev, int num = -1); static void outPutScore(const Score &sc, int num = -1); }; -} // End of namespace Audio +} // End of namespace Audio #endif // !defined(AUDIO_MODS_MAXTRAX_H) diff --git a/audio/mods/paula.cpp b/audio/mods/paula.cpp index 4b49d6e750..d655428ed0 100644 --- a/audio/mods/paula.cpp +++ b/audio/mods/paula.cpp @@ -132,7 +132,14 @@ int Paula::readBufferIntern(int16 *buffer, const int numSamples) { Channel &ch = _voice[voice]; int16 *p = buffer; int neededSamples = nSamples; - assert(ch.offset.int_off < ch.length); + + // NOTE: A Protracker (or other module format) player might actually + // push the offset past the sample length in its interrupt(), in which + // case the first mixBuffer() call should not mix anything, and the loop + // should be triggered. + // Thus, doing an assert(ch.offset.int_off < ch.length) here is wrong. + // An example where this happens is a certain Protracker module played + // by the OS/2 version of Hopkins FBI. // Mix the generated samples into the output buffer neededSamples -= mixBuffer<stereo>(p, ch.data, ch.offset, rate, neededSamples, ch.length, ch.volume, ch.panning); diff --git a/audio/mods/protracker.cpp b/audio/mods/protracker.cpp index 1e18d5adf8..c947f256e0 100644 --- a/audio/mods/protracker.cpp +++ b/audio/mods/protracker.cpp @@ -90,6 +90,14 @@ private: public: ProtrackerStream(Common::SeekableReadStream *stream, int offs, int rate, bool stereo); + Modules::Module *getModule() { + // Ordinarily, the Module is not meant to be seen outside of + // this class, but occasionally, it's useful to be able to + // manipulate it directly. The Hopkins engine uses this to + // repair a broken song. + return &_module; + } + private: void interrupt(); @@ -462,8 +470,12 @@ void ProtrackerStream::interrupt() { namespace Audio { -AudioStream *makeProtrackerStream(Common::SeekableReadStream *stream, int offs, int rate, bool stereo) { - return new Modules::ProtrackerStream(stream, offs, rate, stereo); +AudioStream *makeProtrackerStream(Common::SeekableReadStream *stream, int offs, int rate, bool stereo, Modules::Module **module) { + Modules::ProtrackerStream *protrackerStream = new Modules::ProtrackerStream(stream, offs, rate, stereo); + if (module) { + *module = protrackerStream->getModule(); + } + return (AudioStream *)protrackerStream; } } // End of namespace Audio diff --git a/audio/mods/protracker.h b/audio/mods/protracker.h index 5f47c4453b..50528fc599 100644 --- a/audio/mods/protracker.h +++ b/audio/mods/protracker.h @@ -26,6 +26,7 @@ * - agos * - parallaction * - gob + * - hopkins */ #ifndef AUDIO_MODS_PROTRACKER_H @@ -35,6 +36,10 @@ namespace Common { class SeekableReadStream; } +namespace Modules { +class Module; +} + namespace Audio { class AudioStream; @@ -48,9 +53,10 @@ class AudioStream; * @param stream the ReadStream from which to read the ProTracker data * @param rate TODO * @param stereo TODO + * @param module can be used to return the Module object (rarely useful) * @return a new AudioStream, or NULL, if an error occurred */ -AudioStream *makeProtrackerStream(Common::SeekableReadStream *stream, int offs = 0, int rate = 44100, bool stereo = true); +AudioStream *makeProtrackerStream(Common::SeekableReadStream *stream, int offs = 0, int rate = 44100, bool stereo = true, Modules::Module **module = 0); } // End of namespace Audio diff --git a/audio/mods/tfmx.cpp b/audio/mods/tfmx.cpp index 2957529afc..5829ab5fda 100644 --- a/audio/mods/tfmx.cpp +++ b/audio/mods/tfmx.cpp @@ -1095,7 +1095,7 @@ int Tfmx::doSfx(uint16 sfxIndex, bool unlockChannel) { return -1; } -} // End of namespace Audio +} // End of namespace Audio // some debugging functions #if 0 diff --git a/audio/mods/tfmx.h b/audio/mods/tfmx.h index ebe1172278..a8852d7963 100644 --- a/audio/mods/tfmx.h +++ b/audio/mods/tfmx.h @@ -273,6 +273,6 @@ private: void noteCommand(uint8 note, uint8 param1, uint8 param2, uint8 param3); }; -} // End of namespace Audio +} // End of namespace Audio #endif // !defined(AUDIO_MODS_TFMX_H) |