13
0

'libs/rubberband' - Platform specific includes

This commit is contained in:
John Emmas 2013-07-25 09:14:40 +01:00
parent a65cfd2aff
commit 1828f5694f
6 changed files with 18 additions and 18 deletions

View File

@ -31,7 +31,7 @@
#include <time.h> #include <time.h>
#else #else
#include "sysutils.h" #include "sysutils.h"
#ifndef _WIN32 #ifndef PLATFORM_WINDOWS
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#endif #endif

View File

@ -20,7 +20,7 @@
#include <cstring> #include <cstring>
#ifndef _WIN32 #ifndef PLATFORM_WINDOWS
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif
@ -30,7 +30,7 @@
//#define DEBUG_RINGBUFFER 1 //#define DEBUG_RINGBUFFER 1
#ifdef _WIN32 #ifdef PLATFORM_WINDOWS
#define MLOCK(a,b) 1 #define MLOCK(a,b) 1
#define MUNLOCK(a,b) 1 #define MUNLOCK(a,b) 1
#else #else

View File

@ -19,7 +19,7 @@
#include <list> #include <list>
#include <iostream> #include <iostream>
#ifndef WIN32 #ifndef PLATFORM_WINDOWS
#include <sys/time.h> #include <sys/time.h>
#endif #endif

View File

@ -29,7 +29,7 @@ using std::string;
namespace RubberBand namespace RubberBand
{ {
#ifdef _WIN32 #ifdef PLATFORM_WINDOWS
Thread::Thread() : Thread::Thread() :
m_id(0), m_id(0),
@ -289,7 +289,7 @@ Condition::signal()
SetEvent(m_condition); SetEvent(m_condition);
} }
#else /* !_WIN32 */ #else /* !PLATFORM_WINDOWS */
Thread::Thread() : Thread::Thread() :
@ -562,7 +562,7 @@ Condition::signal()
pthread_cond_signal(&m_condition); pthread_cond_signal(&m_condition);
} }
#endif /* !_WIN32 */ #endif /* !PLATFORM_WINDOWS */
MutexLocker::MutexLocker(Mutex *mutex) : MutexLocker::MutexLocker(Mutex *mutex) :
m_mutex(mutex) m_mutex(mutex)

View File

@ -15,11 +15,11 @@
#ifndef _RUBBERBAND_THREAD_H_ #ifndef _RUBBERBAND_THREAD_H_
#define _RUBBERBAND_THREAD_H_ #define _RUBBERBAND_THREAD_H_
#ifdef _WIN32 #ifdef PLATFORM_WINDOWS
#include <windows.h> #include <windows.h>
#else /* !_WIN32 */ #else /* !PLATFORM_WINDOWS */
#include <pthread.h> #include <pthread.h>
#endif /* !_WIN32 */ #endif /* !PLATFORM_WINDOWS */
#include <string> #include <string>
@ -33,7 +33,7 @@ namespace RubberBand
class Thread class Thread
{ {
public: public:
#ifdef _WIN32 #ifdef PLATFORM_WINDOWS
typedef HANDLE Id; typedef HANDLE Id;
#else #else
typedef pthread_t Id; typedef pthread_t Id;
@ -53,7 +53,7 @@ protected:
virtual void run() = 0; virtual void run() = 0;
private: private:
#ifdef _WIN32 #ifdef PLATFORM_WINDOWS
HANDLE m_id; HANDLE m_id;
bool m_extant; bool m_extant;
static DWORD WINAPI staticRun(LPVOID lpParam); static DWORD WINAPI staticRun(LPVOID lpParam);
@ -75,7 +75,7 @@ public:
bool trylock(); bool trylock();
private: private:
#ifdef _WIN32 #ifdef PLATFORM_WINDOWS
HANDLE m_mutex; HANDLE m_mutex;
#ifndef NO_THREAD_CHECKS #ifndef NO_THREAD_CHECKS
DWORD m_lockedBy; DWORD m_lockedBy;
@ -123,7 +123,7 @@ public:
private: private:
#ifdef _WIN32 #ifdef PLATFORM_WINDOWS
HANDLE m_mutex; HANDLE m_mutex;
HANDLE m_condition; HANDLE m_condition;
bool m_locked; bool m_locked;

View File

@ -36,7 +36,7 @@
using namespace std; using namespace std;
using namespace RubberBand; using namespace RubberBand;
#ifdef _WIN32 #ifdef PLATFORM_WINDOWS
using RubberBand::gettimeofday; using RubberBand::gettimeofday;
using RubberBand::usleep; using RubberBand::usleep;
#endif #endif
@ -324,7 +324,7 @@ int main(int argc, char **argv)
cerr << "Using time ratio " << ratio; cerr << "Using time ratio " << ratio;
cerr << " and frequency ratio " << frequencyshift << endl; cerr << " and frequency ratio " << frequencyshift << endl;
#ifdef _WIN32 #ifdef PLATFORM_WINDOWS
RubberBand:: RubberBand::
#endif #endif
timeval tv; timeval tv;
@ -495,7 +495,7 @@ int main(int argc, char **argv)
} }
delete[] obf; delete[] obf;
} else { } else {
#ifdef WIN32 #ifdef PLATFORM_WINDOWS
RubberBand::usleep(10000); RubberBand::usleep(10000);
#else #else
usleep(10000); usleep(10000);
@ -510,7 +510,7 @@ int main(int argc, char **argv)
cerr << "in: " << countIn << ", out: " << countOut << ", ratio: " << float(countOut)/float(countIn) << ", ideal output: " << lrint(countIn * ratio) << ", error: " << abs(lrint(countIn * ratio) - int(countOut)) << endl; cerr << "in: " << countIn << ", out: " << countOut << ", ratio: " << float(countOut)/float(countIn) << ", ideal output: " << lrint(countIn * ratio) << ", error: " << abs(lrint(countIn * ratio) - int(countOut)) << endl;
#ifdef _WIN32 #ifdef PLATFORM_WINDOWS
RubberBand:: RubberBand::
#endif #endif
timeval etv; timeval etv;