aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordhewg2011-03-26 11:41:06 +0100
committerdhewg2011-03-26 11:54:17 +0100
commit153e67b37c6b510e975e16bf6ccc591fdc60838f (patch)
tree711d607148c7a8d5c057cfd3a01c043370d8080d
parent6ec9c9f62d149b91854e180b8089633660836450 (diff)
downloadscummvm-rg350-153e67b37c6b510e975e16bf6ccc591fdc60838f.tar.gz
scummvm-rg350-153e67b37c6b510e975e16bf6ccc591fdc60838f.tar.bz2
scummvm-rg350-153e67b37c6b510e975e16bf6ccc591fdc60838f.zip
ANDROID: Maybe working support for EAS DLS soundfonts
-rw-r--r--audio/softsynth/eas.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/audio/softsynth/eas.cpp b/audio/softsynth/eas.cpp
index 5b6bdad22a..1a406ad13a 100644
--- a/audio/softsynth/eas.cpp
+++ b/audio/softsynth/eas.cpp
@@ -94,12 +94,20 @@ private:
char *GUID;
};
+ struct EASFile {
+ const char *path;
+ int fd;
+ long long offset;
+ long long length;
+ };
+
typedef void * EASDataHandle;
typedef void * EASHandle;
typedef EASLibConfig *(*ConfigFunc)();
typedef int32 (*InitFunc)(EASDataHandle *);
typedef int32 (*ShutdownFunc)(EASDataHandle);
+ typedef int32 (*LoadDLSFunc)(EASDataHandle, EASHandle, EASFile *);
typedef int32 (*SetParameterFunc)(EASDataHandle, int32, int32, int32);
typedef int32 (*OpenStreamFunc)(EASDataHandle, EASHandle *, EASHandle);
typedef int32 (*WriteStreamFunc)(EASDataHandle, EASHandle, byte *, int32);
@@ -128,6 +136,7 @@ private:
ConfigFunc _configFunc;
InitFunc _initFunc;
ShutdownFunc _shutdownFunc;
+ LoadDLSFunc _loadDLSFunc;
SetParameterFunc _setParameterFunc;
OpenStreamFunc _openStreamFunc;
WriteStreamFunc _writeStreamFunc;
@@ -153,6 +162,7 @@ MidiDriver_EAS::MidiDriver_EAS() :
_configFunc(0),
_initFunc(0),
_shutdownFunc(0),
+ _loadDLSFunc(0),
_setParameterFunc(0),
_openStreamFunc(0),
_writeStreamFunc(0),
@@ -216,13 +226,14 @@ int MidiDriver_EAS::open() {
sym(_initFunc, "EAS_Init");
sym(_shutdownFunc, "EAS_Shutdown");
+ sym(_loadDLSFunc, "EAS_LoadDLSCollection");
sym(_setParameterFunc, "EAS_SetParameter");
sym(_openStreamFunc, "EAS_OpenMIDIStream");
sym(_writeStreamFunc, "EAS_WriteMIDIStream");
sym(_closeStreamFunc, "EAS_CloseMIDIStream");
sym(_renderFunc, "EAS_Render");
- if (!_initFunc || !_shutdownFunc || !_setParameterFunc ||
+ if (!_initFunc || !_shutdownFunc || !_loadDLSFunc || !_setParameterFunc ||
!_openStreamFunc || !_writeStreamFunc || !_closeStreamFunc ||
!_renderFunc) {
close();
@@ -262,6 +273,23 @@ int MidiDriver_EAS::open() {
"tempo:%u rounds:%u", _config->voices, _config->channels,
_config->rate, _config->bufSize, _baseTempo, _rounds);
+ // TODO doesn't seem to work with midi streams?
+ if (ConfMan.hasKey("soundfont")) {
+ const Common::String dls = ConfMan.get("soundfont");
+
+ debug("loading DLS file '%s'", dls.c_str());
+
+ EASFile f;
+ memset(&f, 0, sizeof(EASFile));
+ f.path = dls.c_str();
+
+ res = _loadDLSFunc(_EASHandle, 0, &f);
+ if (res)
+ warning("error loading DLS file '%s': %d", dls.c_str(), res);
+ else
+ debug("DLS file loaded");
+ }
+
#ifdef EAS_DUMPSTREAM
if (!_dump.open("/sdcard/eas.dump"))
warning("error opening EAS dump file");