[Scummvm-cvs-logs] CVS: residual/mixer mixer.cpp,1.10,1.11 mixer.h,1.8,1.9

Marcus Comstedt marcus_c at users.sourceforge.net
Sun Feb 5 09:49:03 CET 2006


Update of /cvsroot/scummvm/residual/mixer
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6094/mixer

Modified Files:
	mixer.cpp mixer.h 
Log Message:
SDL sound code moved to DriverSDL.

Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/mixer/mixer.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- mixer.cpp	5 Feb 2006 16:11:11 -0000	1.10
+++ mixer.cpp	5 Feb 2006 17:48:19 -0000	1.11
@@ -18,13 +18,12 @@
 #include "stdafx.h"
 #include "bits.h"
 #include "debug.h"
+#include "driver.h"
 
 #include "mixer/mixer.h"
 #include "mixer/rate.h"
 #include "mixer/audiostream.h"
 
-#include <SDL.h>
-
 SoundMixer *g_mixer = NULL;
 
 /**
@@ -83,18 +82,21 @@
 SoundMixer::SoundMixer() {
 	_mutex = createMutex();
 	_premixChannel = NULL;
-	_outputRate = 22050;
 	_globalVolume = 0;
 	_paused = false;
 
 	for (int i = 0; i != NUM_CHANNELS; i++)
 		_channels[i] = NULL;
 
-	_mixerReady = setSoundProc(mixCallback, this);
+	_mixerReady = g_driver->setSoundCallback(mixCallback, this);
+	_outputRate = (uint)g_driver->getOutputSampleRate();
+
+	if (_outputRate == 0)
+		error("OSystem returned invalid sample rate");
 }
 
 SoundMixer::~SoundMixer() {
-	SDL_CloseAudio();
+	g_driver->clearSoundCallback();
 	stopAll(true);
 
 	delete _premixChannel;
@@ -107,26 +109,6 @@
 	return _paused;
 }
 
-bool SoundMixer::setSoundProc(SoundProc proc, void *param) {
-	SDL_AudioSpec desired;
-
-	memset(&desired, 0, sizeof(desired));
-
-	desired.freq = 22050;
-	desired.format = AUDIO_S16SYS;
-	desired.channels = 2;
-	desired.samples = 2048;
-	desired.callback = proc;
-	desired.userdata = param;
-
-	if (SDL_OpenAudio(&desired, NULL) != 0) {
-		return false;
-	}
-
-	SDL_PauseAudio(0);
-	return true;
-}
-
 void SoundMixer::setupPremix(AudioStream *stream) {
 	StackLock lock(_mutex);
 

Index: mixer.h
===================================================================
RCS file: /cvsroot/scummvm/residual/mixer/mixer.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- mixer.h	5 Feb 2006 16:11:11 -0000	1.8
+++ mixer.h	5 Feb 2006 17:48:19 -0000	1.9
@@ -235,9 +235,6 @@
 	uint getOutputRate() const { return _outputRate; }
 
 private:
-	typedef void (*SoundProc)(void *param, byte *buf, int len);
-	bool setSoundProc(SoundProc proc, void *param);
-
 	void insertChannel(PlayingSoundHandle *handle, Channel *chan);
 
 	/**





More information about the Scummvm-git-logs mailing list