[Scummvm-cvs-logs] CVS: scummvm/scumm player_nes.cpp,NONE,2.1 player_nes.h,NONE,2.1 module.mk,1.46,1.47 player_v2a.cpp,2.28,2.29 player_v2a.h,2.12,2.13 player_v3a.cpp,1.22,1.23 player_v3a.h,1.22,1.23 scumm.cpp,1.405,1.406

Eugene Sandulenko sev at users.sourceforge.net
Thu Apr 7 00:30:00 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15513

Modified Files:
	module.mk player_v2a.cpp player_v2a.h player_v3a.cpp 
	player_v3a.h scumm.cpp 
Added Files:
	player_nes.cpp player_nes.h 
Log Message:
Patch from Quietust

o Remove unused _system variables in player_v2a and player_v3a
o Sound player for MM NES :) Now we're playing chiptunes.


--- NEW FILE: player_nes.cpp ---

/* ScummVM - Scumm Interpreter
 * Copyright (C) 2001  Ludvig Strigeus
 * Copyright (C) 2001-2005 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
 * aint32 with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
[...1053 lines suppressed...]
}

int Player_NES::getSoundStatus(int nr) const {
	for (int i = 0; i < NUMSLOTS; i++)
		if (_slot[i].id == nr)
			return 1;
	return 0;
}

void Player_NES::APU_writeChannel(int chan, int offset, byte value) {
	APUe::APU_WriteReg(0x000 + 4 * chan + offset, value);
}
void Player_NES::APU_writeControl(byte value) {
	APUe::APU_WriteReg(0x015, value);
}
byte Player_NES::APU_readStatus() {
	return APUe::APU_Read4015();
}

} // End of namespace Scumm

--- NEW FILE: player_nes.h ---
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2001  Ludvig Strigeus
 * Copyright (C) 2001-2005 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.
 *
 * $Header: /cvsroot/scummvm/scummvm/scumm/player_nes.h,v 2.1 2005/04/07 07:29:19 sev Exp $
 *
 */

#ifndef PLAYER_NES_H
#define PLAYER_NES_H

#include "common/scummsys.h"
#include "scumm/music.h"
#include "sound/audiostream.h"

class SoundMixer;

namespace Scumm {

class ScummEngine;

/**
 * Scumm NES sound/music driver.
 */
class Player_NES : public AudioStream, public MusicEngine {
public:
	Player_NES(ScummEngine *scumm);
	virtual ~Player_NES();

	virtual void setMusicVolume(int vol);
	virtual void startSound(int sound);
	virtual void stopSound(int sound);
	virtual void stopAllSounds();
	virtual int  getSoundStatus(int sound) const;

	// AudioStream API
	int readBuffer(int16 *buffer, const int numSamples);
	bool isStereo() const { return false; }
	bool endOfData() const { return false; }
	int getRate() const { return _sample_rate; }

private:

	void sound_play();
	void playSFX(int nr);
	void playMusic();
	byte fetchSoundByte(int nr);
	void chainCommand(int chan);
	void checkSilenceChannels(int chan);

	void APU_writeChannel(int chan, int offset, byte value);
	void APU_writeControl(byte value);
	byte APU_readStatus();

	void do_mix(int16 *buf, uint len);

	ScummEngine *_vm;
	SoundMixer *_mixer;
	int _sample_rate;
	int _samples_per_frame;
	int _current_sample;

	static const int MAXVOLUME = 0x7F;
	static const int NUMSLOTS = 3;
	static const int NUMCHANS = 4;

	struct slot {
		int framesleft;
		int id;
		int type;
		byte *data;
		int offset;
	} _slot[NUMSLOTS];

	struct mchan {
		int command;
		int framedelay;
		int pitch;
		int volume;
		int voldelta;
		int envflags;
		int cmdlock;
	} _mchan[NUMCHANS];

	bool isSFXplaying, wasSFXplaying;

	byte *dataStart;
	int numNotes;
	byte *auxData1;
	byte *auxData2;

	byte *soundptr;
};

} // End of namespace Scumm

#endif

Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/module.mk,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- module.mk	20 Feb 2005 10:56:58 -0000	1.46
+++ module.mk	7 Apr 2005 07:29:19 -0000	1.47
@@ -25,6 +25,7 @@
 	scumm/palette.o \
 	scumm/player_mod.o \
 	scumm/player_v1.o \
