[Scummvm-cvs-logs] SF.net SVN: scummvm: [32836] scummvm/trunk/backends/platform/dc

marcus_c at users.sourceforge.net marcus_c at users.sourceforge.net
Sun Jun 29 13:51:47 CEST 2008


Revision: 32836
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32836&view=rev
Author:   marcus_c
Date:     2008-06-29 04:51:47 -0700 (Sun, 29 Jun 2008)

Log Message:
-----------
New Mixer API.

Modified Paths:
--------------
    scummvm/trunk/backends/platform/dc/audio.cpp
    scummvm/trunk/backends/platform/dc/dc.h
    scummvm/trunk/backends/platform/dc/dcmain.cpp

Modified: scummvm/trunk/backends/platform/dc/audio.cpp
===================================================================
--- scummvm/trunk/backends/platform/dc/audio.cpp	2008-06-29 10:16:20 UTC (rev 32835)
+++ scummvm/trunk/backends/platform/dc/audio.cpp	2008-06-29 11:51:47 UTC (rev 32836)
@@ -25,17 +25,18 @@
 
 #include <common/scummsys.h>
 #include "engines/engine.h"
-#include "sound/mixer.h"
+#include "sound/mixer_intern.h"
 #include "dc.h"
 
 EXTERN_C void *memcpy4s(void *s1, const void *s2, unsigned int n);
 
-void initSound()
+uint OSystem_Dreamcast::initSound()
 {
   stop_sound();
   do_sound_command(CMD_SET_FREQ_EXP(FREQ_22050_EXP));
   do_sound_command(CMD_SET_STEREO(1));
   do_sound_command(CMD_SET_BUFFER(SOUND_BUFFER_SHIFT));
+  return read_sound_int(&SOUNDSTATUS->freq);
 }
 
 void OSystem_Dreamcast::checkSound()
@@ -61,8 +62,8 @@
   if (n<100)
     return;
 
-  Audio::Mixer::mixCallback(_mixer, (byte*)temp_sound_buffer,
-			    2*SAMPLES_TO_BYTES(n));
+  _mixer->mixCallback((byte*)temp_sound_buffer,
+		      2*SAMPLES_TO_BYTES(n));
 
   if (fillpos+n > curr_ring_buffer_samples) {
     int r = curr_ring_buffer_samples - fillpos;
@@ -77,8 +78,4 @@
     fillpos = 0;
 }
 
-int OSystem_Dreamcast::getOutputSampleRate() const
-{
-  return read_sound_int(&SOUNDSTATUS->freq);
-}
 

Modified: scummvm/trunk/backends/platform/dc/dc.h
===================================================================
--- scummvm/trunk/backends/platform/dc/dc.h	2008-06-29 10:16:20 UTC (rev 32835)
+++ scummvm/trunk/backends/platform/dc/dc.h	2008-06-29 11:51:47 UTC (rev 32836)
@@ -28,6 +28,7 @@
 #include <ronin/soundcommon.h>
 #include "backends/timer/default/default-timer.h"
 #include "backends/fs/fs-factory.h"
+#include "sound/mixer_intern.h"
 
 #define NUM_BUFFERS 4
 #define SOUND_BUFFER_SHIFT 3
@@ -195,7 +196,7 @@
  private:
 
   Common::SaveFileManager *_savefile;
-  Audio::Mixer *_mixer;
+  Audio::MixerImpl *_mixer;
   DefaultTimerManager *_timer;
   SoftKeyboard _softkbd;
 
@@ -223,6 +224,7 @@
 
   int temp_sound_buffer[RING_BUFFER_SAMPLES>>SOUND_BUFFER_SHIFT];
 
+  uint initSound();
   void checkSound();
 
   void drawMouse(int xdraw, int ydraw, int w, int h,
@@ -237,6 +239,5 @@
 extern int handleInput(struct mapledev *pad,
 		       int &mouse_x, int &mouse_y,
 		       byte &shiftFlags, Interactive *inter = NULL);
-extern void initSound();
 extern bool selectGame(char *&, char *&, class Icon &);
 

Modified: scummvm/trunk/backends/platform/dc/dcmain.cpp
===================================================================
--- scummvm/trunk/backends/platform/dc/dcmain.cpp	2008-06-29 10:16:20 UTC (rev 32835)
+++ scummvm/trunk/backends/platform/dc/dcmain.cpp	2008-06-29 11:51:47 UTC (rev 32836)
@@ -33,7 +33,7 @@
 #include <common/config-manager.h>
 
 #include "backends/plugins/dc/dc-provider.h"
-#include "sound/mixer.h"
+#include "sound/mixer_intern.h"
 
 
 Icon icon;
@@ -54,8 +54,10 @@
 void OSystem_Dreamcast::initBackend()
 {
   _savefile = createSavefileManager();
-  _mixer = new Audio::Mixer();
+  _mixer = new Audio::MixerImpl(this);
   _timer = new DefaultTimerManager();
+  _mixer->setOutputRate(initSound());
+  _mixer->setReady(true);
 }
 
 
@@ -216,7 +218,6 @@
   static int argc = 1;
 
   dc_init_hardware();
-  initSound();
 
   g_system = new OSystem_Dreamcast();
   assert(g_system);


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