[Scummvm-cvs-logs] SF.net SVN: scummvm: [32978] scummvm/trunk/backends/platform/ds/arm9/source

agent-q at users.sourceforge.net agent-q at users.sourceforge.net
Wed Jul 9 18:50:23 CEST 2008


Revision: 32978
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32978&view=rev
Author:   agent-q
Date:     2008-07-09 09:50:23 -0700 (Wed, 09 Jul 2008)

Log Message:
-----------
DS: Backend changes for new mixer code

Modified Paths:
--------------
    scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/dsmain.h
    scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h
    scummvm/trunk/backends/platform/ds/arm9/source/wordcompletion.cpp

Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp	2008-07-09 13:33:36 UTC (rev 32977)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp	2008-07-09 16:50:23 UTC (rev 32978)
@@ -168,7 +168,7 @@
 u8 gameID;
 
 bool snapToBorder = false;
-bool consoleEnable = false;
+bool consoleEnable = true;
 bool gameScreenSwap = false;
 bool isCpuScalerEnabled();
 //#define HEAVY_LOGGING
@@ -899,12 +899,6 @@
 		return BG_GFX + 0x10000;		// 16bit qty!
 }
 
-void setSoundProc(OSystem_DS::SoundProc proc, void* param) {
-//	consolePrintf("Set sound callback");
-	soundCallback = proc;
-	soundParam = param;
-}
-
 // The sound system in ScummVM seems to always return stereo interleaved samples.
 // Here, I'm treating an 11Khz stereo stream as a 22Khz mono stream, which works sorta ok, but is
 // a horrible bodge.  Any advice on how to change the engine to output mono would be greatly
@@ -914,7 +908,8 @@
 	consolePrintf("doSoundCallback...");
 	#endif
 
-	if (soundCallback) {
+	if (OSystem_DS::instance())
+	if (OSystem_DS::instance()->getMixerImpl()) {
 		lastCallbackFrame = frameCount;
 		
 		for (int r = IPC->playingSection; r < IPC->playingSection + 4; r++) {
@@ -923,7 +918,7 @@
 			if (IPC->fillNeeded[chunk]) {
 				IPC->fillNeeded[chunk] = false;
 				DC_FlushAll();
-				soundCallback(soundParam, (byte *) (soundBuffer + ((bufferSamples >> 2) * chunk)), bufferSamples >> 1);
+				OSystem_DS::instance()->getMixerImpl()->mixCallback((byte *) (soundBuffer + ((bufferSamples >> 2) * chunk)), bufferSamples >> 1);
 				IPC->fillNeeded[chunk] = false;
 				DC_FlushAll();
 			}

Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsmain.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsmain.h	2008-07-09 13:33:36 UTC (rev 32977)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsmain.h	2008-07-09 16:50:23 UTC (rev 32978)
@@ -88,7 +88,6 @@
 void 	doTimerCallback();												// Call callback function if required
 
 // Sound
-void 	setSoundProc(OSystem_DS::SoundProc proc, void* param);			// Setup a callback function for sound
 void 	doSoundCallback();												// Call function if sound buffers need more data
 void 	playSound(const void* data, u32 length, bool loop, bool adpcm = false, int rate = 22050);		// Start a sound
 void 	stopSound(int channel);

Modified: scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp	2008-07-09 13:33:36 UTC (rev 32977)
+++ scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp	2008-07-09 16:50:23 UTC (rev 32978)
@@ -67,10 +67,12 @@
 	ConfMan.setInt("autosave_period", 0);
 	ConfMan.setBool("FM_medium_quality", true);
 
-	_mixer = new DSAudioMixer;
-	_timer = new DSTimerManager;
-	DS::setSoundProc(Audio::Mixer::mixCallback, _mixer);
-    DS::setTimerCallback(&OSystem_DS::timerHandler, 10);
+	_mixer = new DSAudioMixer(this);
+	_timer = new DSTimerManager();
+    	DS::setTimerCallback(&OSystem_DS::timerHandler, 10);
+
+	_mixer->setOutputRate(11025 /*DS::getSoundFrequency()*/);
+	_mixer->setReady(true);
     
 	OSystem::initBackend();
 }
@@ -139,7 +141,7 @@
 		green >>= 3;
 		blue >>= 3;
 		
-//		if (r != 255)
+		if (r != 255)
 		{		
 			BG_PALETTE[r] = red | (green << 5) | (blue << 10);
 			if (!DS::getKeyboardEnable()) {

Modified: scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h	2008-07-09 13:33:36 UTC (rev 32977)
+++ scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h	2008-07-09 16:50:23 UTC (rev 32978)
@@ -30,10 +30,13 @@
 #include "gbampsave.h"
 #include "backends/saves/default/default-saves.h"
 #include "backends/timer/default/default-timer.h"
-#include "sound/mixer.h"
+#include "sound/mixer_intern.h"
 #include "graphics/surface.h"
 
-class DSAudioMixer : public Audio::Mixer {	
+class DSAudioMixer : public Audio::MixerImpl {	
+
+public:
+	DSAudioMixer(OSystem* system) : Audio::MixerImpl(system) { }
 };
 
 class DSTimerManager : public DefaultTimerManager {	
@@ -62,7 +65,7 @@
 	Graphics::Surface* createTempFrameBuffer();
 
 public:
-	typedef void (*SoundProc)(void *param, byte *buf, int len);
+	typedef void (*SoundProc)(byte *buf, int len);
 	typedef int  (*TimerProc)(int interval);
 
 	OSystem_DS();
@@ -146,6 +149,8 @@
 	virtual void unlockScreen();
 	
 	virtual Audio::Mixer* getMixer() { return _mixer; }
+	Audio::MixerImpl* getMixerImpl() { return _mixer; }
+
 	virtual Common::TimerManager* getTimerManager() { return _timer; }
 	static int timerHandler(int t);
 

Modified: scummvm/trunk/backends/platform/ds/arm9/source/wordcompletion.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/wordcompletion.cpp	2008-07-09 13:33:36 UTC (rev 32977)
+++ scummvm/trunk/backends/platform/ds/arm9/source/wordcompletion.cpp	2008-07-09 16:50:23 UTC (rev 32978)
@@ -1,6 +1,6 @@
 #include "wordcompletion.h"
-#include "engines/agi/agi.h"
 #include "osystem_ds.h"
+#include "engines/agi/agi.h"	// Caution for #define for NUM_CHANNELS, causes problems in mixer_intern.h
 
 #ifdef ENABLE_AGI
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list