+	scumm/player_nes.o \
 	scumm/player_v2.o \
 	scumm/player_v2a.o \
 	scumm/player_v3a.o \

Index: player_v2a.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v2a.cpp,v
retrieving revision 2.28
retrieving revision 2.29
diff -u -d -r2.28 -r2.29
--- player_v2a.cpp	23 Mar 2005 10:17:52 -0000	2.28
+++ player_v2a.cpp	7 Apr 2005 07:29:19 -0000	2.29
@@ -1305,7 +1305,6 @@
 Player_V2A::Player_V2A(ScummEngine *scumm) {
 	int i;
 	_vm = scumm;
-	_system = scumm->_system;
 
 #ifdef __PALM_OS__
 	if (!CRCtable) CRCtable = (uint32 *)calloc(256, sizeof(uint32));

Index: player_v2a.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v2a.h,v
retrieving revision 2.12
retrieving revision 2.13
diff -u -d -r2.12 -r2.13
--- player_v2a.h	1 Jan 2005 16:09:15 -0000	2.12
+++ player_v2a.h	7 Apr 2005 07:29:19 -0000	2.13
@@ -27,7 +27,6 @@
 #include "scumm/music.h"
 #include "scumm/player_mod.h"
 
-class OSystem;
 class SoundMixer;
 
 namespace Scumm {
@@ -60,7 +59,6 @@
 		V2A_Sound *sound;
 	};
 
-	OSystem *_system;
 	ScummEngine *_vm;
 	Player_MOD *_mod;
 	soundSlot _slot[V2A_MAXSLOTS];

Index: player_v3a.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v3a.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- player_v3a.cpp	1 Jan 2005 16:09:15 -0000	1.22
+++ player_v3a.cpp	7 Apr 2005 07:29:19 -0000	1.23
@@ -37,7 +37,6 @@
 Player_V3A::Player_V3A(ScummEngine *scumm) {
 	int i;
 	_vm = scumm;
-	_system = scumm->_system;
 	for (i = 0; i < V3A_MAXMUS; i++) {
 		_mus[i].id = 0;
 		_mus[i].dur = 0;

Index: player_v3a.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v3a.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- player_v3a.h	1 Jan 2005 16:09:15 -0000	1.22
+++ player_v3a.h	7 Apr 2005 07:29:19 -0000	1.23
@@ -27,7 +27,6 @@
 #include "scumm/music.h"
 #include "scumm/player_mod.h"
 
-class OSystem;
 class SoundMixer;
 
 namespace Scumm {
@@ -75,7 +74,6 @@
 		int16 _pitadjust;
 	};
 
-	OSystem *_system;
 	ScummEngine *_vm;
 	Player_MOD *_mod;
 

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.405
retrieving revision 1.406
diff -u -d -r1.405 -r1.406
--- scumm.cpp	6 Apr 2005 17:42:39 -0000	1.405
+++ scumm.cpp	7 Apr 2005 07:29:19 -0000	1.406
@@ -46,6 +46,7 @@
 #include "scumm/insane/insane.h"
 #include "scumm/intern.h"
 #include "scumm/object.h"
+#include "scumm/player_nes.h"
 #include "scumm/player_v1.h"
 #include "scumm/player_v2.h"
 #include "scumm/player_v2a.h"
@@ -1652,11 +1653,13 @@
 	// Init iMuse
 	if (_features & GF_DIGI_IMUSE) {
 		_musicEngine = _imuseDigital = new IMuseDigital(this, 10);
+	} else if (_features & GF_NES) {
+		_musicEngine = new Player_NES(this);
 	} else if ((_features & GF_AMIGA) && (_version == 2)) {
 		_musicEngine = new Player_V2A(this);
 	} else if ((_features & GF_AMIGA) && (_version == 3)) {
 		_musicEngine = new Player_V3A(this);
-	} else if (((_features & GF_AMIGA) && (_version < 5)) || (_features & GF_NES)) {
+	} else if ((_features & GF_AMIGA) && (_version < 5)) {
 		_musicEngine = NULL;
 	} else if (((_midiDriver == MD_PCJR) || (_midiDriver == MD_PCSPK)) && ((_version > 2) && (_version < 5))) {
 		_musicEngine = new Player_V2(this, _midiDriver != MD_PCSPK);





More information about the Scummvm-git-logs mailing list