Minor changes across codebase for TravisCI integration to build on

OSX/Clang and Linux/GCC.
pull/38/head
dimitri 7 years ago
parent 7aa6d409e0
commit 782d5455d2

@ -4,14 +4,31 @@ sudo: true
matrix: matrix:
include: include:
- os: linux - os: linux
env: CXXFLAGS="-std=c++11"
- os: osx - os: osx
env: CXXFLAGS="-std=c++11"
install: 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: script:
- mkdir build - mkdir build
- cd build - cd build
- cmake .. - cmake -DBUILD_EXAMPLE=FALSE ..
- cmake --build . - cmake --build .
after_success:

@ -36,6 +36,8 @@
#include <atomic> #include <atomic>
#include <assert.h> #include <assert.h>
#include <cstring>
#include <cstdlib>
template <typename T> template <typename T>
class RingBufferT 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. size_t allocatedSize = count + 1; // one bin is used to distinguish between the read and write indices when full.
if (mAllocatedSize) if (mAllocatedSize)
mData = (T *)::realloc(mData, allocatedSize * sizeof(T)); mData = (T *) std::realloc(mData, allocatedSize * sizeof(T));
else else
mData = (T *)::calloc(allocatedSize, sizeof(T)); mData = (T *) std::calloc(allocatedSize, sizeof(T));
assert(mData); assert(mData);

@ -265,19 +265,19 @@ class Dither
{ {
std::uniform_real_distribution<float> distribution; std::uniform_real_distribution<float> distribution;
std::mt19937 gen; std::mt19937 gen;
float prev{ 0.0f }; float previous;
DitherType d; DitherType d;
public: 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) float operator()(float s)
{ {
if (d == DITHER_TRIANGLE) if (d == DITHER_TRIANGLE)
{ {
const float value = distribution(gen); const float value = distribution(gen);
s = s + value - prev; s = s + value - previous;
prev = value; previous = value;
return s; return s;
} }
else return s; else return s;
@ -609,15 +609,15 @@ inline WaveChunkHeader MakeWaveHeader(const EncoderParams param, const int sampl
inline std::map<int, std::string> GetFlacQualityTable() inline std::map<int, std::string> GetFlacQualityTable()
{ {
return { return {
{ 0, "0 (Fastest)" }, { 0, "0 (Fastest)" },
{ 1, "1" }, { 1, "1" },
{ 2, "2" }, { 2, "2" },
{ 3, "3" }, { 3, "3" },
{ 4, "4" }, { 4, "4" },
{ 5, "5 (Default)" }, { 5, "5 (Default)" },
{ 6, "6" }, { 6, "6" },
{ 7, "7" }, { 7, "7" },
{ 8, "8 (Highest)" }, { 8, "8 (Highest)" },
}; };
} }

@ -42,7 +42,7 @@ namespace nqr
virtual ~BaseDecoder() {} virtual ~BaseDecoder() {}
}; };
typedef std::pair<std::string, std::shared_ptr<nqr::BaseDecoder>> DecoderPair; typedef std::pair< std::string, std::shared_ptr<nqr::BaseDecoder> > DecoderPair;
class NyquistIO class NyquistIO
{ {
@ -50,7 +50,7 @@ namespace nqr
std::shared_ptr<nqr::BaseDecoder> GetDecoderForExtension(const std::string & ext); std::shared_ptr<nqr::BaseDecoder> GetDecoderForExtension(const std::string & ext);
void BuildDecoderTable(); void BuildDecoderTable();
void AddDecoderToTable(std::shared_ptr<nqr::BaseDecoder> decoder); void AddDecoderToTable(std::shared_ptr<nqr::BaseDecoder> decoder);
std::map<std::string, std::shared_ptr<BaseDecoder>> decoderTable; std::map< std::string, std::shared_ptr<BaseDecoder> > decoderTable;
NO_MOVE(NyquistIO); NO_MOVE(NyquistIO);

Loading…
Cancel
Save