[Scummvm-cvs-logs] CVS: scummvm/scumm music.h,NONE,2.1 debugger.cpp,1.79,1.80 imuse.cpp,2.87,2.88 imuse.h,1.41,1.42 imuse_digi.h,1.9,1.10 imuse_internal.h,2.17,2.18 player_v1.cpp,1.3,1.4 player_v1.h,1.3,1.4 player_v2.cpp,2.24,2.25 player_v2.h,2.11,2.12 player_v3a.cpp,1.2,1.3 player_v3a.h,1.1,1.2 scumm.h,1.294,1.295 scummvm.cpp,2.375,2.376 sound.cpp,1.235,1.236
Max Horn
fingolfin at users.sourceforge.net
Sun Sep 7 09:17:03 CEST 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv32134
Modified Files:
debugger.cpp imuse.cpp imuse.h imuse_digi.h imuse_internal.h
player_v1.cpp player_v1.h player_v2.cpp player_v2.h
player_v3a.cpp player_v3a.h scumm.h scummvm.cpp sound.cpp
Added Files:
music.h
Log Message:
added common base class MusicEngine for iMuse/iMuseDigital/Player_V123 (initial stab, more work to follow)
--- NEW FILE: music.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001 Ludvig Strigeus
* Copyright (C) 2001-2003 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* /scummvm/scummvm/scumm/player_v3a.h
*
*/
#ifndef SCUMM_MUSIC_H
#define SCUMM_MUSIC_H
#include "common/scummsys.h"
#include "common/system.h"
class MusicEngine {
public:
virtual ~MusicEngine() {}
virtual void startSound(int sound) = 0;
virtual void stopSound(int sound) = 0;
// virtual void stopAllSounds() = 0;
// virtual int getSoundStatus(int sound) = 0;
};
#endif
Index: debugger.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/debugger.cpp,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- debugger.cpp 15 Aug 2003 11:18:21 -0000 1.79
+++ debugger.cpp 7 Sep 2003 16:16:19 -0000 1.80
@@ -373,7 +373,7 @@
if (argc > 1) {
if (!strcmp (argv[1], "panic")) {
if (_s->_imuse)
- _s->_imuse->stop_all_sounds();
+ _s->_imuse->stopAllSounds();
if (_s->_playerV2)
_s->_playerV2->stopAllSounds();
Debug_Printf ("AAAIIIEEEEEE!\n");
@@ -395,13 +395,11 @@
Debug_Printf ("Selecting from %d songs...\n", _s->getNumSounds());
sound = _s->_rnd.getRandomNumber (_s->getNumSounds());
}
- _s->ensureResourceLoaded (rtSound, sound);
+ _s->ensureResourceLoaded(rtSound, sound);
if (_s->_imuse)
- _s->_imuse->startSound (sound);
+ _s->_imuse->startSound(sound);
if (_s->_playerV2) {
- byte *ptr = _s->getResourceAddress(rtSound, sound);
- if (ptr)
- _s->_playerV2->startSound (sound, ptr);
+ _s->_playerV2->startSound(sound);
}
Debug_Printf ("Attempted to start music %d.\n", sound);
@@ -413,15 +411,15 @@
if (argc > 2 && (!strcmp (argv[2], "all") || atoi (argv[2]) != 0)) {
if (!strcmp (argv[2], "all")) {
if (_s->_imuse)
- _s->_imuse->stop_all_sounds();
+ _s->_imuse->stopAllSounds();
if (_s->_playerV2)
_s->_playerV2->stopAllSounds();
Debug_Printf ("Shutting down all music tracks.\n");
} else {
if (_s->_imuse)
- _s->_imuse->stopSound (atoi (argv[2]));
+ _s->_imuse->stopSound(atoi (argv[2]));
if (_s->_playerV2)
- _s->_playerV2->stopSound (atoi (argv[2]));
+ _s->_playerV2->stopSound(atoi (argv[2]));
Debug_Printf ("Attempted to stop music %d.\n", atoi (argv[2]));
}
} else {
Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 2.87
retrieving revision 2.88
diff -u -d -r2.87 -r2.88
--- imuse.cpp 29 Aug 2003 04:05:23 -0000 2.87
+++ imuse.cpp 7 Sep 2003 16:16:19 -0000 2.88
@@ -299,7 +299,7 @@
return r;
}
-int IMuseInternal::stop_all_sounds() {
+int IMuseInternal::stopAllSounds() {
Player *player = _players;
int i;
@@ -610,7 +610,7 @@
}
int IMuseInternal::terminate() {
- stop_all_sounds();
+ stopAllSounds();
if (_midi_adlib) {
_midi_adlib->close();
@@ -699,9 +699,9 @@
case 9:
return stopSound(a[1]);
case 10: // FIXME: Sam and Max - Not sure if this is correct
- return stop_all_sounds();
+ return stopAllSounds();
case 11:
- return stop_all_sounds();
+ return stopAllSounds();
case 12:
// Sam & Max: Player-scope commands
player = findActivePlayer(a[1]);
@@ -1756,9 +1756,9 @@
int IMuse::get_music_volume() { in(); int ret = _target->get_music_volume(); out(); return ret; }
int IMuse::set_master_volume(uint vol) { in(); int ret = _target->set_master_volume(vol); out(); return ret; }
int IMuse::get_master_volume() { in(); int ret = _target->get_master_volume(); out(); return ret; }
-bool IMuse::startSound(int sound) { in(); bool ret = _target->startSound(sound); out(); return ret; }
-int IMuse::stopSound(int sound) { in(); int ret = _target->stopSound(sound); out(); return ret; }
-int IMuse::stop_all_sounds() { in(); int ret = _target->stop_all_sounds(); out(); return ret; }
+void IMuse::startSound(int sound) { in(); _target->startSound(sound); out(); }
+void IMuse::stopSound(int sound) { in(); _target->stopSound(sound); out(); }
+int IMuse::stopAllSounds() { in(); int ret = _target->stopAllSounds(); out(); return ret; }
int IMuse::getSoundStatus(int sound) { in(); int ret = _target->getSoundStatus(sound, true); out(); return ret; }
bool IMuse::get_sound_active(int sound) { in(); bool ret = _target->getSoundStatus(sound, false) ? 1 : 0; out(); return ret; }
int IMuse::getMusicTimer() { in(); int ret = _target->getMusicTimer(); out(); return ret; }
Index: imuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- imuse.h 16 Aug 2003 09:33:45 -0000 1.41
+++ imuse.h 7 Sep 2003 16:16:19 -0000 1.42
@@ -25,6 +25,7 @@
#include "common/scummsys.h"
#include "common/system.h"
+#include "scumm/music.h"
class IMuseInternal;
class MidiDriver;
@@ -33,7 +34,7 @@
class Serializer;
class SoundMixer;
-class IMuse {
+class IMuse : public MusicEngine {
private:
OSystem *_system;
IMuseInternal *_target;
@@ -62,9 +63,9 @@
int get_music_volume();
int set_master_volume(uint vol);
int get_master_volume();
- bool startSound(int sound);
- int stopSound(int sound);
- int stop_all_sounds();
+ void startSound(int sound);
+ void stopSound(int sound);
+ int stopAllSounds();
int getSoundStatus(int sound);
bool get_sound_active(int sound);
int getMusicTimer();
Index: imuse_digi.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- imuse_digi.h 2 Sep 2003 21:00:08 -0000 1.9
+++ imuse_digi.h 7 Sep 2003 16:16:19 -0000 1.10
@@ -24,6 +24,7 @@
#define IMUSE_DIGI_H
#include "common/scummsys.h"
+#include "scumm/music.h"
#include "sound/mixer.h"
#define MAX_DIGITAL_CHANNELS 8
@@ -32,7 +33,7 @@
class Scumm;
-class IMuseDigital {
+class IMuseDigital : public MusicEngine {
private:
struct Channel {
Index: imuse_internal.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_internal.h,v
retrieving revision 2.17
retrieving revision 2.18
diff -u -d -r2.17 -r2.18
--- imuse_internal.h 16 Aug 2003 17:08:22 -0000 2.17
+++ imuse_internal.h 7 Sep 2003 16:16:19 -0000 2.18
@@ -461,7 +461,7 @@
int get_master_volume();
bool startSound(int sound);
int stopSound(int sound);
- int stop_all_sounds();
+ int stopAllSounds();
int getSoundStatus(int sound, bool ignoreFadeouts = true);
int getMusicTimer();
int32 doCommand (int a, int b, int c, int d, int e, int f, int g, int h);
Index: player_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v1.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- player_v1.cpp 15 Aug 2003 13:58:54 -0000 1.3
+++ player_v1.cpp 7 Sep 2003 16:16:19 -0000 1.4
@@ -63,7 +63,10 @@
parseSpeakerChunk();
}
-void Player_V1::startSound(int nr, byte *data) {
+void Player_V1::startSound(int nr) {
+ byte *data = _scumm->getResourceAddress(rtSound, nr);
+ assert(data);
+
mutex_up();
int offset = _pcjr ? READ_LE_UINT16(data+4) : 6;
Index: player_v1.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v1.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- player_v1.h 15 Aug 2003 13:58:54 -0000 1.3
+++ player_v1.h 7 Sep 2003 16:16:19 -0000 1.4
@@ -47,7 +47,7 @@
Player_V1(Scumm *scumm);
~Player_V1();
- void startSound(int nr, byte *data);
+ void startSound(int nr);
void stopAllSounds();
void stopSound(int nr);
int getMusicTimer() const;
Index: player_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v2.cpp,v
retrieving revision 2.24
retrieving revision 2.25
diff -u -d -r2.24 -r2.25
--- player_v2.cpp 7 Sep 2003 00:00:35 -0000 2.24
+++ player_v2.cpp 7 Sep 2003 16:16:19 -0000 2.25
@@ -335,6 +335,7 @@
// by the 8253 (square wave generator) and a low-band filter.
_isV3Game = (scumm->_version >= 3);
+ _scumm = scumm;
_system = scumm->_system;
_mixer = scumm->_mixer;
_sample_rate = _system->property(OSystem::PROP_GET_SAMPLE_RATE, 0);
@@ -479,8 +480,10 @@
mutex_down();
}
-void Player_V2::startSound(int nr, byte *data) {
+void Player_V2::startSound(int nr) {
+ byte *data = _scumm->getResourceAddress(rtSound, nr);
assert(data);
+
mutex_up();
int cprio = _current_data ? *(_current_data + _header_len) : 0;
Index: player_v2.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v2.h,v
retrieving revision 2.11
retrieving revision 2.12
diff -u -d -r2.11 -r2.12
--- player_v2.h 15 Aug 2003 12:48:47 -0000 2.11
+++ player_v2.h 7 Sep 2003 16:16:19 -0000 2.12
@@ -25,6 +25,7 @@
#include "common/scummsys.h"
#include "common/system.h"
+#include "scumm/music.h"
#if !defined(__GNUC__)
#pragma START_PACK_STRUCTS
@@ -70,14 +71,14 @@
class SoundMixer;
-class Player_V2 {
+class Player_V2 : public MusicEngine {
public:
Player_V2(Scumm *scumm);
virtual ~Player_V2();
virtual void set_master_volume(int vol);
- virtual void startSound(int nr, byte *data);
+ virtual void startSound(int nr);
virtual void stopSound(int nr);
virtual void stopAllSounds();
virtual bool getSoundStatus(int nr) const;
@@ -87,6 +88,7 @@
bool _isV3Game;
SoundMixer *_mixer;
OSystem *_system;
+ Scumm *_scumm;
bool _pcjr;
int _header_len;
Index: player_v3a.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v3a.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- player_v3a.cpp 7 Sep 2003 09:39:16 -0000 1.2
+++ player_v3a.cpp 7 Sep 2003 16:16:19 -0000 1.3
@@ -79,12 +79,13 @@
_songData = NULL;
_songPtr = 0;
_songDelay = 0;
- for (int i = 0; i < V3A_MAXCHANS; i++)
+ for (int i = 0; i < V3A_MAXCHANS; i++) {
if (_soundID[i]) {
_mixer->stopID(_soundID[i]);
_soundID[i] = 0;
_timeleft[i] = 0;
}
+ }
}
void Player_V3A::stopSound(int nr) {
@@ -134,7 +135,10 @@
else _mixer->playRaw(NULL, data, size, rate, SoundMixer::FLAG_AUTOFREE, nr, vol, 0);
}
-void Player_V3A::startSound(int nr, byte *data) {
+void Player_V3A::startSound(int nr) {
+ byte *data = _scumm->getResourceAddress(rtSound, nr);
+ assert(data);
+
if (!_isinit) {
int i;
if (_scumm->_gameId == GID_INDY3) {
@@ -191,7 +195,8 @@
}
_wavetable[i] = NULL;
}
- else error("player_v3a - unknown game!");
+ else
+ error("player_v3a - unknown game!");
_isinit = true;
}
Index: player_v3a.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v3a.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- player_v3a.h 7 Sep 2003 09:33:00 -0000 1.1
+++ player_v3a.h 7 Sep 2003 16:16:19 -0000 1.2
@@ -25,20 +25,21 @@
#include "common/scummsys.h"
#include "common/system.h"
+#include "scumm/music.h"
#define V3A_MAXCHANS 8
class Scumm;
class SoundMixer;
-class Player_V3A {
+class Player_V3A : public MusicEngine {
public:
Player_V3A(Scumm *scumm);
virtual ~Player_V3A();
virtual void set_master_volume(int vol);
- virtual void startSound(int nr, byte *data);
+ virtual void startSound(int nr);
virtual void stopSound(int nr);
virtual void stopAllSounds();
virtual int getMusicTimer() const;
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.294
retrieving revision 1.295
diff -u -d -r1.294 -r1.295
--- scumm.h 7 Sep 2003 07:23:19 -0000 1.294
+++ scumm.h 7 Sep 2003 16:16:19 -0000 1.295
@@ -29,7 +29,7 @@
#include "common/rect.h"
#include "common/str.h"
-#include "gfx.h"
+#include "scumm/gfx.h"
class Actor;
class BaseCostumeRenderer;
@@ -39,6 +39,7 @@
class GameDetector;
class IMuse;
class IMuseDigital;
+class MusicEngine;
class NewGui;
class Player_V2;
class Player_V3A;
@@ -307,6 +308,7 @@
IMuseDigital *_imuseDigital;
Player_V2 *_playerV2;
Player_V3A *_playerV3A;
+ MusicEngine *_musicEngine;
Sound *_sound;
VerbSlot *_verbs;
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.375
retrieving revision 2.376
diff -u -d -r2.375 -r2.376
--- scummvm.cpp 7 Sep 2003 07:23:19 -0000 2.375
+++ scummvm.cpp 7 Sep 2003 16:16:19 -0000 2.376
@@ -692,16 +692,17 @@
_imuseDigital = NULL;
_playerV2 = NULL;
_playerV3A = NULL;
+ _musicEngine = NULL;
if (_features & GF_DIGI_IMUSE) {
- _imuseDigital = new IMuseDigital(this);
+ _musicEngine = _imuseDigital = new IMuseDigital(this);
} else if ((_features & GF_AMIGA) && (_version == 3)) {
- _playerV3A = new Player_V3A(this);
+ _musicEngine = _playerV3A = new Player_V3A(this);
} else if ((_features & GF_AMIGA) && (_version < 5)) {
_playerV2 = NULL;
} else if (((_midiDriver == MD_PCJR) || (_midiDriver == MD_PCSPK)) && ((_version > 2) && (_version < 5))) {
- _playerV2 = new Player_V2(this);
+ _musicEngine = _playerV2 = new Player_V2(this);
} else if (_version > 2) {
- _imuse = IMuse::create (syst, _mixer, detector->createMidi());
+ _musicEngine = _imuse = IMuse::create(syst, _mixer, detector->createMidi());
if (_imuse) {
if (detector->_gameTempo != 0)
_imuse->property(IMuse::PROP_TEMPO_BASE, detector->_gameTempo);
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.235
retrieving revision 1.236
diff -u -d -r1.235 -r1.236
--- sound.cpp 7 Sep 2003 07:23:20 -0000 1.235
+++ sound.cpp 7 Sep 2003 16:16:19 -0000 1.236
@@ -182,6 +182,7 @@
// FIXME: Should we replace this by an assert, and/or print an error message?
return;
}
+
if (READ_UINT32(ptr) == MKID('iMUS')){
assert(_scumm->_imuseDigital);
_scumm->_imuseDigital->startSound(soundID);
@@ -478,16 +479,16 @@
// automatically stop the old song.
if (_scumm->_imuse) {
if (READ_UINT32(ptr) != MKID('ASFX'))
- _scumm->_imuse->stop_all_sounds();
+ _scumm->_imuse->stopAllSounds();
}
}
if (_scumm->_playerV2) {
- _scumm->_playerV2->startSound(soundID, ptr);
+ _scumm->_playerV2->startSound(soundID);
}
if (_scumm->_playerV3A)
- _scumm->_playerV3A->startSound(soundID, ptr);
+ _scumm->_playerV3A->startSound(soundID);
if (_scumm->_imuse) {
_scumm->_imuse->startSound(soundID);
@@ -780,7 +781,7 @@
}
if (_scumm->_imuse) {
- _scumm->_imuse->stop_all_sounds();
+ _scumm->_imuse->stopAllSounds();
_scumm->_imuse->clear_queue();
} else if (_scumm->_playerV2) {
_scumm->_playerV2->stopAllSounds();
More information about the Scummvm-git-logs
mailing list