diff options
author | Vitaly Novichkov <admin@wohlnet.ru> | 2018-06-03 18:37:06 +0300 |
---|---|---|
committer | Vitaly Novichkov <admin@wohlnet.ru> | 2018-06-03 18:37:06 +0300 |
commit | cc75a4de42b54eb096b8b9222b86a4f15c9684df (patch) | |
tree | 8ac53b171970b6297fc23acee5b9ddd2942dc442 | |
parent | adcf702a7e18846ad4f8753ec5a32cf56585ca23 (diff) | |
parent | 64254a351652011b00f700b27863ec6659205273 (diff) | |
download | libADLMIDI-cc75a4de42b54eb096b8b9222b86a4f15c9684df.tar.gz libADLMIDI-cc75a4de42b54eb096b8b9222b86a4f15c9684df.tar.bz2 libADLMIDI-cc75a4de42b54eb096b8b9222b86a4f15c9684df.zip |
Merge branch 'hq-resampler'
-rw-r--r-- | CMakeLists.txt | 30 | ||||
-rw-r--r-- | src/chips/nuked_opl3.cpp | 91 | ||||
-rw-r--r-- | src/chips/nuked_opl3.h | 13 | ||||
-rw-r--r-- | src/chips/nuked_opl3_v174.cpp | 91 | ||||
-rw-r--r-- | src/chips/nuked_opl3_v174.h | 13 | ||||
-rw-r--r-- | utils/adlmidi-2/9x15.hpp | 10 | ||||
-rw-r--r-- | utils/adlmidi-2/midiplay.cc | 1 | ||||
-rw-r--r-- | utils/adlmidi-2/puzzlegame.cc | 2 | ||||
-rwxr-xr-x | utils/adlmidi-2/puzzlegame.hpp | 2 | ||||
-rw-r--r-- | utils/dumpbank/dumpbank.cpp | 7 | ||||
-rw-r--r-- | utils/dumpmiles/dumpmiles.cpp | 9 | ||||
-rw-r--r-- | utils/vlc_codec/libadlmidi.c | 32 |
12 files changed, 256 insertions, 45 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ce162a0..5520399 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,7 @@ option(WITH_CPP_EXTRAS "Build with support for C++ extras (features are can option(WITH_MIDI_SEQUENCER "Build with embedded MIDI sequencer. Disable this if you want use library in real-time MIDI drivers or plugins.)" ON) option(WITH_MUS_SUPPORT "Build with support for DMX MUS files)" ON) option(WITH_XMI_SUPPORT "Build with support for AIL XMI files)" ON) +option(WITH_HQ_RESAMPLER "Build with support for high quality resampling" OFF) option(libADLMIDI_STATIC "Build static library of libADLMIDI" ON) option(libADLMIDI_SHARED "Build shared library of libADLMIDI" OFF) @@ -276,9 +277,9 @@ endif() add_library(ADLMIDI INTERFACE) if(libADLMIDI_SHARED) - target_link_libraries(ADLMIDI INTERFACE ADLMIDI_shared) + target_link_libraries(ADLMIDI INTERFACE ADLMIDI_shared) else() - target_link_libraries(ADLMIDI INTERFACE ADLMIDI_static) + target_link_libraries(ADLMIDI INTERFACE ADLMIDI_static) endif() if(WITH_MIDIPLAY) @@ -338,6 +339,8 @@ if(WITH_MIDIPLAY) endif() if(WITH_ADLMIDI2) + find_package(OpenMP) + if(NOT WIN32 AND NOT DJGPP AND NOT MSDOS) find_library(SDL2_LIBRARY SDL2 REQUIRED) include_directories(${SDL2_INCLUDE_DIR}) @@ -349,6 +352,7 @@ if(WITH_ADLMIDI2) set(ADLMIDI2_VIDEO_OUT_SUPPORT "TRUE") endif() + set(adlmidi2_src) list(APPEND adlmidi2_src ${libADLMIDI_SOURCE_DIR}/utils/adlmidi-2/midiplay.cc @@ -361,11 +365,11 @@ if(WITH_ADLMIDI2) add_executable(adlmidi2 ${adlmidi2_src}) if(ADLMIDI2_HAS_PUZZLE_GAME) - target_compile_options(adlmidi2 PUBLIC "-DSUPPORT_PUZZLE_GAME") + target_compile_definitions(adlmidi2 PUBLIC "-DSUPPORT_PUZZLE_GAME") endif() if(ADLMIDI2_VIDEO_OUT_SUPPORT) - target_compile_options(adlmidi2 PUBLIC "-DSUPPORT_VIDEO_OUTPUT") + target_compile_definitions(adlmidi2 PUBLIC "-DSUPPORT_VIDEO_OUTPUT") endif() if(WIN32) @@ -391,6 +395,10 @@ if(WITH_ADLMIDI2) CXX_STANDARD 11 CXX_STANDARD_REQUIRED YES) endif() + if(OPENMP_FOUND) + target_compile_options(adlmidi2 PUBLIC "-fopenmp") + target_link_libraries(adlmidi2 "-fopenmp") + endif() else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") message("Turned on C++11 on MSVC") target_compile_options(adlmidi2 PUBLIC "/std:c++latest") @@ -399,7 +407,7 @@ if(WITH_ADLMIDI2) if(libADLMIDI_SHARED) add_dependencies(adlmidi2 ADLMIDI_shared) # ========= WIP ========= - # set_target_properties(adlmidiplay PROPERTIES COMPILE_FLAGS "-Wl,-rpath='$$ORIGIN/../lib'") + set_target_properties(adlmidi2 PROPERTIES COMPILE_FLAGS "-Wl,-rpath='$$ORIGIN/../lib'") else() if(NOT libADLMIDI_STATIC) message(FATAL_ERROR "libADLMIDI is required to be built!") @@ -480,6 +488,17 @@ if(WITH_VLC_PLUGIN) endif() +if(WITH_HQ_RESAMPLER) + find_library(ZITA_RESAMPLER_LIBRARY "zita-resampler" REQUIRED) + add_definitions(-DADLMIDI_ENABLE_HQ_RESAMPLER) + if(libADLMIDI_SHARED) + target_link_libraries(ADLMIDI_shared PUBLIC "${ZITA_RESAMPLER_LIBRARY}") + endif() + if(libADLMIDI_STATIC) + target_link_libraries(ADLMIDI_static PUBLIC "${ZITA_RESAMPLER_LIBRARY}") + endif() +endif() + install(TARGETS ${libADLMIDI_INSTALLS} RUNTIME DESTINATION "bin" LIBRARY DESTINATION "lib" @@ -512,6 +531,7 @@ message("WITH_MIDI_SEQUENCER = ${WITH_MIDI_SEQUENCER}") message("WITH_CPP_EXTRAS = ${WITH_CPP_EXTRAS}") message("WITH_MUS_SUPPORT = ${WITH_MUS_SUPPORT}") message("WITH_XMI_SUPPORT = ${WITH_XMI_SUPPORT}") +message("WITH_HQ_RESAMPLER = ${WITH_HQ_RESAMPLER}") message("libADLMIDI_STATIC = ${libADLMIDI_STATIC}") message("libADLMIDI_SHARED = ${libADLMIDI_SHARED}") message("EXAMPLE_SDL2_AUDIO = ${EXAMPLE_SDL2_AUDIO}") diff --git a/src/chips/nuked_opl3.cpp b/src/chips/nuked_opl3.cpp index 70fc525..fc6363d 100644 --- a/src/chips/nuked_opl3.cpp +++ b/src/chips/nuked_opl3.cpp @@ -1,26 +1,29 @@ #include "nuked_opl3.h" #include "nuked/nukedopl3.h" #include <cstring> +#include <cmath> + +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) +#include <zita-resampler/vresampler.h> +#endif NukedOPL3::NukedOPL3() : OPLChipBase() { m_chip = new opl3_chip; +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + m_resampler = new VResampler; +#endif reset(m_rate); } -NukedOPL3::NukedOPL3(const NukedOPL3 &c): - OPLChipBase(c) -{ - m_chip = new opl3_chip; - std::memset(m_chip, 0, sizeof(opl3_chip)); - reset(c.m_rate); -} - NukedOPL3::~NukedOPL3() { opl3_chip *chip_r = reinterpret_cast<opl3_chip*>(m_chip); delete chip_r; +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + delete m_resampler; +#endif } void NukedOPL3::setRate(uint32_t rate) @@ -29,6 +32,9 @@ void NukedOPL3::setRate(uint32_t rate) opl3_chip *chip_r = reinterpret_cast<opl3_chip*>(m_chip); std::memset(chip_r, 0, sizeof(opl3_chip)); OPL3_Reset(chip_r, rate); +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + m_resampler->setup(rate * (1.0 / 49716), 2, 48); +#endif } void NukedOPL3::reset() @@ -49,15 +55,34 @@ void NukedOPL3::writeReg(uint16_t addr, uint8_t data) int NukedOPL3::generate(int16_t *output, size_t frames) { +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + for(size_t i = 0; i < frames; ++i) + { + generateResampledHq(output); + output += 2; + } +#else opl3_chip *chip_r = reinterpret_cast<opl3_chip*>(m_chip); OPL3_GenerateStream(chip_r, output, (Bit32u)frames); +#endif return (int)frames; } int NukedOPL3::generateAndMix(int16_t *output, size_t frames) { +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + for(size_t i = 0; i < frames; ++i) + { + int16_t frame[2]; + generateResampledHq(frame); + output[0] += (int32_t)frame[0]; + output[1] += (int32_t)frame[1]; + output += 2; + } +#else opl3_chip *chip_r = reinterpret_cast<opl3_chip*>(m_chip); OPL3_GenerateStreamMix(chip_r, output, (Bit32u)frames); +#endif return (int)frames; } @@ -65,10 +90,15 @@ int NukedOPL3::generate32(int32_t *output, size_t frames) { opl3_chip *chip_r = reinterpret_cast<opl3_chip*>(m_chip); for(size_t i = 0; i < frames; ++i) { +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + (void)chip_r; + generateResampledHq32(output); +#else int16_t frame[2]; OPL3_GenerateResampled(chip_r, frame); output[0] = (int32_t)frame[0]; output[1] = (int32_t)frame[1]; +#endif output += 2; } return (int)frames; @@ -78,8 +108,14 @@ int NukedOPL3::generateAndMix32(int32_t *output, size_t frames) { opl3_chip *chip_r = reinterpret_cast<opl3_chip*>(m_chip); for(size_t i = 0; i < frames; ++i) { +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + (void)chip_r; + int32_t frame[2]; + generateResampledHq32(frame); +#else int16_t frame[2]; OPL3_GenerateResampled(chip_r, frame); +#endif output[0] += (int32_t)frame[0]; output[1] += (int32_t)frame[1]; output += 2; @@ -87,6 +123,45 @@ int NukedOPL3::generateAndMix32(int32_t *output, size_t frames) return (int)frames; } +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) +void NukedOPL3::generateResampledHq(int16_t *out) +{ + int32_t temps[2]; + generateResampledHq32(temps); + for(unsigned i = 0; i < 2; ++i) + { + int32_t temp = temps[i]; + temp = (temp > -32768) ? temp : -32768; + temp = (temp < 32767) ? temp : 32767; + out[i] = temp; + } +} + +void NukedOPL3::generateResampledHq32(int32_t *out) +{ + opl3_chip *chip_r = reinterpret_cast<opl3_chip*>(m_chip); + VResampler *rsm = m_resampler; + float f_in[2]; + float f_out[2]; + rsm->inp_count = 0; + rsm->inp_data = f_in; + rsm->out_count = 1; + rsm->out_data = f_out; + while(rsm->process(), rsm->out_count != 0) + { + int16_t in[2]; + OPL3_Generate(chip_r, in); + f_in[0] = (float)in[0], f_in[1] = (float)in[1]; + rsm->inp_count = 1; + rsm->inp_data = f_in; + rsm->out_count = 1; + rsm->out_data = f_out; + } + out[0] = std::lround(f_out[0]); + out[1] = std::lround(f_out[1]); +} +#endif + const char *NukedOPL3::emulatorName() { return "Nuked OPL3 (v 1.8)"; diff --git a/src/chips/nuked_opl3.h b/src/chips/nuked_opl3.h index ceb1dfd..765a451 100644 --- a/src/chips/nuked_opl3.h +++ b/src/chips/nuked_opl3.h @@ -3,12 +3,18 @@ #include "opl_chip_base.h" +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) +class VResampler; +#endif + class NukedOPL3 final : public OPLChipBase { void *m_chip; +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + VResampler *m_resampler; +#endif public: NukedOPL3(); - NukedOPL3(const NukedOPL3 &c); virtual ~NukedOPL3() override; virtual void setRate(uint32_t rate) override; @@ -20,6 +26,11 @@ public: virtual int generate32(int32_t *output, size_t frames) override; virtual int generateAndMix32(int32_t *output, size_t frames) override; virtual const char *emulatorName() override; +private: +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + void generateResampledHq(int16_t *out); + void generateResampledHq32(int32_t *out); +#endif }; #endif // NUKED_OPL3_H diff --git a/src/chips/nuked_opl3_v174.cpp b/src/chips/nuked_opl3_v174.cpp index 0dcf925..675e104 100644 --- a/src/chips/nuked_opl3_v174.cpp +++ b/src/chips/nuked_opl3_v174.cpp @@ -1,26 +1,29 @@ #include "nuked_opl3_v174.h" #include "nuked/nukedopl3_174.h" #include <cstring> +#include <cmath> + +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) +#include <zita-resampler/vresampler.h> +#endif NukedOPL3v174::NukedOPL3v174() : OPLChipBase() { m_chip = new opl3_chip; +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + m_resampler = new VResampler; +#endif reset(m_rate); } -NukedOPL3v174::NukedOPL3v174(const NukedOPL3v174 &c): - OPLChipBase(c) -{ - m_chip = new opl3_chip; - std::memset(m_chip, 0, sizeof(opl3_chip)); - reset(c.m_rate); -} - NukedOPL3v174::~NukedOPL3v174() { opl3_chip *chip_r = reinterpret_cast<opl3_chip*>(m_chip); delete chip_r; +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + delete m_resampler; +#endif } void NukedOPL3v174::setRate(uint32_t rate) @@ -29,6 +32,9 @@ void NukedOPL3v174::setRate(uint32_t rate) opl3_chip *chip_r = reinterpret_cast<opl3_chip*>(m_chip); std::memset(chip_r, 0, sizeof(opl3_chip)); OPL3v17_Reset(chip_r, rate); +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + m_resampler->setup(rate * (1.0 / 49716), 2, 48); +#endif } void NukedOPL3v174::reset() @@ -49,15 +55,34 @@ void NukedOPL3v174::writeReg(uint16_t addr, uint8_t data) int NukedOPL3v174::generate(int16_t *output, size_t frames) { +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + for(size_t i = 0; i < frames; ++i) + { + generateResampledHq(output); + output += 2; + } +#else opl3_chip *chip_r = reinterpret_cast<opl3_chip*>(m_chip); OPL3v17_GenerateStream(chip_r, output, (Bit32u)frames); +#endif return (int)frames; } int NukedOPL3v174::generateAndMix(int16_t *output, size_t frames) { +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + for(size_t i = 0; i < frames; ++i) + { + int16_t frame[2]; + generateResampledHq(frame); + output[0] += (int32_t)frame[0]; + output[1] += (int32_t)frame[1]; + output += 2; + } +#else opl3_chip *chip_r = reinterpret_cast<opl3_chip*>(m_chip); OPL3v17_GenerateStreamMix(chip_r, output, (Bit32u)frames); +#endif return (int)frames; } @@ -65,10 +90,15 @@ int NukedOPL3v174::generate32(int32_t *output, size_t frames) { opl3_chip *chip_r = reinterpret_cast<opl3_chip*>(m_chip); for(size_t i = 0; i < frames; ++i) { +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + (void)chip_r; + generateResampledHq32(output); +#else int16_t frame[2]; OPL3v17_GenerateResampled(chip_r, frame); output[0] = (int32_t)frame[0]; output[1] = (int32_t)frame[1]; +#endif output += 2; } return (int)frames; @@ -78,8 +108,14 @@ int NukedOPL3v174::generateAndMix32(int32_t *output, size_t frames) { opl3_chip *chip_r = reinterpret_cast<opl3_chip*>(m_chip); for(size_t i = 0; i < frames; ++i) { +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + (void)chip_r; + int32_t frame[2]; + generateResampledHq32(frame); +#else int16_t frame[2]; OPL3v17_GenerateResampled(chip_r, frame); +#endif output[0] += (int32_t)frame[0]; output[1] += (int32_t)frame[1]; output += 2; @@ -87,6 +123,45 @@ int NukedOPL3v174::generateAndMix32(int32_t *output, size_t frames) return (int)frames; } +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) +void NukedOPL3v174::generateResampledHq(int16_t *out) +{ + int32_t temps[2]; + generateResampledHq32(temps); + for(unsigned i = 0; i < 2; ++i) + { + int32_t temp = temps[i]; + temp = (temp > -32768) ? temp : -32768; + temp = (temp < 32767) ? temp : 32767; + out[i] = temp; + } +} + +void NukedOPL3v174::generateResampledHq32(int32_t *out) +{ + opl3_chip *chip_r = reinterpret_cast<opl3_chip*>(m_chip); + VResampler *rsm = m_resampler; + float f_in[2]; + float f_out[2]; + rsm->inp_count = 0; + rsm->inp_data = f_in; + rsm->out_count = 1; + rsm->out_data = f_out; + while(rsm->process(), rsm->out_count != 0) + { + int16_t in[2]; + OPL3v17_Generate(chip_r, in); + f_in[0] = (float)in[0], f_in[1] = (float)in[1]; + rsm->inp_count = 1; + rsm->inp_data = f_in; + rsm->out_count = 1; + rsm->out_data = f_out; + } + out[0] = std::lround(f_out[0]); + out[1] = std::lround(f_out[1]); +} +#endif + const char *NukedOPL3v174::emulatorName() { return "Nuked OPL3 (v 1.7.4)"; diff --git a/src/chips/nuked_opl3_v174.h b/src/chips/nuked_opl3_v174.h index acbdcca..efe65ba 100644 --- a/src/chips/nuked_opl3_v174.h +++ b/src/chips/nuked_opl3_v174.h @@ -3,12 +3,18 @@ #include "opl_chip_base.h" +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) +class VResampler; +#endif + class NukedOPL3v174 final : public OPLChipBase { void *m_chip; +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + VResampler *m_resampler; +#endif public: NukedOPL3v174(); - NukedOPL3v174(const NukedOPL3v174 &c); virtual ~NukedOPL3v174() override; virtual void setRate(uint32_t rate) override; @@ -20,6 +26,11 @@ public: virtual int generate32(int32_t *output, size_t frames) override; virtual int generateAndMix32(int32_t *output, size_t frames) override; virtual const char *emulatorName() override; +private: +#if defined(ADLMIDI_ENABLE_HQ_RESAMPLER) + void generateResampledHq(int16_t *out); + void generateResampledHq32(int32_t *out); +#endif }; #endif // NUKED_OPL3174_H diff --git a/utils/adlmidi-2/9x15.hpp b/utils/adlmidi-2/9x15.hpp index e535d49..76e0660 100644 --- a/utils/adlmidi-2/9x15.hpp +++ b/utils/adlmidi-2/9x15.hpp @@ -160,8 +160,8 @@ struct font9x15: public UIfontBase virtual unsigned GetIndex(char32_t c) const { return ns_font9x15::unicode_to_bitmap_index[c]; } }; -static UIfontBase* Getfont9x15() -{ - static font9x15 f; - return &f; -} +//static UIfontBase* Getfont9x15() +//{ +// static font9x15 f; +// return &f; +//} diff --git a/utils/adlmidi-2/midiplay.cc b/utils/adlmidi-2/midiplay.cc index dfdeb5a..74806eb 100644 --- a/utils/adlmidi-2/midiplay.cc +++ b/utils/adlmidi-2/midiplay.cc @@ -1593,6 +1593,7 @@ int main(int argc, char **argv) UI.Color(7); std::fflush(stderr); std::printf( + "\n\n" "Usage: adlmidi <midifilename> [ <options> ] [ <banknumber> [ <numcards> [ <numfourops>] ] ]\n" " adlmidi <midifilename> -1 To enter instrument tester\n" " -p Enables adlib percussion instrument mode (use with CMF files)\n" diff --git a/utils/adlmidi-2/puzzlegame.cc b/utils/adlmidi-2/puzzlegame.cc index e9d2b9b..f8fa57c 100644 --- a/utils/adlmidi-2/puzzlegame.cc +++ b/utils/adlmidi-2/puzzlegame.cc @@ -4,6 +4,8 @@ #include "input.hpp" #include "puzzlegame.hpp" +char ADLMIDI_PuzzleGame::peeked_input = 0; + unsigned long ADLMIDI_PuzzleGame::TimerRead() { static std::chrono::time_point<std::chrono::system_clock> begin = std::chrono::system_clock::now(); diff --git a/utils/adlmidi-2/puzzlegame.hpp b/utils/adlmidi-2/puzzlegame.hpp index 03ad921..a35f1cb 100755 --- a/utils/adlmidi-2/puzzlegame.hpp +++ b/utils/adlmidi-2/puzzlegame.hpp @@ -36,7 +36,7 @@ namespace ADLMIDI_PuzzleGame void Sound(unsigned/*freq*/, unsigned/*duration*/); void PutCell(int x, int y, unsigned cell); void ScreenPutString(const char* str, unsigned attr, unsigned column, unsigned row); - static char peeked_input = 0; + extern char peeked_input; bool kbhit(); char getch(); diff --git a/utils/dumpbank/dumpbank.cpp b/utils/dumpbank/dumpbank.cpp index 84283e7..d2df74a 100644 --- a/utils/dumpbank/dumpbank.cpp +++ b/utils/dumpbank/dumpbank.cpp @@ -190,5 +190,12 @@ static void LoadBNK(const char* fn) int main(int argc, const char* const* argv) { + if(argc < 2) + { + std::printf("Usage: \n" + " %s filename.bnk\n" + "\n", argv[0]); + return 1; + } LoadBNK(argv[1]); } diff --git a/utils/dumpmiles/dumpmiles.cpp b/utils/dumpmiles/dumpmiles.cpp index 0c2d51b..a1a3816 100644 --- a/utils/dumpmiles/dumpmiles.cpp +++ b/utils/dumpmiles/dumpmiles.cpp @@ -49,5 +49,14 @@ static void LoadMiles(const char* fn) int main(int argc, const char* const* argv) { + if(argc < 2) + { + std::printf("Usage: \n" + " %s filename.opl\n" + "or:\n" + " %s filename.opl\n" + "\n", argv[0], argv[0]); + return 1; + } LoadMiles(argv[1]); } diff --git a/utils/vlc_codec/libadlmidi.c b/utils/vlc_codec/libadlmidi.c index eb20227..aedd718 100644 --- a/utils/vlc_codec/libadlmidi.c +++ b/utils/vlc_codec/libadlmidi.c @@ -18,10 +18,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. *****************************************************************************/ -//#ifdef HAVE_CONFIG_H -//# include "config.h" -//#endif - #include <vlc_common.h> #include <vlc_plugin.h> #include <vlc_codec.h> @@ -44,18 +40,20 @@ #define SOUNDFONT_LONGTEXT N_( \ "Custom bank file to use for software synthesis." ) -//#define CHORUS_TEXT N_("Chorus") +#if 0 /* Old code */ +#define CHORUS_TEXT N_("Chorus") -//#define GAIN_TEXT N_("Synthesis gain") -//#define GAIN_LONGTEXT N_("This gain is applied to synthesis output. " \ -// "High values may cause saturation when many notes are played at a time." ) +#define GAIN_TEXT N_("Synthesis gain") +#define GAIN_LONGTEXT N_("This gain is applied to synthesis output. " \ + "High values may cause saturation when many notes are played at a time." ) -//#define POLYPHONY_TEXT N_("Polyphony") -//#define POLYPHONY_LONGTEXT N_( \ -// "The polyphony defines how many voices can be played at a time. " \ -// "Larger values require more processing power.") +#define POLYPHONY_TEXT N_("Polyphony") +#define POLYPHONY_LONGTEXT N_( \ + "The polyphony defines how many voices can be played at a time. " \ + "Larger values require more processing power.") -//#define REVERB_TEXT N_("Reverb") +#define REVERB_TEXT N_("Reverb") +#endif #define SAMPLE_RATE_TEXT N_("Sample rate") @@ -179,8 +177,11 @@ static void Close (vlc_object_t *p_this) static void Flush (decoder_t *p_dec) { decoder_sys_t *p_sys = p_dec->p_sys; - +#if (LIBVLC_VERSION_MAJOR >= 3) date_Set (&p_sys->end_date, VLC_TS_INVALID); +#else + date_Set (&p_sys->end_date, 0); +#endif adl_panic(p_sys->synth); } @@ -225,8 +226,7 @@ static block_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block) return VLCDEC_SUCCESS; } #else - date_Set (&p_sys->end_date, 0); - adl_panic(p_sys->synth); + Flush (p_dec); #endif } |