annotate base/System.h @ 77:2beca8ddcdc3

* Add BZipFileDevice to handle bzip2 compress/uncompress without all that ugly code in MainWindow.cpp * Remove all that ugly code in MainWindow.cpp and replace with uses of BZipFileDevice * Fix layer import/export for SV XML layers * and a few other minor fixes
author Chris Cannam
date Wed, 12 Apr 2006 09:59:40 +0000
parents d26c85099215
children c983dda79f72
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@0 23
Chris@0 24 #define MLOCK(a,b) 1
Chris@0 25 #define MUNLOCK(a,b) 1
Chris@29 26 #define MUNLOCK_SAMPLEBLOCK(a) 1
Chris@0 27
Chris@0 28 #define DLOPEN(a,b) LoadLibrary((a).toStdWString().c_str())
Chris@0 29 #define DLSYM(a,b) GetProcAddress((HINSTANCE)(a),(b))
Chris@0 30 #define DLCLOSE(a) FreeLibrary((HINSTANCE)(a))
Chris@0 31 #define DLERROR() ""
Chris@0 32
Chris@0 33 #define PLUGIN_GLOB "*.dll"
Chris@0 34
Chris@0 35 extern "C" {
Chris@0 36 void gettimeofday(struct timeval *p, void *tz);
Chris@0 37 }
Chris@0 38
Chris@0 39 #else
Chris@0 40
Chris@0 41 #include <sys/mman.h>
Chris@0 42 #include <dlfcn.h>
Chris@0 43
Chris@0 44 #define MLOCK(a,b) ::mlock((a),(b))
Chris@29 45 #define MUNLOCK(a,b) (::munlock((a),(b)) ? (::perror("munlock failed"), 0) : 0)
Chris@29 46 #define MUNLOCK_SAMPLEBLOCK(a) do { const float &b = *(a).begin(); MUNLOCK(&b, (a).capacity() * sizeof(float)); } while(0);
Chris@0 47
Chris@0 48 #define DLOPEN(a,b) dlopen((a).toStdString().c_str(),(b))
Chris@0 49 #define DLSYM(a,b) dlsym((a),(b))
Chris@0 50 #define DLCLOSE(a) dlclose((a))
Chris@0 51 #define DLERROR() dlerror()
Chris@0 52
Chris@70 53 #ifdef __APPLE__
Chris@70 54
Chris@70 55 #define PLUGIN_GLOB "*.dylib"
Chris@70 56
Chris@70 57 #else
Chris@70 58
Chris@0 59 #define PLUGIN_GLOB "*.so"
Chris@0 60
Chris@70 61 #endif /* __APPLE__ */
Chris@0 62
Chris@70 63 #endif /* ! _WIN32 */
Chris@0 64
Chris@70 65 #endif /* ! _SYSTEM_H_ */
Chris@70 66
Chris@70 67