aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/symbian
diff options
context:
space:
mode:
authorMax Horn2010-03-11 23:39:51 +0000
committerMax Horn2010-03-11 23:39:51 +0000
commit9b837d66d4647a7642a761cefe5798d30a21504a (patch)
treee5e96cd1a48850a699f0e77a748d415921f7b18e /backends/platform/symbian
parent5886a0cc7715c874919a7056dfb6b65d3be19dce (diff)
downloadscummvm-rg350-9b837d66d4647a7642a761cefe5798d30a21504a.tar.gz
scummvm-rg350-9b837d66d4647a7642a761cefe5798d30a21504a.tar.bz2
scummvm-rg350-9b837d66d4647a7642a761cefe5798d30a21504a.zip
Replace Audio::MixerImpl::setOutputRate with a new 'sampleRate' param to the MixerImpl constructor
svn-id: r48238
Diffstat (limited to 'backends/platform/symbian')
-rw-r--r--backends/platform/symbian/src/SymbianOS.cpp37
-rw-r--r--backends/platform/symbian/src/SymbianOS.h4
2 files changed, 15 insertions, 26 deletions
diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp
index 480b62849e..f8df2a5d5c 100644
--- a/backends/platform/symbian/src/SymbianOS.cpp
+++ b/backends/platform/symbian/src/SymbianOS.cpp
@@ -220,28 +220,22 @@ void OSystem_SDL_Symbian::setupMixer() {
SDL_AudioSpec desired;
SDL_AudioSpec obtained;
- memset(&desired, 0, sizeof(desired));
-
+ // Determine the desired output sampling frequency.
uint32 samplesPerSec = 0;
-
if (ConfMan.hasKey("output_rate"))
samplesPerSec = ConfMan.getInt("output_rate");
-
if (samplesPerSec <= 0)
samplesPerSec = SAMPLES_PER_SEC;
- // Originally, we always used 2048 samples. This loop will produce the
- // same result at 22050 Hz, and should hopefully produce something
- // sensible for other frequencies. Note that it must be a power of two.
-
- uint32 samples = 0x8000;
-
- for (;;) {
- if ((1000 * samples) / samplesPerSec < 100)
- break;
+ // Determine the sample buffer size. We want it to store enough data for
+ // at least 1/16th of a second (though at most 8192 samples). Note
+ // that it must be a power of two. So e.g. at 22050 Hz, we request a
+ // sample buffer size of 2048.
+ uint32 samples = 8192;
+ while (samples * 16 > samplesPerSec * 2)
samples >>= 1;
- }
+ memset(&desired, 0, sizeof(desired));
desired.freq = samplesPerSec;
desired.format = AUDIO_S16SYS;
desired.channels = 2;
@@ -249,14 +243,11 @@ void OSystem_SDL_Symbian::setupMixer() {
desired.callback = symbianMixCallback;
desired.userdata = this;
- // Create the mixer instance
assert(!_mixer);
- _mixer = new Audio::MixerImpl(this);
- assert(_mixer);
-
if (SDL_OpenAudio(&desired, &obtained) != 0) {
warning("Could not open audio device: %s", SDL_GetError());
- samplesPerSec = 0;
+ _mixer = new Audio::MixerImpl(this, samplesPerSec);
+ assert(_mixer);
_mixer->setReady(false);
} else {
// Note: This should be the obtained output rate, but it seems that at
@@ -270,16 +261,16 @@ void OSystem_SDL_Symbian::setupMixer() {
_stereo_mix_buffer = new byte [obtained.size*2];//*2 for stereo values
}
- // Tell the mixer that we are ready and start the sound processing
- _mixer->setOutputRate(samplesPerSec);
+ // Create the mixer instance and start the sound processing
+ _mixer = new Audio::MixerImpl(this, samplesPerSec);
+ assert(_mixer);
_mixer->setReady(true);
SDL_PauseAudio(0);
}
}
/**
- * The mixer callback function, passed on to OSystem::setSoundCallback().
- * This simply calls the mix() method.
+ * The mixer callback function.
*/
void OSystem_SDL_Symbian::symbianMixCallback(void *sys, byte *samples, int len) {
OSystem_SDL_Symbian *this_ = (OSystem_SDL_Symbian *)sys;
diff --git a/backends/platform/symbian/src/SymbianOS.h b/backends/platform/symbian/src/SymbianOS.h
index 5c6b7c505c..42929f8029 100644
--- a/backends/platform/symbian/src/SymbianOS.h
+++ b/backends/platform/symbian/src/SymbianOS.h
@@ -63,9 +63,7 @@ public:
RFs& FsSession();
protected:
//
- // The mixer callback function, passed on to OSystem::setSoundCallback().
- // This simply calls the mix() method.
- // and then does downmixing for symbian if needed
+ // The mixer callback function.
//
static void symbianMixCallback(void *s, byte *samples, int len);