Chris@49: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@0: Chris@0: /* Chris@52: Sonic Visualiser Chris@52: An audio file viewer and annotation editor. Chris@52: Centre for Digital Music, Queen Mary, University of London. Chris@52: This file copyright 2006 Chris Cannam. Chris@0: Chris@52: This program is free software; you can redistribute it and/or Chris@52: modify it under the terms of the GNU General Public License as Chris@52: published by the Free Software Foundation; either version 2 of the Chris@52: License, or (at your option) any later version. See the file Chris@52: COPYING included with this distribution for more information. Chris@0: */ Chris@0: Chris@0: #ifndef _SYSTEM_H_ Chris@0: #define _SYSTEM_H_ Chris@0: Chris@0: #ifdef _WIN32 Chris@0: Chris@0: #include Chris@0: #include Chris@104: #include Chris@0: Chris@0: #define MLOCK(a,b) 1 Chris@0: #define MUNLOCK(a,b) 1 Chris@29: #define MUNLOCK_SAMPLEBLOCK(a) 1 Chris@0: Chris@0: #define DLOPEN(a,b) LoadLibrary((a).toStdWString().c_str()) Chris@0: #define DLSYM(a,b) GetProcAddress((HINSTANCE)(a),(b)) Chris@0: #define DLCLOSE(a) FreeLibrary((HINSTANCE)(a)) Chris@0: #define DLERROR() "" Chris@0: Chris@0: #define PLUGIN_GLOB "*.dll" Chris@78: #define PATH_SEPARATOR ';' Chris@83: #define DEFAULT_VAMP_PATH "%ProgramFiles%\\Vamp Plugins" Chris@0: Chris@104: #define getpid _getpid Chris@104: Chris@0: extern "C" { Chris@103: void usleep(unsigned long usec); Chris@0: void gettimeofday(struct timeval *p, void *tz); Chris@0: } Chris@0: Chris@0: #else Chris@0: Chris@0: #include Chris@0: #include Chris@0: Chris@0: #define MLOCK(a,b) ::mlock((a),(b)) Chris@29: #define MUNLOCK(a,b) (::munlock((a),(b)) ? (::perror("munlock failed"), 0) : 0) Chris@86: #define MUNLOCK_SAMPLEBLOCK(a) do { if (!(a).empty()) { const float &b = *(a).begin(); MUNLOCK(&b, (a).capacity() * sizeof(float)); } } while(0); Chris@0: Chris@0: #define DLOPEN(a,b) dlopen((a).toStdString().c_str(),(b)) Chris@0: #define DLSYM(a,b) dlsym((a),(b)) Chris@0: #define DLCLOSE(a) dlclose((a)) Chris@0: #define DLERROR() dlerror() Chris@0: Chris@78: #define PATH_SEPARATOR ':' Chris@78: Chris@70: #ifdef __APPLE__ Chris@70: Chris@70: #define PLUGIN_GLOB "*.dylib" Chris@80: #define DEFAULT_VAMP_PATH "/Library/Audio/Plug-Ins/Vamp/:$HOME/Library/Audio/Plug-Ins/Vamp" Chris@70: Chris@70: #else Chris@70: Chris@0: #define PLUGIN_GLOB "*.so" Chris@78: #define DEFAULT_VAMP_PATH "/usr/local/lib/vamp:/usr/lib/vamp:$HOME/vamp:$HOME/.vamp" Chris@0: Chris@70: #endif /* __APPLE__ */ Chris@0: Chris@70: #endif /* ! _WIN32 */ Chris@0: Chris@98: enum ProcessStatus { ProcessRunning, ProcessNotRunning, UnknownProcessStatus }; Chris@98: extern ProcessStatus GetProcessStatus(int pid); Chris@98: Chris@127: #include Chris@127: Chris@127: extern double mod(double x, double y); Chris@127: extern float modf(float x, float y); Chris@127: Chris@127: extern double princarg(double a); Chris@127: extern float princargf(float a); Chris@127: Chris@70: #endif /* ! _SYSTEM_H_ */ Chris@70: Chris@70: