Ticket #3053: sky-adlib2.diff

File sky-adlib2.diff, 2.9 KB (added by eriktorbjorn, 14 years ago)

Updated patch against even more current SVN

  • engines/sky/music/musicbase.h

     
    5858        bool musicIsPlaying(void);
    5959        uint8 giveVolume(void) { return (uint8)_musicVolume; };
    6060        uint8 giveCurrentMusic(void) { return _currentMusic; };
    61         void setVolume(uint16 param);
     61        virtual void setVolume(uint16 param);
    6262
    6363protected:
    6464
  • engines/sky/music/adlibmusic.h

     
    5050        virtual void setupPointers(void);
    5151        virtual void setupChannels(uint8 *channelData);
    5252        virtual void startDriver(void);
     53        virtual void setVolume(uint16 param);
    5354
    5455        void premixerCall(int16 *buf, uint len);
    5556};
  • engines/sky/music/adlibchannel.cpp

     
    8585}
    8686
    8787void AdlibChannel::updateVolume(uint16 pVolume) {
    88         pVolume = (pVolume * 3) >> 1;
    89         if (pVolume > 0x7F)
    90                 pVolume = 0x7F;
    91         _musicVolume = pVolume | 128;
     88
     89        // Do nothing. The mixer handles the music volume for us.
    9290}
    9391
    9492/*      This class uses the same area for the register mirror as the original
  • engines/sky/music/adlibmusic.cpp

     
    3939
    4040        _opl = makeAdlibOPL(_sampleRate);
    4141
    42         _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, false, true);
     42        _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, false, true);
    4343}
    4444
    4545AdlibMusic::~AdlibMusic(void) {
     
    102102        for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++) {
    103103                uint16 chDataStart = ((channelData[(cnt << 1) | 1] << 8) | channelData[cnt << 1]) + _musicDataLoc;
    104104                _channels[cnt] = new AdlibChannel(_opl, _musicData, chDataStart);
    105                 _channels[cnt]->updateVolume(_musicVolume);
    106105        }
    107106}
    108107
     108void AdlibMusic::setVolume(uint16 param) {
     109        _musicVolume = param;
     110        _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, 2 * param);
     111}
     112
    109113void AdlibMusic::startDriver(void) {
    110114
    111115        uint16 cnt = 0;
  • engines/sky/control.cpp

     
    678678                        if (volume >= 128) volume = 0;
    679679                        else volume = 127 - volume;
    680680                        _skyMusic->setVolume(volume);
     681                        ConfMan.setInt("music_volume", 2 * volume);
    681682                }
    682683                buttonControl(_slide2);
    683684                _text->drawToScreen(WITH_MASK);