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