Ticket #3053: sky-adlib.diff

File sky-adlib.diff, 2.5 KB (added by eriktorbjorn, 18 years ago)

Patch against 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

     
    5353        virtual void setupPointers(void);
    5454        virtual void setupChannels(uint8 *channelData);
    5555        virtual void startDriver(void);
     56        virtual void setVolume(uint16 param);
    5657
    5758        void premixerCall(int16 *buf, uint len);
    5859};
  • 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) {
     
    107107        for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++) {
    108108                uint16 chDataStart = ((channelData[(cnt << 1) | 1] << 8) | channelData[cnt << 1]) + _musicDataLoc;
    109109                _channels[cnt] = new AdlibChannel(_opl, _musicData, chDataStart);
    110                 _channels[cnt]->updateVolume(_musicVolume);
    111110        }
    112111}
    113112
     113void AdlibMusic::setVolume(uint16 param) {
     114        _musicVolume = param;
     115        _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, 2 * param);
     116}
     117
    114118void AdlibMusic::startDriver(void) {
    115119
    116120        uint16 cnt = 0;