[Scummvm-cvs-logs] CVS: scummvm/scumm player_mod.cpp,2.17,2.18 player_mod.h,2.14,2.15 player_v2.cpp,2.51,2.52 player_v2.h,2.28,2.29

Max Horn fingolfin at users.sourceforge.net
Sat Nov 27 09:19:24 CET 2004


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

Modified Files:
	player_mod.cpp player_mod.h player_v2.cpp player_v2.h 
Log Message:
Use modern form of setupPremix

Index: player_mod.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_mod.cpp,v
retrieving revision 2.17
retrieving revision 2.18
diff -u -d -r2.17 -r2.18
--- player_mod.cpp	27 Nov 2004 15:58:07 -0000	2.17
+++ player_mod.cpp	27 Nov 2004 16:12:11 -0000	2.18
@@ -22,7 +22,6 @@
 
 #include "stdafx.h"
 #include "scumm/player_mod.h"
-#include "sound/audiostream.h"
 #include "sound/mixer.h"
 #include "sound/rate.h"
 
@@ -46,7 +45,7 @@
 	_playproc = NULL;
 	_playparam = NULL;
 
-	_mixer->setupPremix(premix_proc, this);
+	_mixer->setupPremix(this);
 }
 
 Player_MOD::~Player_MOD() {
@@ -146,10 +145,6 @@
 	}
 }
 
-void Player_MOD::premix_proc(void *param, int16 *buf, uint len) {
-	((Player_MOD *) param)->do_mix(buf, len);
-}
-
 void Player_MOD::do_mix(int16 *data, uint len) {
 	int i;
 	int dpos = 0;

Index: player_mod.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_mod.h,v
retrieving revision 2.14
retrieving revision 2.15
diff -u -d -r2.14 -r2.15
--- player_mod.h	16 Mar 2004 07:02:21 -0000	2.14
+++ player_mod.h	27 Nov 2004 16:12:11 -0000	2.15
@@ -24,6 +24,7 @@
 #define PLAYER_MOD_H
 
 #include "scumm/scumm.h"
+#include "sound/audiostream.h"
 
 class AudioStream;
 class RateConverter;
@@ -33,7 +34,7 @@
 /**
  * Generic Amiga MOD mixer - provides a 60Hz 'update' routine.
  */
-class Player_MOD {
+class Player_MOD : public AudioStream {
 public:
 	Player_MOD(ScummEngine *scumm);
 	virtual ~Player_MOD();
@@ -50,6 +51,16 @@
 	virtual void setUpdateProc(ModUpdateProc *proc, void *param, int freq);
 	virtual void clearUpdateProc();
 
+
+	int readBuffer(int16 *buffer, const int numSamples) {
+		do_mix(buffer, numSamples / 2);
+		return numSamples;
+	}
+	bool isStereo() const { return true; }
+	bool endOfData() const { return false; }
+	
+	int getRate() const { return _samplerate; }
+
 private:
 	enum {
 		MOD_MAXCHANS = 24
@@ -74,7 +85,6 @@
 
 	uint8 _maxvol;
 
-	static void premix_proc(void *param, int16 *buf, uint len);
 	virtual void do_mix(int16 *buf, uint len);
 	
 	ModUpdateProc *_playproc;

Index: player_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v2.cpp,v
retrieving revision 2.51
retrieving revision 2.52
diff -u -d -r2.51 -r2.52
--- player_v2.cpp	27 Nov 2004 15:58:07 -0000	2.51
+++ player_v2.cpp	27 Nov 2004 16:12:11 -0000	2.52
@@ -376,7 +376,7 @@
 	set_pcjr(pcjr);
 	setMasterVolume(255);
 
-	_mixer->setupPremix(premix_proc, this);
+	_mixer->setupPremix(this);
 }
 
 Player_V2::~Player_V2() {
@@ -792,10 +792,6 @@
 	}
 }
 
-void Player_V2::premix_proc(void *param, int16 *buf, uint len) {
-	((Player_V2 *) param)->do_mix(buf, len);
-}
-
 void Player_V2::do_mix(int16 *data, uint len) {
 	mutex_up();
 	uint step;

Index: player_v2.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_v2.h,v
retrieving revision 2.28
retrieving revision 2.29
diff -u -d -r2.28 -r2.29
--- player_v2.h	28 Feb 2004 12:58:10 -0000	2.28
+++ player_v2.h	27 Nov 2004 16:12:11 -0000	2.29
@@ -26,6 +26,7 @@
 #include "common/scummsys.h"
 #include "common/system.h"
 #include "scumm/music.h"
+#include "sound/audiostream.h"
 
 class SoundMixer;
 
@@ -72,7 +73,7 @@
  * This simulates the pc speaker sound, which is driven  by the 8253 (square
  * wave generator) and a low-band filter.
  */
-class Player_V2 : public MusicEngine {
+class Player_V2 : public AudioStream, public MusicEngine {
 public:
 	Player_V2(ScummEngine *scumm, bool pcjr);
 	virtual ~Player_V2();
@@ -84,6 +85,16 @@
 	virtual int  getMusicTimer() const;
 	virtual int  getSoundStatus(int sound) const;
 
+
+	int readBuffer(int16 *buffer, const int numSamples) {
+		do_mix(buffer, numSamples / 2);
+		return numSamples;
+	}
+	bool isStereo() const { return true; }
+	bool endOfData() const { return false; }
+	
+	int getRate() const { return _sample_rate; }
+
 protected:
 	bool _isV3Game;
 	SoundMixer *_mixer;
@@ -143,7 +154,6 @@
 						int noiseFeedback, int16 *sample, uint len);
 
 private:
-	static void premix_proc(void *param, int16 *buf, uint len);
 	void do_mix(int16 *buf, uint len);
 
 	void set_pcjr(bool pcjr);





More information about the Scummvm-git-logs mailing list