diff options
| author | Neil Millstone | 2008-07-09 16:50:23 +0000 | 
|---|---|---|
| committer | Neil Millstone | 2008-07-09 16:50:23 +0000 | 
| commit | 9f96471f47acdcb7687281a563663cd96e3a0788 (patch) | |
| tree | f0f77b11db24a1b6ee27e01d2723252c527fae81 | |
| parent | 12cefc4132ddb06ce56efd813c88f50d5e8b19ed (diff) | |
| download | scummvm-rg350-9f96471f47acdcb7687281a563663cd96e3a0788.tar.gz scummvm-rg350-9f96471f47acdcb7687281a563663cd96e3a0788.tar.bz2 scummvm-rg350-9f96471f47acdcb7687281a563663cd96e3a0788.zip | |
DS: Backend changes for new mixer code
svn-id: r32978
| -rw-r--r-- | backends/platform/ds/arm9/source/dsmain.cpp | 13 | ||||
| -rw-r--r-- | backends/platform/ds/arm9/source/dsmain.h | 1 | ||||
| -rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.cpp | 12 | ||||
| -rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.h | 11 | ||||
| -rw-r--r-- | backends/platform/ds/arm9/source/wordcompletion.cpp | 2 | 
5 files changed, 20 insertions, 19 deletions
| diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index a130509e36..f4706807f7 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -168,7 +168,7 @@ bool displayModeIs8Bit = false;  u8 gameID;  bool snapToBorder = false; -bool consoleEnable = false; +bool consoleEnable = true;  bool gameScreenSwap = false;  bool isCpuScalerEnabled();  //#define HEAVY_LOGGING @@ -899,12 +899,6 @@ u16* get8BitBackBuffer() {  		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 @@ void doSoundCallback() {  	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 @@ void doSoundCallback() {  			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();  			} diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h index f20442b11e..43258b5c5d 100644 --- a/backends/platform/ds/arm9/source/dsmain.h +++ b/backends/platform/ds/arm9/source/dsmain.h @@ -88,7 +88,6 @@ int 	getMillis();													// Return the current runtime in milliseconds  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); diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index d2c3b579bd..a72efa9ca2 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -67,10 +67,12 @@ void OSystem_DS::initBackend() {  	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 @@ void OSystem_DS::setPalette(const byte *colors, uint start, uint num) {  		green >>= 3;  		blue >>= 3; -//		if (r != 255) +		if (r != 255)  		{		  			BG_PALETTE[r] = red | (green << 5) | (blue << 10);  			if (!DS::getKeyboardEnable()) { diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index e53575a4a5..8c8d661ad8 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -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 @@ protected:  	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 @@ public:  	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); diff --git a/backends/platform/ds/arm9/source/wordcompletion.cpp b/backends/platform/ds/arm9/source/wordcompletion.cpp index 9eeeb62410..ff52572a40 100644 --- a/backends/platform/ds/arm9/source/wordcompletion.cpp +++ b/backends/platform/ds/arm9/source/wordcompletion.cpp @@ -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 | 
