comparison system/System.h @ 150:4b2ea82fd0ed

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