From 9785d5007a7754ab988b51a8780d6a3dcc80dce4 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 18 Jan 2019 19:19:25 +0100 Subject: ZVISION: Boost volume for MPEG cutscenes The high-resolution videos play back at much lower volume than the original ones. This adds hard-coded values for how much to amplify each cutscene. It's all done by ear, and it does introduce some clipping, but I think it should be acceptable. Of course, it could also be a problem with the audio decoder, so this may be the wrong approach entirely. --- video/mpegps_decoder.cpp | 9 +++++---- video/mpegps_decoder.h | 6 ++++-- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'video') diff --git a/video/mpegps_decoder.cpp b/video/mpegps_decoder.cpp index 361481b739..9b232ec792 100644 --- a/video/mpegps_decoder.cpp +++ b/video/mpegps_decoder.cpp @@ -50,7 +50,8 @@ enum { kStartCodePrivateStream2 = 0x1BF }; -MPEGPSDecoder::MPEGPSDecoder() { +MPEGPSDecoder::MPEGPSDecoder(double decibel) { + _decibel = decibel; _demuxer = new MPEGPSDemuxer(); } @@ -104,7 +105,7 @@ MPEGPSDecoder::MPEGStream *MPEGPSDecoder::getStream(uint32 startCode, Common::Se #ifdef USE_A52 handled = true; - AC3AudioTrack *ac3Track = new AC3AudioTrack(*packet, getSoundType()); + AC3AudioTrack *ac3Track = new AC3AudioTrack(*packet, _decibel, getSoundType()); stream = ac3Track; _streamMap[startCode] = ac3Track; addTrack(ac3Track); @@ -704,9 +705,9 @@ Audio::AudioStream *MPEGPSDecoder::MPEGAudioTrack::getAudioStream() const { #ifdef USE_A52 -MPEGPSDecoder::AC3AudioTrack::AC3AudioTrack(Common::SeekableReadStream &firstPacket, Audio::Mixer::SoundType soundType) : +MPEGPSDecoder::AC3AudioTrack::AC3AudioTrack(Common::SeekableReadStream &firstPacket, double decibel, Audio::Mixer::SoundType soundType) : AudioTrack(soundType) { - _audStream = Audio::makeAC3Stream(firstPacket); + _audStream = Audio::makeAC3Stream(firstPacket, decibel); if (!_audStream) error("Could not create AC-3 stream"); } diff --git a/video/mpegps_decoder.h b/video/mpegps_decoder.h index bd703a35ff..7960639d78 100644 --- a/video/mpegps_decoder.h +++ b/video/mpegps_decoder.h @@ -54,7 +54,7 @@ namespace Video { */ class MPEGPSDecoder : public VideoDecoder { public: - MPEGPSDecoder(); + MPEGPSDecoder(double decibel = 0.0); virtual ~MPEGPSDecoder(); bool loadStream(Common::SeekableReadStream *stream); @@ -166,7 +166,7 @@ private: #ifdef USE_A52 class AC3AudioTrack : public AudioTrack, public MPEGStream { public: - AC3AudioTrack(Common::SeekableReadStream &firstPacket, Audio::Mixer::SoundType soundType); + AC3AudioTrack(Common::SeekableReadStream &firstPacket, double decibel, Audio::Mixer::SoundType soundType); ~AC3AudioTrack(); bool sendPacket(Common::SeekableReadStream *packet, uint32 pts, uint32 dts); @@ -199,6 +199,8 @@ private: // A map from stream types to stream handlers typedef Common::HashMap StreamMap; StreamMap _streamMap; + + double _decibel; }; } // End of namespace Video -- cgit v1.2.3