Ticket #9071: scummvm_siddump.patch

File scummvm_siddump.patch, 6.9 KB (added by SF/tobigun, 15 years ago)

music/sound dump patch for ScummVM

  • engines/engine.h

     
    7272        OSystem *_system;
    7373        Audio::Mixer *_mixer;
    7474
     75        const Common::String _targetName; // target name for saves
     76
    7577protected:
    7678        Common::TimerManager *_timer;
    7779        Common::EventManager *_eventMan;
     
    8082        GUI::Dialog *_mainMenuDialog;
    8183        virtual int runDialog(GUI::Dialog &dialog);
    8284
    83         const Common::String _targetName; // target name for saves
    8485
    8586        const Common::FSNode _gameDataDir;      // FIXME: Get rid of this
    8687
  • engines/scumm/player_v0.cpp

     
     1/* ScummVM - Graphic Adventure Engine
     2 *
     3 * ScummVM is the legal property of its developers, whose names
     4 * are too numerous to list here. Please refer to the COPYRIGHT
     5 * file distributed with this source distribution.
     6 *
     7 * This program is free software; you can redistribute it and/or
     8 * modify it under the terms of the GNU General Public License
     9 * as published by the Free Software Foundation; either version 2
     10 * of the License, or (at your option) any later version.
     11
     12 * This program is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
     20 *
     21 * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/engines/scumm/player_v1.cpp $
     22 * $Id: player_v1.cpp 28966 2007-09-19 08:40:12Z peres001 $
     23 *
     24 */
     25
     26
     27#include "engines/engine.h"
     28#include "scumm/Player_v0.h"
     29#include "scumm/scumm.h"
     30#include "sound/mixer.h"
     31
     32namespace Scumm {
     33
     34Player_V0::Player_V0(ScummEngine *scumm, Audio::Mixer *mixer) {
     35        _vm = scumm;
     36        _mixer = mixer;
     37        _sample_rate = _mixer->getOutputRate();
     38
     39        _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, false, true);
     40}
     41
     42Player_V0::~Player_V0() {
     43        _mixer->stopHandle(_soundHandle);
     44}
     45
     46void Player_V0::setMusicVolume (int vol) {
     47        _maxvol = vol;
     48}
     49
     50int Player_V0::readBuffer(int16 *buffer, const int numSamples) {
     51        return 0;
     52}
     53void Player_V0::stopAllSounds() {
     54}
     55
     56void Player_V0::stopSound(int nr) {
     57        if (nr == -1)
     58                return;
     59}
     60
     61void Player_V0::startSound(int nr) {
     62        char sbuf[512];
     63        byte *data = _vm->getResourceAddress(rtSound, nr);
     64        assert(data);
     65
     66        int size = _vm->getResourceSize(rtSound, nr);
     67        sprintf(sbuf, "%s-%d.bin", _vm->_targetName.c_str(), nr);
     68        FILE* f = fopen(sbuf, "wb");
     69        fwrite(data, size, 1, f);
     70        fclose(f);
     71}
     72
     73int Player_V0::getSoundStatus(int nr) const {
     74        return 0;
     75}
     76
     77} // End of namespace Scumm
  • engines/scumm/player_v0.h

     
     1/* ScummVM - Graphic Adventure Engine
     2 *
     3 * ScummVM is the legal property of its developers, whose names
     4 * are too numerous to list here. Please refer to the COPYRIGHT
     5 * file distributed with this source distribution.
     6 *
     7 * This program is free software; you can redistribute it and/or
     8 * modify it under the terms of the GNU General Public License
     9 * as published by the Free Software Foundation; either version 2
     10 * of the License, or (at your option) any later version.
     11
     12 * This program is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
     20 *
     21 * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/engines/scumm/player_v1.h $
     22 * $Id: player_v1.h 27024 2007-05-30 21:56:52Z fingolfin $
     23 *
     24 */
     25
     26#ifndef SCUMM_PLAYER_V0_H
     27#define SCUMM_PLAYER_V0_H
     28
     29#include "common/scummsys.h"
     30#include "scumm/music.h"
     31#include "sound/audiostream.h"
     32#include "sound/mixer.h"
     33
     34namespace Scumm {
     35
     36class ScummEngine;
     37
     38/**
     39 * Scumm V0/V1 SID player.
     40 */
     41class Player_V0 : public Audio::AudioStream, public MusicEngine {
     42public:
     43        Player_V0(ScummEngine *scumm, Audio::Mixer *mixer);
     44        ~Player_V0();
     45
     46        virtual void setMusicVolume(int vol);
     47        virtual void startSound(int sound);
     48        virtual void stopSound(int sound);
     49        virtual void stopAllSounds();
     50        virtual int  getSoundStatus(int sound) const;
     51
     52        // AudioStream API
     53        int readBuffer(int16 *buffer, const int numSamples);
     54        bool isStereo() const { return false; }
     55        bool endOfData() const { return false; }
     56        int getRate() const { return _sample_rate; }
     57
     58private:
     59
     60        ScummEngine *_vm;
     61        Audio::Mixer *_mixer;
     62        Audio::SoundHandle _soundHandle;
     63        int _sample_rate;
     64        int _samples_per_frame;
     65        int _current_sample;
     66        int _maxvol;
     67};
     68
     69} // End of namespace Scumm
     70
     71#endif
  • engines/scumm/scumm.cpp

     
    5252#include "scumm/he/sound_he.h"
    5353#include "scumm/object.h"
    5454#include "scumm/player_nes.h"
     55#include "scumm/player_v0.h"
    5556#include "scumm/player_v1.h"
    5657#include "scumm/player_v2.h"
    5758#include "scumm/player_v2a.h"
     
    16751676        } else if (_game.platform == Common::kPlatformApple2GS && _game.version == 0){
    16761677                // TODO: Add support for music format
    16771678        } else if (_game.platform == Common::kPlatformC64 && _game.version <= 1) {
    1678                 // TODO: Add support for music format
     1679                _musicEngine = new Player_V0(this, _mixer);
    16791680        } else if (_game.platform == Common::kPlatformNES && _game.version == 1) {
    16801681                _musicEngine = new Player_NES(this, _mixer);
    16811682        } else if (_game.platform == Common::kPlatformAmiga && _game.version == 2) {
  • engines/scumm/scumm.h

     
    789789//      byte *createResource(int type, int index, uint32 size);
    790790        int loadResource(int type, int i);
    791791//      void nukeResource(int type, int i);
    792         int getResourceSize(int type, int idx);
    793792
    794793public:
     794        int getResourceSize(int type, int idx);
    795795        byte *getResourceAddress(int type, int i);
    796796        virtual byte *getStringAddress(int i);
    797797        byte *getStringAddressVar(int i);