diff options
author | Wohlstand <admin@wohlnet.ru> | 2025-03-29 00:44:52 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2025-03-29 00:44:52 +0300 |
commit | e92a4d7285197ab2868aa36f975d73ceee915bea (patch) | |
tree | b5e3af6e6c58145a62ec6394a40e9e65d26a5fcf /src/adlmidi_opl3.hpp | |
parent | 7afda0483ab0af9db624052321b42c3d2a245e75 (diff) | |
download | libADLMIDI-e92a4d7285197ab2868aa36f975d73ceee915bea.tar.gz libADLMIDI-e92a4d7285197ab2868aa36f975d73ceee915bea.tar.bz2 libADLMIDI-e92a4d7285197ab2868aa36f975d73ceee915bea.zip |
Refactored DOS support
Diffstat (limited to 'src/adlmidi_opl3.hpp')
-rw-r--r-- | src/adlmidi_opl3.hpp | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/src/adlmidi_opl3.hpp b/src/adlmidi_opl3.hpp index 362b301..aee049f 100644 --- a/src/adlmidi_opl3.hpp +++ b/src/adlmidi_opl3.hpp @@ -60,10 +60,8 @@ public: uint32_t m_numChannels; //! Just a padding. Reserved. char _padding[4]; -#ifndef ADLMIDI_HW_OPL //! Running chip emulators std::vector<AdlMIDI_SPtr<OPLChipBase > > m_chips; -#endif private: //! Cached patch data, needed by Touch() @@ -90,6 +88,51 @@ private: //! Number channels per chip size_t m_perChipChannels; + /*! + * \brief Current state of the synth (if values matched to setup, chips and arrays won't be fully re-created) + */ + struct State + { + int emulator; + uint32_t numChips; + unsigned long pcm_rate; + + State() + { + clear(); + } + + void clear() + { + emulator = -2; + numChips = 0; + pcm_rate = 0; + } + + bool cmp_rate(unsigned long rate) + { + bool ret = pcm_rate != rate; + + if(ret) + pcm_rate = rate; + + return ret; + } + + bool cmp(int emu, uint32_t chips) + { + bool ret = emu != emulator || chips != numChips; + + if(ret) + { + emulator = emu; + numChips = chips; + } + + return ret; + } + } m_curState; + public: /** * @brief MIDI bank entry @@ -339,12 +382,10 @@ public: */ ADLMIDI_VolumeModels getVolumeScaleModel(); -#ifndef ADLMIDI_HW_OPL /** * @brief Clean up all running emulated chip instances */ void clearChips(); -#endif /** * @brief Reset chip properties and initialize them |