diff options
-rw-r--r-- | audio/softsynth/eas.cpp | 30 |
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"); |