diff --git a/.travis.yml b/.travis.yml index 72f82bf..01d5d45 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,14 +4,31 @@ sudo: true matrix: include: - os: linux + env: CXXFLAGS="-std=c++11" - os: osx + env: CXXFLAGS="-std=c++11" install: - + # install latest cmake + - | + if [ "$TRAVIS_OS_NAME" == "linux" ]; then + CMAKE_URL="https://cmake.org/files/v3.11/cmake-3.11.1-Linux-x86_64.tar.gz"; + mkdir cmake_latest && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake_latest; + export PATH=$(pwd)/cmake_latest/bin:${PATH}; + fi + + - | + if [ "${TRAVIS_OS_NAME}" = "osx" ]; then + brew update; + brew uninstall cmake; + brew install cmake; + fi + - which ${CC} + - which ${CXX} + - which cmake + script: - mkdir build - cd build - - cmake .. - - cmake --build . - -after_success: + - cmake -DBUILD_EXAMPLE=FALSE .. + - cmake --build . \ No newline at end of file diff --git a/examples/src/RingBuffer.h b/examples/src/RingBuffer.h index 01c9496..dec2da5 100644 --- a/examples/src/RingBuffer.h +++ b/examples/src/RingBuffer.h @@ -36,6 +36,8 @@ #include #include +#include +#include template class RingBufferT @@ -65,9 +67,9 @@ class RingBufferT size_t allocatedSize = count + 1; // one bin is used to distinguish between the read and write indices when full. if (mAllocatedSize) - mData = (T *)::realloc(mData, allocatedSize * sizeof(T)); + mData = (T *) std::realloc(mData, allocatedSize * sizeof(T)); else - mData = (T *)::calloc(allocatedSize, sizeof(T)); + mData = (T *) std::calloc(allocatedSize, sizeof(T)); assert(mData); diff --git a/include/libnyquist/Common.h b/include/libnyquist/Common.h index b47bc49..0362489 100644 --- a/include/libnyquist/Common.h +++ b/include/libnyquist/Common.h @@ -265,19 +265,19 @@ class Dither { std::uniform_real_distribution distribution; std::mt19937 gen; - float prev{ 0.0f }; + float previous; DitherType d; public: - Dither(DitherType d) : distribution(-0.5f, +0.5f), d(d) {} + Dither(DitherType d) : distribution(-0.5f, +0.5f), d(d), previous(0.f) {} float operator()(float s) { if (d == DITHER_TRIANGLE) { const float value = distribution(gen); - s = s + value - prev; - prev = value; + s = s + value - previous; + previous = value; return s; } else return s; @@ -609,15 +609,15 @@ inline WaveChunkHeader MakeWaveHeader(const EncoderParams param, const int sampl inline std::map GetFlacQualityTable() { return { - { 0, "0 (Fastest)" }, - { 1, "1" }, - { 2, "2" }, - { 3, "3" }, - { 4, "4" }, - { 5, "5 (Default)" }, - { 6, "6" }, - { 7, "7" }, - { 8, "8 (Highest)" }, + { 0, "0 (Fastest)" }, + { 1, "1" }, + { 2, "2" }, + { 3, "3" }, + { 4, "4" }, + { 5, "5 (Default)" }, + { 6, "6" }, + { 7, "7" }, + { 8, "8 (Highest)" }, }; } diff --git a/include/libnyquist/Decoders.h b/include/libnyquist/Decoders.h index a9b7c95..e9b7ec2 100644 --- a/include/libnyquist/Decoders.h +++ b/include/libnyquist/Decoders.h @@ -42,7 +42,7 @@ namespace nqr virtual ~BaseDecoder() {} }; - typedef std::pair> DecoderPair; + typedef std::pair< std::string, std::shared_ptr > DecoderPair; class NyquistIO { @@ -50,7 +50,7 @@ namespace nqr std::shared_ptr GetDecoderForExtension(const std::string & ext); void BuildDecoderTable(); void AddDecoderToTable(std::shared_ptr decoder); - std::map> decoderTable; + std::map< std::string, std::shared_ptr > decoderTable; NO_MOVE(NyquistIO);