ANDROID: Maybe working support for EAS DLS soundfonts

This commit is contained in:
dhewg 2011-03-26 11:41:06 +01:00
parent 6ec9c9f62d
commit 153e67b37c

View file

@ -94,12 +94,20 @@ private:
char *GUID; char *GUID;
}; };
struct EASFile {
const char *path;
int fd;
long long offset;
long long length;
};
typedef void * EASDataHandle; typedef void * EASDataHandle;
typedef void * EASHandle; typedef void * EASHandle;
typedef EASLibConfig *(*ConfigFunc)(); typedef EASLibConfig *(*ConfigFunc)();
typedef int32 (*InitFunc)(EASDataHandle *); typedef int32 (*InitFunc)(EASDataHandle *);
typedef int32 (*ShutdownFunc)(EASDataHandle); typedef int32 (*ShutdownFunc)(EASDataHandle);
typedef int32 (*LoadDLSFunc)(EASDataHandle, EASHandle, EASFile *);
typedef int32 (*SetParameterFunc)(EASDataHandle, int32, int32, int32); typedef int32 (*SetParameterFunc)(EASDataHandle, int32, int32, int32);
typedef int32 (*OpenStreamFunc)(EASDataHandle, EASHandle *, EASHandle); typedef int32 (*OpenStreamFunc)(EASDataHandle, EASHandle *, EASHandle);
typedef int32 (*WriteStreamFunc)(EASDataHandle, EASHandle, byte *, int32); typedef int32 (*WriteStreamFunc)(EASDataHandle, EASHandle, byte *, int32);
@ -128,6 +136,7 @@ private:
ConfigFunc _configFunc; ConfigFunc _configFunc;
InitFunc _initFunc; InitFunc _initFunc;
ShutdownFunc _shutdownFunc; ShutdownFunc _shutdownFunc;
LoadDLSFunc _loadDLSFunc;
SetParameterFunc _setParameterFunc; SetParameterFunc _setParameterFunc;
OpenStreamFunc _openStreamFunc; OpenStreamFunc _openStreamFunc;
WriteStreamFunc _writeStreamFunc; WriteStreamFunc _writeStreamFunc;
@ -153,6 +162,7 @@ MidiDriver_EAS::MidiDriver_EAS() :
_configFunc(0), _configFunc(0),
_initFunc(0), _initFunc(0),
_shutdownFunc(0), _shutdownFunc(0),
_loadDLSFunc(0),
_setParameterFunc(0), _setParameterFunc(0),
_openStreamFunc(0), _openStreamFunc(0),
_writeStreamFunc(0), _writeStreamFunc(0),
@ -216,13 +226,14 @@ int MidiDriver_EAS::open() {
sym(_initFunc, "EAS_Init"); sym(_initFunc, "EAS_Init");
sym(_shutdownFunc, "EAS_Shutdown"); sym(_shutdownFunc, "EAS_Shutdown");
sym(_loadDLSFunc, "EAS_LoadDLSCollection");
sym(_setParameterFunc, "EAS_SetParameter"); sym(_setParameterFunc, "EAS_SetParameter");
sym(_openStreamFunc, "EAS_OpenMIDIStream"); sym(_openStreamFunc, "EAS_OpenMIDIStream");
sym(_writeStreamFunc, "EAS_WriteMIDIStream"); sym(_writeStreamFunc, "EAS_WriteMIDIStream");
sym(_closeStreamFunc, "EAS_CloseMIDIStream"); sym(_closeStreamFunc, "EAS_CloseMIDIStream");
sym(_renderFunc, "EAS_Render"); sym(_renderFunc, "EAS_Render");
if (!_initFunc || !_shutdownFunc || !_setParameterFunc || if (!_initFunc || !_shutdownFunc || !_loadDLSFunc || !_setParameterFunc ||
!_openStreamFunc || !_writeStreamFunc || !_closeStreamFunc || !_openStreamFunc || !_writeStreamFunc || !_closeStreamFunc ||
!_renderFunc) { !_renderFunc) {
close(); close();
@ -262,6 +273,23 @@ int MidiDriver_EAS::open() {
"tempo:%u rounds:%u", _config->voices, _config->channels, "tempo:%u rounds:%u", _config->voices, _config->channels,
_config->rate, _config->bufSize, _baseTempo, _rounds); _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 #ifdef EAS_DUMPSTREAM
if (!_dump.open("/sdcard/eas.dump")) if (!_dump.open("/sdcard/eas.dump"))
warning("error opening EAS dump file"); warning("error opening EAS dump file");