Ticket #2688: samplerate.diff

File samplerate.diff, 1.9 KB (added by eriktorbjorn, 18 years ago)

Patch against current SVN

  • engines/sky/sound.h

     
    8383        Disk *_skyDisk;
    8484        uint16 _sfxBaseOfs;
    8585        uint8 *_soundData;
    86         uint8 *_sfxInfo;
     86        uint8 *_sampleRates, *_sfxInfo;
    8787        uint8 _mainSfxVolume;
    8888
    8989        static uint16 _speechConvertTable[8];
  • engines/sky/sound.cpp

     
    10701070                        error("Unknown sounddriver version!");
    10711071
    10721072        _soundsTotal = _soundData[asmOfs + 1];
     1073        uint16 sRateTabOfs = READ_LE_UINT16(_soundData + asmOfs + 0x29);
    10731074        _sfxBaseOfs = READ_LE_UINT16(_soundData + asmOfs + 0x31);
     1075        _sampleRates = _soundData + sRateTabOfs;
    10741076
    10751077        _sfxInfo = _soundData + _sfxBaseOfs;
    10761078        // if we just restored a savegame, the sfxqueue holds the sound we need to restart
     
    11001102        sound &= 0xFF;
    11011103
    11021104        // note: all those tables are big endian. Don't ask me why. *sigh*
     1105        uint16 sampleRate = READ_BE_UINT16(_sampleRates + (sound << 2));
     1106        if (sampleRate > 11025)
     1107                sampleRate = 11025;
    11031108        uint32 dataOfs  = READ_BE_UINT16(_sfxInfo + (sound << 3) + 0) << 4;
    11041109        uint32 dataSize = READ_BE_UINT16(_sfxInfo + (sound << 3) + 2);
    11051110        uint32 dataLoop = READ_BE_UINT16(_sfxInfo + (sound << 3) + 6);
     
    11151120        }
    11161121
    11171122        if (channel == 0)
    1118                 _mixer->playRaw(&_ingameSound0, _soundData + dataOfs, dataSize, 11025, flags, SOUND_CH0, volume, 0, loopSta, loopEnd);
     1123                _mixer->playRaw(&_ingameSound0, _soundData + dataOfs, dataSize, sampleRate, flags, SOUND_CH0, volume, 0, loopSta, loopEnd);
    11191124        else
    1120                 _mixer->playRaw(&_ingameSound1, _soundData + dataOfs, dataSize, 11025, flags, SOUND_CH1, volume, 0, loopSta, loopEnd);
     1125                _mixer->playRaw(&_ingameSound1, _soundData + dataOfs, dataSize, sampleRate, flags, SOUND_CH1, volume, 0, loopSta, loopEnd);
    11211126}
    11221127
    11231128void Sound::fnStartFx(uint32 sound, uint8 channel) {