From 703af39be5ae936b7047a94689805b1acf4f81eb Mon Sep 17 00:00:00 2001 From: dhewg Date: Sat, 26 Mar 2011 11:09:43 +0100 Subject: ANDROID: Add code to dump the EAS stream to a file --- audio/softsynth/eas.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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; } -- cgit v1.2.3