annotate base/System.h @ 147:3a13b0d4934e

* Reorganising code base. This revision will not compile.
author Chris Cannam
date Mon, 31 Jul 2006 11:44:37 +0000
parents 514ebb0c5c6c
children
rev   line source
Chris@49 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 2
Chris@0 3 /*
Chris@52 4 Sonic Visualiser
Chris@52 5 An audio file viewer and annotation editor.
Chris@52 6 Centre for Digital Music, Queen Mary, University of London.
Chris@52 7 This file copyright 2006 Chris Cannam.
Chris@0 8
Chris@52 9 This program is free software; you can redistribute it and/or
Chris@52 10 modify it under the terms of the GNU General Public License as
Chris@52 11 published by the Free Software Foundation; either version 2 of the
Chris@52 12 License, or (at your option) any later version. See the file
Chris@52 13 COPYING included with this distribution for more information.
Chris@0 14 */
Chris@0 15
Chris@0 16 #ifndef _SYSTEM_H_
Chris@0 17 #define _SYSTEM_H_
Chris@0 18
Chris@0 19 #ifdef _WIN32
Chris@0 20
Chris@0 21 #include <windows.h>
Chris@0 22 #include <malloc.h>
Chris@104 23 #include <process.h>
Chris@0 24
Chris@0 25 #define MLOCK(a,b) 1
Chris@0 26 #define MUNLOCK(a,b) 1
Chris@29 27 #define MUNLOCK_SAMPLEBLOCK(a) 1
Chris@0 28
Chris@0 29 #define DLOPEN(a,b) LoadLibrary((a).toStdWString().c_str())
Chris@0 30 #define DLSYM(a,b) GetProcAddress((HINSTANCE)(a),(b))
Chris@0 31 #define DLCLOSE(a) FreeLibrary((HINSTANCE)(a))
Chris@0 32 #define DLERROR() ""
Chris@0 33
Chris@0 34 #define PLUGIN_GLOB "*.dll"
Chris@78 35 #define PATH_SEPARATOR ';'
Chris@83 36 #define DEFAULT_VAMP_PATH "%ProgramFiles%\\Vamp Plugins"
Chris@0 37
Chris@104 38 #define getpid _getpid
Chris@104 39
Chris@0 40 extern "C" {
Chris@103 41 void usleep(unsigned long usec);
Chris@0 42 void gettimeofday(struct timeval *p, void *tz);
Chris@0 43 }
Chris@0 44
Chris@0 45 #else
Chris@0 46
Chris@0 47 #include <sys/mman.h>
Chris@0 48 #include <dlfcn.h>
Chris@0 49
Chris@0 50 #define MLOCK(a,b) ::mlock((a),(b))
Chris@29 51 #define MUNLOCK(a,b) (::munlock((a),(b)) ? (::perror("munlock failed"), 0) : 0)
Chris@86 52 #define MUNLOCK_SAMPLEBLOCK(a) do { if (!(a).empty()) { const float &b = *(a).begin(); MUNLOCK(&b, (a).capacity() * sizeof(float)); } } while(0);
Chris@0 53
Chris@0 54 #define DLOPEN(a,b) dlopen((a).toStdString().c_str(),(b))
Chris@0 55 #define DLSYM(a,b) dlsym((a),(b))
Chris@0 56 #define DLCLOSE(a) dlclose((a))
Chris@0 57 #define DLERROR() dlerror()
Chris@0 58
Chris@78 59 #define PATH_SEPARATOR ':'
Chris@78 60
Chris@70 61 #ifdef __APPLE__
Chris@70 62
Chris@70 63 #define PLUGIN_GLOB "*.dylib"
Chris@80 64 #define DEFAULT_VAMP_PATH "/Library/Audio/Plug-Ins/Vamp/:$HOME/Library/Audio/Plug-Ins/Vamp"
Chris@70 65
Chris@70 66 #else
Chris@70 67
Chris@0 68 #define PLUGIN_GLOB "*.so"
Chris@78 69 #define DEFAULT_VAMP_PATH "/usr/local/lib/vamp:/usr/lib/vamp:$HOME/vamp:$HOME/.vamp"
Chris@0 70
Chris@70 71 #endif /* __APPLE__ */
Chris@0 72
Chris@70 73 #endif /* ! _WIN32 */
Chris@0 74
Chris@98 75 enum ProcessStatus { ProcessRunning, ProcessNotRunning, UnknownProcessStatus };
Chris@98 76 extern ProcessStatus GetProcessStatus(int pid);
Chris@98 77
Chris@127 78 #include <cmath>
Chris@127 79
Chris@127 80 extern double mod(double x, double y);
Chris@127 81 extern float modf(float x, float y);
Chris@127 82
Chris@127 83 extern double princarg(double a);
Chris@127 84 extern float princargf(float a);
Chris@127 85
Chris@70 86 #endif /* ! _SYSTEM_H_ */
Chris@70 87
Chris@70 88