Ticket #3590: queen-sound1.diff

File queen-sound1.diff, 4.3 KB (added by eriktorbjorn, 12 years ago)

Patch against current SVN

  • sound/mixer.cpp

     
    6363        AudioStream *_input;
    6464
    6565public:
    66         Channel(Mixer *mixer, Mixer::SoundType type, AudioStream *input, bool autofreeStream, bool reverseStereo = false, int id = -1, bool permanent = false);
     66        Channel(Mixer *mixer, Mixer::SoundType type, AudioStream *input, bool autofreeStream, bool reverseStereo = false, int id = -1, bool permanent = false, uint rate = 0);
    6767        virtual ~Channel();
    6868
    6969        void mix(int16 *data, uint len);
     
    179179                        int id, byte volume, int8 balance,
    180180                        bool autofreeStream,
    181181                        bool permanent,
    182                         bool reverseStereo) {
     182                        bool reverseStereo,
     183                        uint rate) {
    183184        Common::StackLock lock(_mutex);
    184185
    185186        if (input == 0) {
     
    198199        }
    199200
    200201        // Create the channel
    201         Channel *chan = new Channel(this, type, input, autofreeStream, reverseStereo, id, permanent);
     202        Channel *chan = new Channel(this, type, input, autofreeStream, reverseStereo, id, permanent, rate);
    202203        chan->setVolume(volume);
    203204        chan->setBalance(balance);
    204205        insertChannel(handle, chan);
     
    379380
    380381
    381382Channel::Channel(Mixer *mixer, Mixer::SoundType type, AudioStream *input,
    382                                 bool autofreeStream, bool reverseStereo, int id, bool permanent)
     383                                bool autofreeStream, bool reverseStereo, int id, bool permanent,
     384                                uint rate)
    383385        : _type(type), _mixer(mixer), _autofreeStream(autofreeStream),
    384386          _volume(Mixer::kMaxChannelVolume), _balance(0), _pauseLevel(0), _id(id), _samplesConsumed(0),
    385387          _samplesDecoded(0), _mixerTimeStamp(0), _converter(0), _input(input), _permanent(permanent) {
     
    387389        assert(input);
    388390
    389391        // Get a rate converter instance
    390         _converter = makeRateConverter(_input->getRate(), mixer->getOutputRate(), _input->isStereo(), reverseStereo);
     392        if (rate == 0)
     393                rate = _input->getRate();
     394        _converter = makeRateConverter(rate, mixer->getOutputRate(), _input->isStereo(), reverseStereo);
    391395}
    392396
    393397Channel::~Channel() {
  • sound/mixer_intern.h

     
    8888                int id = -1, byte volume = 255, int8 balance = 0,
    8989                bool autofreeStream = true,
    9090                bool permanent = false,
    91                 bool reverseStereo = false);
     91                bool reverseStereo = false,
     92                uint rate = 0);
    9293
    9394
    9495
  • sound/mixer.h

     
    165165                int id = -1, byte volume = kMaxChannelVolume, int8 balance = 0,
    166166                bool autofreeStream = true,
    167167                bool permanent = false,
    168                 bool reverseStereo = false) = 0;
     168                bool reverseStereo = false,
     169                uint rate = 0) = 0;
    169170
    170171
    171172
  • engines/queen/sound.cpp

     
    6969        void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
    7070                Common::MemoryReadStream *tmp = f->readStream(size);
    7171                assert(tmp);
    72                 _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeMP3Stream(tmp, true));
     72                _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeMP3Stream(tmp, true), -1, Audio::Mixer::kMaxChannelVolume, 0, true, false, false, 11840);
    7373        }
    7474};
    7575#endif
     
    8282        void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
    8383                Common::MemoryReadStream *tmp = f->readStream(size);
    8484                assert(tmp);
    85                 _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeVorbisStream(tmp, true));
     85                _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeVorbisStream(tmp, true), -1, Audio::Mixer::kMaxChannelVolume, 0, true, false, false, 11840);
    8686        }
    8787};
    8888#endif
     
    9595        void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
    9696                Common::MemoryReadStream *tmp = f->readStream(size);
    9797                assert(tmp);
    98                 _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeFlacStream(tmp, true));
     98                _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeFlacStream(tmp, true), -1, Audio::Mixer::kMaxChannelVolume, 0, true, false, false, 11840);
    9999        }
    100100};
    101101#endif // #ifdef USE_FLAC