Skip to content

Commit

Permalink
Minor changes across codebase for TravisCI integration to build on
Browse files Browse the repository at this point in the history
OSX/Clang and Linux/GCC.
  • Loading branch information
ddiakopoulos committed Jan 17, 2019
1 parent 7aa6d40 commit 782d545
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 22 deletions.
27 changes: 22 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
6 changes: 4 additions & 2 deletions examples/src/RingBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

#include <atomic>
#include <assert.h>
#include <cstring>
#include <cstdlib>

template <typename T>
class RingBufferT
Expand Down Expand Up @@ -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);

Expand Down
26 changes: 13 additions & 13 deletions include/libnyquist/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,19 +265,19 @@ class Dither
{
std::uniform_real_distribution<float> 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;
Expand Down Expand Up @@ -609,15 +609,15 @@ inline WaveChunkHeader MakeWaveHeader(const EncoderParams param, const int sampl
inline std::map<int, std::string> 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)" },
};
}

Expand Down
4 changes: 2 additions & 2 deletions include/libnyquist/Decoders.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ namespace nqr
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
{
std::string ParsePathForExtension(const std::string & path) const;
std::shared_ptr<nqr::BaseDecoder> GetDecoderForExtension(const std::string & ext);
void BuildDecoderTable();
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);

Expand Down

0 comments on commit 782d545

Please sign in to comment.