aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordhewg2011-03-26 11:09:43 +0100
committerdhewg2011-03-26 11:11:32 +0100
commit703af39be5ae936b7047a94689805b1acf4f81eb (patch)
tree54d03d5dcbff887df2cca47bf62d5ba2c45ce8f5
parent41762892e03695bbc0fa0cc556cf4cb83ec3768f (diff)
downloadscummvm-rg350-703af39be5ae936b7047a94689805b1acf4f81eb.tar.gz
scummvm-rg350-703af39be5ae936b7047a94689805b1acf4f81eb.tar.bz2
scummvm-rg350-703af39be5ae936b7047a94689805b1acf4f81eb.zip
ANDROID: Add code to dump the EAS stream to a file
-rw-r--r--audio/softsynth/eas.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/audio/softsynth/eas.cpp b/audio/softsynth/eas.cpp
index 9d6cf97297..5b6bdad22a 100644
--- a/audio/softsynth/eas.cpp
+++ b/audio/softsynth/eas.cpp
@@ -30,12 +30,15 @@
#include "common/debug.h"
#include "common/endian.h"
+#include "common/file.h"
#include "common/config-manager.h"
#include "audio/audiostream.h"
#include "audio/mpu401.h"
#include "audio/musicplugin.h"
#include "audio/mixer.h"
+//#define EAS_DUMPSTREAM
+
// NOTE:
// EAS's render function *only* accepts one mix buffer size. it's defined at
// compile time of the library and can be retrieved via EASLibConfig.bufSize
@@ -140,6 +143,8 @@ private:
uint32 _baseTempo;
uint _rounds;
Audio::SoundHandle _soundHandle;
+
+ Common::DumpFile _dump;
};
MidiDriver_EAS::MidiDriver_EAS() :
@@ -160,7 +165,8 @@ MidiDriver_EAS::MidiDriver_EAS() :
_timerParam(0),
_baseTempo(0),
_rounds(0),
- _soundHandle() {
+ _soundHandle(),
+ _dump() {
}
MidiDriver_EAS::~MidiDriver_EAS() {
@@ -256,6 +262,11 @@ int MidiDriver_EAS::open() {
"tempo:%u rounds:%u", _config->voices, _config->channels,
_config->rate, _config->bufSize, _baseTempo, _rounds);
+#ifdef EAS_DUMPSTREAM
+ if (!_dump.open("/sdcard/eas.dump"))
+ warning("error opening EAS dump file");
+#endif
+
g_system->getMixer()->playStream(Audio::Mixer::kMusicSoundType,
&_soundHandle, this, -1,
Audio::Mixer::kMaxChannelVolume, 0,
@@ -276,6 +287,11 @@ void MidiDriver_EAS::close() {
g_system->getMixer()->stopHandle(_soundHandle);
+#ifdef EAS_DUMPSTREAM
+ if (_dump.isOpen())
+ _dump.close();
+#endif
+
// not pretty, but better than a mutex
g_system->delayMillis((_baseTempo * _rounds) / 1000);
@@ -357,6 +373,11 @@ int MidiDriver_EAS::readBuffer(int16 *buffer, const int numSamples) {
return -1;
}
+#ifdef EAS_DUMPSTREAM
+ if (_dump.isOpen())
+ _dump.write(buffer, c * _config->channels * 2);
+#endif
+
buffer += c * _config->channels;
}