diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/adlmidi.h | 20 | ||||
-rw-r--r-- | include/adlmidi.hpp | 57 |
2 files changed, 76 insertions, 1 deletions
diff --git a/include/adlmidi.h b/include/adlmidi.h index 24fa4c9..1073721 100644 --- a/include/adlmidi.h +++ b/include/adlmidi.h @@ -104,9 +104,15 @@ extern int adl_openBankData(struct ADL_MIDIPlayer *device, void *mem, long size) /*Returns name of currently used OPL3 emulator*/ extern const char *adl_emulatorName(); -/*Returns string which contains last error message*/ +/*Returns string which contains a version number*/ +extern const char *adl_linkedLibraryVersion(); + +/*Returns string which contains last error message of initialization*/ extern const char *adl_errorString(); +/*Returns string which contains last error message on specific device*/ +extern const char *adl_errorInfo(ADL_MIDIPlayer *device); + /*Initialize ADLMIDI Player device*/ extern struct ADL_MIDIPlayer *adl_init(long sample_rate); @@ -181,6 +187,18 @@ extern int adl_play(struct ADL_MIDIPlayer *device, int sampleCount, short out[] /*Generate audio output from chip emulators without iteration of MIDI timers. 512 samples per channel is a maximum*/ extern int adl_generate(ADL_MIDIPlayer *device, int sampleCount, short *out); +/** + * @brief Periodic tick handler. + * @param device + * @param seconds seconds since last call + * @param granularity don't expect intervals smaller than this, in seconds + * @return desired number of seconds until next call + * + * Use it for Hardware OPL3 mode or when you want to process events differently from adl_play() function. + * DON'T USE IT TOGETHER WITH adl_play()!!! + */ +extern double adl_tickEvents(ADL_MIDIPlayer *device, double seconds, double granuality); + /**Hooks**/ typedef void (*ADL_RawEventHook)(void *userdata, ADL_UInt8 type, ADL_UInt8 subtype, ADL_UInt8 channel, ADL_UInt8 *data, size_t len); diff --git a/include/adlmidi.hpp b/include/adlmidi.hpp new file mode 100644 index 0000000..c589e3b --- /dev/null +++ b/include/adlmidi.hpp @@ -0,0 +1,57 @@ +/* + * libADLMIDI is a free MIDI to WAV conversion library with OPL3 emulation + * + * Original ADLMIDI code: Copyright (c) 2010-2014 Joel Yliluoma <bisqwit@iki.fi> + * ADLMIDI Library API: Copyright (c) 2017 Vitaly Novichkov <admin@wohlnet.ru> + * + * Library is based on the ADLMIDI, a MIDI player for Linux and Windows with OPL3 emulation: + * http://iki.fi/bisqwit/source/adlmidi.html + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef ADLMIDI_HPP +#define ADLMIDI_HPP + +#include "adlmidi.h" + +#include <stdint.h> +#include <vector> + +class OPL3; +class MIDIplay; + +class AdlInstrumentTester +{ + uint32_t cur_gm; + uint32_t ins_idx; + std::vector<uint32_t> adl_ins_list; + OPL3 *opl; + MIDIplay * play; + +public: + AdlInstrumentTester(ADL_MIDIPlayer *device); + virtual ~AdlInstrumentTester(); + + // Find list of adlib instruments that supposedly implement this GM + void FindAdlList(); + void Touch(unsigned c, unsigned volume); + void DoNote(int note); + void NextGM(int offset); + void NextAdl(int offset); + bool HandleInputChar(char ch); +}; + +#endif //ADLMIDI_HPP + |