aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi.cpp
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2017-10-17 03:57:21 +0300
committerWohlstand <admin@wohlnet.ru>2017-10-17 03:57:21 +0300
commitc07b146a1a3991edd6c3233dcd1956b989303dd3 (patch)
treec48650bbdcc9d64c2b4179cc3df9fd0fcd0ecbd6 /src/adlmidi.cpp
parent3a1a97809d0a9b88916e5213f239fac046244241 (diff)
downloadlibADLMIDI-c07b146a1a3991edd6c3233dcd1956b989303dd3.tar.gz
libADLMIDI-c07b146a1a3991edd6c3233dcd1956b989303dd3.tar.bz2
libADLMIDI-c07b146a1a3991edd6c3233dcd1956b989303dd3.zip
EXPERIMENTAL: Support for custom banks!
TODO: Fix support for real 4-operator support for dynamical instruments which now are silent. 2-op and pseudo-4-op still work fine.
Diffstat (limited to 'src/adlmidi.cpp')
-rw-r--r--src/adlmidi.cpp46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp
index 3d9d1cb..79c1422 100644
--- a/src/adlmidi.cpp
+++ b/src/adlmidi.cpp
@@ -186,7 +186,7 @@ ADLMIDI_EXPORT void adl_setLogarithmicVolumes(struct ADL_MIDIPlayer *device, int
reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->opl.LogarithmicVolumes = (bool)device->LogarithmicVolumes;
}
-ADLMIDI_EXPORT void adl_setVolumeRangeModel(ADL_MIDIPlayer *device, int volumeModel)
+ADLMIDI_EXPORT void adl_setVolumeRangeModel(struct ADL_MIDIPlayer *device, int volumeModel)
{
if(!device) return;
@@ -194,6 +194,50 @@ ADLMIDI_EXPORT void adl_setVolumeRangeModel(ADL_MIDIPlayer *device, int volumeMo
reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->opl.ChangeVolumeRangesModel(static_cast<ADLMIDI_VolumeModels>(volumeModel));
}
+ADLMIDI_EXPORT int adl_openBankFile(struct ADL_MIDIPlayer *device, char *filePath)
+{
+ ADLMIDI_ErrorString.clear();
+
+ if(device && device->adl_midiPlayer)
+ {
+ device->stored_samples = 0;
+ device->backup_samples_size = 0;
+
+ if(!reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->LoadBank(filePath))
+ {
+ if(ADLMIDI_ErrorString.empty())
+ ADLMIDI_ErrorString = "ADL MIDI: Can't load file";
+ return -1;
+ }
+ else return 0;
+ }
+
+ ADLMIDI_ErrorString = "Can't load file: ADLMIDI is not initialized";
+ return -1;
+}
+
+ADLMIDI_EXPORT int adl_openBankData(struct ADL_MIDIPlayer *device, void *mem, long size)
+{
+ ADLMIDI_ErrorString.clear();
+
+ if(device && device->adl_midiPlayer)
+ {
+ device->stored_samples = 0;
+ device->backup_samples_size = 0;
+
+ if(!reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->LoadBank(mem, static_cast<size_t>(size)))
+ {
+ if(ADLMIDI_ErrorString.empty())
+ ADLMIDI_ErrorString = "ADL MIDI: Can't load data from memory";
+ return -1;
+ }
+ else return 0;
+ }
+
+ ADLMIDI_ErrorString = "Can't load file: ADL MIDI is not initialized";
+ return -1;
+}
+
ADLMIDI_EXPORT int adl_openFile(ADL_MIDIPlayer *device, char *filePath)
{
ADLMIDI_ErrorString.clear();