aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Apers2004-09-12 12:56:28 +0000
committerChris Apers2004-09-12 12:56:28 +0000
commit30d0b6f7ba5e8e11baaf9dc0c14d41a48c283f70 (patch)
treea82f44c4b5148ad46a715f095b0b581759735760
parent1f8f4c0ea37218f3156b840f9abb97642e3bc346 (diff)
downloadscummvm-rg350-30d0b6f7ba5e8e11baaf9dc0c14d41a48c283f70.tar.gz
scummvm-rg350-30d0b6f7ba5e8e11baaf9dc0c14d41a48c283f70.tar.bz2
scummvm-rg350-30d0b6f7ba5e8e11baaf9dc0c14d41a48c283f70.zip
Make use of --output-rate option + cleanup
svn-id: r15045
-rw-r--r--backends/PalmOS/Src/palmsnd.cpp32
1 files changed, 12 insertions, 20 deletions
diff --git a/backends/PalmOS/Src/palmsnd.cpp b/backends/PalmOS/Src/palmsnd.cpp
index 753d5b9c70..e05203cdd6 100644
--- a/backends/PalmOS/Src/palmsnd.cpp
+++ b/backends/PalmOS/Src/palmsnd.cpp
@@ -21,11 +21,11 @@
*/
#include "stdafx.h"
-#include "palm.h"
+#include "common/config-manager.h"
+#include "palm.h"
#include "pa1lib.h"
-//#define SND_BLOCK (4096)
#define SND_BLOCK (3072)
#define ADPCM_8_KHZ 1
@@ -34,7 +34,7 @@
int OSystem_PALMOS::getOutputSampleRate() const {
- return 8000;
+ return _samplesPerSec;
}
static void ClieSoundCallback(UInt32 UserData) {
@@ -52,37 +52,32 @@ bool OSystem_PALMOS::setSoundCallback(SoundProc proc, void *param) {
_sound.dataP = NULL; // required by sound_handler
_sound.handle = NULL;
+ if (ConfMan.hasKey("output_rate"))
+ _samplesPerSec = ConfMan.getInt("output_rate");
+ else
+ _samplesPerSec = 8000; // default value
+
// try to create sound stream
if (OPTIONS_TST(kOptPalmSoundAPI)) {
void *sndFuncP;
- Boolean isArm;
_sound.handle = MemPtrNew(sizeof(SndStreamRef));
-
-/* if (OPTIONS_TST(kOptDeviceARM)) {
- _arm[PNO_SNDSTREAM].pnoPtr = _PnoInit(ARM_STREAMSND, &_arm[PNO_SNDSTREAM].pnoDesc);
- sndFuncP = (void *)_PnoCall(&_arm[PNO_SNDSTREAM].pnoDesc, NULL);
- isArm = true;
-
- } else*/ {
- sndFuncP = sndCallback;
- isArm = false;
- }
+ sndFuncP = sndCallback;
Err e = SndStreamCreateExtended(
(SndStreamRef *)_sound.handle,
sndOutput,
sndFormatPCM,
- 8000,
+ _samplesPerSec,
sndInt16Little,
sndStereo,
(SndStreamVariableBufferCallback)sndFuncP,
&_sound,
8192,
- isArm);
+ false);
e = e ? e : SndStreamStart(*((SndStreamRef *)_sound.handle));
- e = e ? e : SndStreamSetVolume(*((SndStreamRef *)_sound.handle), 32767);
+ e = e ? e : SndStreamSetVolume(*((SndStreamRef *)_sound.handle), 32767 / 2);
_sound.size = 0; // set by the callback
_sound.set = false;
@@ -124,9 +119,6 @@ void OSystem_PALMOS::clearSoundCallback() {
if (OPTIONS_TST(kOptPalmSoundAPI)) {
SndStreamStop(*((SndStreamRef *)_sound.handle));
SndStreamDelete(*((SndStreamRef *)_sound.handle));
-
- if (_arm[PNO_SNDSTREAM].pnoPtr)
- _PnoFree(&_arm[PNO_SNDSTREAM].pnoDesc, _arm[PNO_SNDSTREAM].pnoPtr);
}
free(_sound.dataP);