From 68c03edbb563983b6ac3e81a826871bfdf9e3bd4 Mon Sep 17 00:00:00 2001 From: Vitaly Novichkov Date: Thu, 13 Dec 2018 02:28:57 +0300 Subject: Build: Splid the main CMake build script Keep it have library code only but no utils and examples are will be built independently #196 --- src/adlmidi_midiplay.cpp | 2 +- src/chips/opl_chip_base.tcc | 4 ++-- src/cvt_xmi2mid.hpp | 16 +++++++++++++--- 3 files changed, 16 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index f96243e..207a300 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -105,7 +105,7 @@ inline bool isXgPercChannel(uint8_t msb, uint8_t lsb) void MIDIplay::AdlChannel::addAge(int64_t us) { - const int64_t neg = 1000 * static_cast(-0x1FFFFFFFll); + const int64_t neg = 1000 * static_cast(-0x1FFFFFFFl); if(users.empty()) { koff_time_until_neglible_us = std::max(koff_time_until_neglible_us - us, neg); diff --git a/src/chips/opl_chip_base.tcc b/src/chips/opl_chip_base.tcc index a64aa7c..e6d3f6b 100644 --- a/src/chips/opl_chip_base.tcc +++ b/src/chips/opl_chip_base.tcc @@ -236,8 +236,8 @@ void OPLChipBaseT::resampledGenerate(int32_t *output) rsm->out_count = 1; rsm->out_data = f_out; } - output[0] = static_cast(std::lround(f_out[0])); - output[1] = static_cast(std::lround(f_out[1])); + output[0] = static_cast(lround(f_out[0])); + output[1] = static_cast(lround(f_out[1])); } #else template diff --git a/src/cvt_xmi2mid.hpp b/src/cvt_xmi2mid.hpp index e8d9dbf..435de81 100644 --- a/src/cvt_xmi2mid.hpp +++ b/src/cvt_xmi2mid.hpp @@ -58,11 +58,21 @@ typedef unsigned long uint32_t; #define XMI2MID_MIDI_STATUS_SYSEX 0xF #if 1 -#define XMI2MID_TRACE(...) +static int XMI2MID_TRACE(...) { return 0; } #else #include -#define XMI2MID_TRACE(fmt, ...) \ - fprintf(stderr, "XMI2MID: " fmt "\n", ## __VA_ARGS__) +#include +static int XMI2MID_TRACE(const char *fmt, int n, ...) +{ + int ret; + char ff[50] = ""; + snprintf(ff, 49, "XMI2MID: %s\n", fmt); + va_list args; + va_start(args, n); + ret = vfprintf(stderr, const_cast(ff), args); + va_end(args); + return ret; +} #endif typedef struct _xmi2mid_midi_event { -- cgit v1.2.3