From abee80062051164aa4931527a54c07046dbc1394 Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Tue, 6 Dec 2016 20:13:02 +0300 Subject: Added Nuked OPL3 emulator (which is more accurate than DosBox's) Also: - Fixed warnings in the CLang code model plugin for Qt Creator - Fixed bend coefficient which caused incorrect hi-hats in DMX banks --- src/adlmidi.h | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/adlmidi.h') diff --git a/src/adlmidi.h b/src/adlmidi.h index c9aaa3e..e945f29 100644 --- a/src/adlmidi.h +++ b/src/adlmidi.h @@ -28,7 +28,8 @@ extern "C" { #endif -struct ADL_MIDIPlayer { +struct ADL_MIDIPlayer +{ unsigned int AdlBank; unsigned int NumFourOps; unsigned int NumCards; @@ -49,9 +50,9 @@ struct ADL_MIDIPlayer { double maxdelay; /*For internal usage*/ - int stored_samples; //num of collected samples - int backup_samples[1024]; //Backup sample storage. - int backup_samples_size; //Backup sample storage. + int stored_samples; //num of collected samples + short backup_samples[1024]; //Backup sample storage. + int backup_samples_size; //Backup sample storage. /*For internal usage*/ void *adl_midiPlayer; @@ -59,62 +60,61 @@ struct ADL_MIDIPlayer { }; /* Sets number of emulated sound cards (from 1 to 100). Emulation of multiple sound cards exchanges polyphony limits*/ -extern int adl_setNumCards(struct ADL_MIDIPlayer*device, int numCards); +extern int adl_setNumCards(struct ADL_MIDIPlayer *device, int numCards); /* Sets a number of the patches bank from 0 to N banks */ -extern int adl_setBank(struct ADL_MIDIPlayer* device, int bank); +extern int adl_setBank(struct ADL_MIDIPlayer *device, int bank); /* Returns total number of available banks */ extern int adl_getBanksCount(); /* Returns pointer to array of names of every bank */ -extern const char * const* adl_getBankNames(); +extern const char *const *adl_getBankNames(); /*Sets number of 4-chan operators*/ -extern int adl_setNumFourOpsChn(struct ADL_MIDIPlayer*device, int ops4); +extern int adl_setNumFourOpsChn(struct ADL_MIDIPlayer *device, int ops4); /*Enable or disable AdLib percussion mode*/ -extern void adl_setPercMode(struct ADL_MIDIPlayer* device, int percmod); +extern void adl_setPercMode(struct ADL_MIDIPlayer *device, int percmod); /*Enable or disable deep vibrato*/ -extern void adl_setHVibrato(struct ADL_MIDIPlayer* device, int hvibro); +extern void adl_setHVibrato(struct ADL_MIDIPlayer *device, int hvibro); /*Enable or disable deep tremolo*/ -extern void adl_setHTremolo(struct ADL_MIDIPlayer* device, int htremo); +extern void adl_setHTremolo(struct ADL_MIDIPlayer *device, int htremo); /*Enable or disable Enables scaling of modulator volumes*/ -extern void adl_setScaleModulators(struct ADL_MIDIPlayer* device, int smod); +extern void adl_setScaleModulators(struct ADL_MIDIPlayer *device, int smod); /*Enable or disable built-in loop (built-in loop supports 'loopStart' and 'loopEnd' tags to loop specific part)*/ -extern void adl_setLoopEnabled(struct ADL_MIDIPlayer* device, int loopEn); +extern void adl_setLoopEnabled(struct ADL_MIDIPlayer *device, int loopEn); /*Enable or disable Logariphmic volume changer */ -extern void adl_setLogarithmicVolumes(struct ADL_MIDIPlayer* device, int logvol); +extern void adl_setLogarithmicVolumes(struct ADL_MIDIPlayer *device, int logvol); /*Returns string which contains last error message*/ -extern const char* adl_errorString(); +extern const char *adl_errorString(); /*Initialize ADLMIDI Player device*/ -extern struct ADL_MIDIPlayer* adl_init(long sample_rate); +extern struct ADL_MIDIPlayer *adl_init(long sample_rate); /*Load MIDI file from File System*/ -extern int adl_openFile(struct ADL_MIDIPlayer* device, char *filePath); +extern int adl_openFile(struct ADL_MIDIPlayer *device, char *filePath); /*Load MIDI file from memory data*/ -extern int adl_openData(struct ADL_MIDIPlayer* device, void* mem, long size); +extern int adl_openData(struct ADL_MIDIPlayer *device, void *mem, long size); /*Resets MIDI player*/ -extern void adl_reset(struct ADL_MIDIPlayer*device); +extern void adl_reset(struct ADL_MIDIPlayer *device); /*Close and delete ADLMIDI device*/ extern void adl_close(struct ADL_MIDIPlayer *device); /*Take a sample buffer*/ -extern int adl_play(struct ADL_MIDIPlayer*device, int sampleCount, short out[]); +extern int adl_play(struct ADL_MIDIPlayer *device, int sampleCount, short out[]); #ifdef __cplusplus - } +} #endif #endif // ADLMIDI_H - -- cgit v1.2.3 From 28a253742adfb1ac6199b0f068701f071db6299b Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Fri, 9 Dec 2016 19:15:39 +0300 Subject: Added a changalbe volume ranges model (to allow banks play sound be more native like to their original implementations) --- src/adlmidi.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/adlmidi.h') diff --git a/src/adlmidi.h b/src/adlmidi.h index e945f29..9c09028 100644 --- a/src/adlmidi.h +++ b/src/adlmidi.h @@ -28,6 +28,16 @@ extern "C" { #endif +enum ADLMIDI_VolumeModels +{ + ADLMIDI_VolumeModel_AUTO = 0, + ADLMIDI_VolumeModel_Generic, + ADLMIDI_VolumeModel_CMF, + ADLMIDI_VolumeModel_DMX, + ADLMIDI_VolumeModel_APOGEE, + ADLMIDI_VolumeModel_9X +}; + struct ADL_MIDIPlayer { unsigned int AdlBank; @@ -37,6 +47,7 @@ struct ADL_MIDIPlayer unsigned int HighVibratoMode; unsigned int AdlPercussionMode; unsigned int LogarithmicVolumes; + int VolumeModel; unsigned int QuitFlag; unsigned int SkipForward; unsigned int QuitWithoutLooping; @@ -92,6 +103,10 @@ extern void adl_setLoopEnabled(struct ADL_MIDIPlayer *device, int loopEn); /*Enable or disable Logariphmic volume changer */ extern void adl_setLogarithmicVolumes(struct ADL_MIDIPlayer *device, int logvol); +/*Set different volume range model */ +extern void adl_setVolumeRangeModel(struct ADL_MIDIPlayer *device, int volumeModel); + + /*Returns string which contains last error message*/ extern const char *adl_errorString(); -- cgit v1.2.3 From b2890608189a69695a5119e1be771b89278dce9b Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Mon, 16 Jan 2017 08:24:19 +0300 Subject: Split adlmidi.cpp now keeps API functions only other code has been moved into separated files --- src/adlmidi.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/adlmidi.h') diff --git a/src/adlmidi.h b/src/adlmidi.h index 9c09028..89e853f 100644 --- a/src/adlmidi.h +++ b/src/adlmidi.h @@ -2,7 +2,7 @@ * libADLMIDI is a free MIDI to WAV conversion library with OPL3 emulation * * Original ADLMIDI code: Copyright (c) 2010-2014 Joel Yliluoma - * ADLMIDI Library API: Copyright (c) 2016 Vitaly Novichkov + * ADLMIDI Library API: Copyright (c) 2017 Vitaly Novichkov * * Library is based on the ADLMIDI, a MIDI player for Linux and Windows with OPL3 emulation: * http://iki.fi/bisqwit/source/adlmidi.html @@ -55,16 +55,16 @@ struct ADL_MIDIPlayer double delay; double carry; - // The lag between visual content and audio content equals - // the sum of these two buffers. + /* The lag between visual content and audio content equals */ + /* the sum of these two buffers. */ double mindelay; double maxdelay; - /*For internal usage*/ - int stored_samples; //num of collected samples - short backup_samples[1024]; //Backup sample storage. - int backup_samples_size; //Backup sample storage. - /*For internal usage*/ + /* For internal usage */ + int stored_samples; /* num of collected samples */ + short backup_samples[1024]; /* Backup sample storage. */ + int backup_samples_size; /* Backup sample storage. */ + /* For internal usage */ void *adl_midiPlayer; unsigned long PCM_RATE; @@ -132,4 +132,4 @@ extern int adl_play(struct ADL_MIDIPlayer *device, int sampleCount, short out[] } #endif -#endif // ADLMIDI_H +#endif /* ADLMIDI_H */ -- cgit v1.2.3