00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef _SYSTEM_H_
00017 #define _SYSTEM_H_
00018
00019 #ifdef _WIN32
00020
00021 #include <windows.h>
00022 #include <malloc.h>
00023 #include <process.h>
00024
00025 #define MLOCK(a,b) 1
00026 #define MUNLOCK(a,b) 1
00027 #define MUNLOCK_SAMPLEBLOCK(a) 1
00028 #define MUNLOCKALL() 1
00029
00030 #define DLOPEN(a,b) LoadLibrary((a).toStdWString().c_str())
00031 #define DLSYM(a,b) GetProcAddress((HINSTANCE)(a),(b))
00032 #define DLCLOSE(a) (!FreeLibrary((HINSTANCE)(a)))
00033 #define DLERROR() ""
00034
00035 #define PLUGIN_GLOB "*.dll"
00036 #define PATH_SEPARATOR ';'
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #define DEFAULT_LADSPA_PATH "%ProgramFiles%\\LADSPA Plugins;%ProgramFiles%\\Audacity\\Plug-Ins"
00052 #define DEFAULT_DSSI_PATH "%ProgramFiles%\\DSSI Plugins"
00053
00054 #define getpid _getpid
00055
00056 extern "C" {
00057 void usleep(unsigned long usec);
00058 void gettimeofday(struct timeval *p, void *tz);
00059 }
00060
00061 #else
00062
00063 #include <sys/mman.h>
00064 #include <dlfcn.h>
00065
00066 #define MLOCK(a,b) ::mlock((a),(b))
00067 #define MUNLOCK(a,b) (::munlock((a),(b)) ? (::perror("munlock failed"), 0) : 0)
00068 #define MUNLOCK_SAMPLEBLOCK(a) do { if (!(a).empty()) { const float &b = *(a).begin(); MUNLOCK(&b, (a).capacity() * sizeof(float)); } } while(0);
00069
00070
00071
00072
00073 #define DLOPEN(a,b) dlopen((a).toStdString().c_str(),(b))
00074 #define DLSYM(a,b) dlsym((a),(b))
00075 #define DLCLOSE(a) dlclose((a))
00076 #define DLERROR() dlerror()
00077
00078 #ifdef __APPLE__
00079
00080 #define PLUGIN_GLOB "*.dylib *.so"
00081 #define PATH_SEPARATOR ':'
00082
00083 #define DEFAULT_LADSPA_PATH "$HOME/Library/Audio/Plug-Ins/LADSPA:/Library/Audio/Plug-Ins/LADSPA"
00084 #define DEFAULT_DSSI_PATH "$HOME/Library/Audio/Plug-Ins/DSSI:/Library/Audio/Plug-Ins/DSSI"
00085
00086 #define MUNLOCKALL() 1
00087
00088 #else
00089
00090 #define PLUGIN_GLOB "*.so"
00091 #define PATH_SEPARATOR ':'
00092
00093 #define DEFAULT_LADSPA_PATH "$HOME/ladspa:$HOME/.ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa"
00094 #define DEFAULT_DSSI_PATH "$HOME/dssi:$HOME/.dssi:/usr/local/lib/dssi:/usr/lib/dssi"
00095
00096 #define MUNLOCKALL() ::munlockall()
00097
00098 #endif
00099
00100 #endif
00101
00102 enum ProcessStatus { ProcessRunning, ProcessNotRunning, UnknownProcessStatus };
00103 extern ProcessStatus GetProcessStatus(int pid);
00104
00105
00106
00107 extern void GetRealMemoryMBAvailable(int &available, int &total);
00108
00109
00110
00111 extern int GetDiscSpaceMBAvailable(const char *path);
00112
00113 extern void StoreStartupLocale();
00114 extern void RestoreStartupLocale();
00115
00116 #include <cmath>
00117
00118 extern double mod(double x, double y);
00119 extern float modf(float x, float y);
00120
00121 extern double princarg(double a);
00122 extern float princargf(float a);
00123
00124 #endif
00125
00126