update wavesaudio backend, now supports Windows (ASIO) as well as OS X (CoreAudio)
[ardour.git] / libs / backends / wavesaudio / wavesapi / BasicTypes / WUTypes.h
1 #ifndef __WUTypes_h__
2         #define __WUTypes_h__
3
4 /* Copy to include:
5 #include "BasicTypes/WUTypes.h"
6 */
7
8 #include "WavesPublicAPI/WTErr.h"
9 #include "WavesPublicAPI/wstdint.h"
10 #include "BasicTypes/WUDefines.h"
11 #include "BasicTypes/WCFourCC.h"        // declares WTFourCharCode & WCFourCC
12 #include "BasicTypes/WUComPtr.h"        // Communication Ptr for x64 compatibility
13 #include "WCFixedString.h"
14 #include <ctime>
15 #include <vector>
16 /********************************************************************************
17     Atoms
18 *********************************************************************************/
19
20 #define WTSInt64    "WTSInt64 is obsolete, please use int64_t instead"; 
21 #define WTUInt64    "WTUInt64 is obsolete, please use uint64_t instead"; 
22 #define WTSInt32    "WTSInt32 is obsolete, please use int32_t instead"; 
23 #define WTUInt32    "WTUInt32 is obsolete, please use uint32_t instead"; 
24 #define WTSInt16    "WTSInt16 is obsolete, please use int16_t instead"; 
25 #define WTUInt16    "WTUInt16 is obsolete, please use uint16_t instead"; 
26 #define WTSInt8     "WTSInt8 is obsolete, please use int8_t instead"; 
27 #define WTUInt8     "WTUInt8 is obsolete, please use uint8_t instead"; 
28 #define WTFloat32   "WTFloat32 is obsolete, please use float instead"; 
29 #define WTByte      "WTByte is obsolete, please use uint8_t instead"; 
30
31 /********************************************************************************
32     Consts
33 *********************************************************************************/
34 //#define PI 3.1415926535897 // ... Was moved to WUMathConsts.h under the name kPI
35 const uint32_t kDefaultCircleSlices = 100;
36
37
38 /********************************************************************************
39     Utilities
40 *********************************************************************************/
41
42 // SCOPED_ENUM is a macro that defines an enum inside a class with a given name, thus declaring the enum values
43 // inside a named scope. This allows declaring:
44 //      SCOPED_ENUM(SomeType)
45 //      {
46 //          Val1,
47 //          Val2,
48 //          Val3
49 //      }
50 //      SCOPED_ENUM_END
51 // And then you can reference SomeType::Val1, SomeType::Val2, SomeType::Val3 for the various values, unlike
52 // a regular enum on which Val1, Val2 and Val3 would become global names.
53 // Additionally, you get SomeType::Type to specify the type of the whole enum in case you want to transfer it to
54 // a function.
55 // Don't forget to close the enum with SCOPED_ENUM_END, otherwise you'll get bogus compilation errors.
56 // This requirement can probably be removed some day, but it will make the SCOPED_ENUM macro much less readable...
57 #define SCOPED_ENUM(name) \
58 class name \
59 { \
60 public: enum Type
61
62 #define SCOPED_ENUM_END ;};
63
64
65 //********************************************************************************
66 //    Files
67
68 //! file (and resource container) opening permissions                   
69 // Note: When opening with eFMWriteOnly on existing file, writing to the file will append, not overwrite, Shai, 9/8/2007.
70 enum    WEPermitions{ eFMReadOnly, eFMWriteOnly, eFMReadWrite};
71
72 // File cursor positions
73 enum    WEPositionMode{eFMFileBegin, eFMFileCurrent, eFMFileEnd};
74
75 // File creation types
76 enum    WECreateFlags {
77         eFMCreateFile_DontOverrideIfAlreadyExists,      // Create a new file , If the file exists leaves the existing data intact
78         eFMCreateFile_FailIfAlreadyExists,                      // Attempt to create a new file, if file already exists - fail.
79         eFMCreateFile_OverrideIfAlreadyExists       // Create a new file , If the file exists, overwrite the file and clear the existing data
80 };
81
82
83 enum WEFoldersDomain{
84         eSystemDomain,
85         eLocalDomain,
86         eUserDomain,
87
88         eNumberOfFoldersDomains
89 };
90 enum WEArchBits{
91     e32Bits,
92     e64Bits,
93     eNumberOfArchBits
94 };
95
96 enum WESystemFolders{
97         eSystemFolder,
98         eDesktopFolder,
99         ePreferencesFolder,
100         eWavesPreferencesFolder, //deprecated use eWavesPreferencesFolder2
101         eTemporaryFolder,
102         eTrashFolder,
103         eCurrentFolder,
104         eRootFolder,
105         eLibrariesFolder,
106         eAudioComponentsFolder, // MacOS only 
107         eCacheFolder,
108         eWavesCacheFolder,
109         eAppDataFolder,
110         eWavesAppDataFolder,
111         eSharedUserDataFolder,
112         eWavesSharedUserDataFolder,
113         eWavesScanViewFolder,
114
115         eWavesPreferencesFolder2, // Mac: "/Users/username/Library/Preferences/Waves Audio"
116                               // Win: "C:\Users\username\AppData\Roaming\Waves Audio\Preferences"
117                 
118         eNumberOfSystemFolders
119 };
120
121 //********************************************************************************
122 //    Process
123
124 #ifdef __MACOS__
125         typedef uint32_t WTProcessID; // actually pid_t which is __darwin_pid_t which is __uint32_t
126 #endif
127 #ifdef _WINDOWS
128         typedef int             WTProcessID;
129 #endif
130 #ifdef __linux__
131         typedef uint32_t WTProcessID;
132 #endif
133
134 enum WEManagerInitOptions
135 {
136     eUnknown_ManagerInitOption,
137     eMacOS_Carbon_Runtime,
138     eMacOS_Cocoa_Runtime,
139     eLinuxOS_gtk_Runtime,
140     eLinuxOS_X_Runtime,
141     eWindowsOS_GoodOld_Runtime,         // good old windows API
142     eWindowsOS_DotNET_Runtime,
143     eVerticalFliped_Graphics,
144     eInit_RM,
145     eInit_GMConfig,
146     eInit_PVM,
147     eInit_UM,
148     eInit_BKG
149 };
150 #ifdef __MACOS__
151     #if __LP64__ || NS_BUILD_32_LIKE_64 // in 64bit (or when NS_BUILD_32_LIKE_64 is specified) we decline Carbon implementation.
152         const WEManagerInitOptions eDefaultRuntime = eMacOS_Cocoa_Runtime;
153     #else
154         const WEManagerInitOptions eDefaultRuntime = eMacOS_Carbon_Runtime;
155     #endif
156 #endif
157 #ifdef _WINDOWS
158     const WEManagerInitOptions eDefaultRuntime = eWindowsOS_GoodOld_Runtime;
159 #endif
160 #ifdef __linux__
161     const WEManagerInitOptions eDefaultRuntime = eLinuxOS_gtk_Runtime;
162 #endif
163
164
165 //********************************************************************************
166 //    Files
167
168 const uint32_t kMaxPathLength = 1023;      // maximum length of a path 
169 const uint32_t kMaxFileNameLength = 255;    // maximum length of a file name including extension
170 typedef WCFixedString<kMaxPathLength> WTPathString;
171 typedef WCFixedString<kMaxFileNameLength> WTFileNameString;
172
173 typedef uint64_t WTFileSize;
174 const WTFileSize kIllegalFileSize = (WTFileSize)-1;
175
176 typedef off_t WTFileOffset;
177
178 typedef std::time_t WTFileTime;
179 const WTFileTime kIllegalFileTime = (WTFileTime)-1;
180
181 typedef struct WTPathType* WTPathRef;                           // represents a path, path need not exists
182 typedef struct WTOpenFileType* WTOpenFileRef;           // represents a real, open file
183 typedef struct WTNativeDLLRefType* WTNativeDLLRef;      // define WTNativeDLLRef as a unique type CFBundleRef on Mac, HINSTANCE on Windows
184 const WTNativeDLLRef kIllegalNativeDLLRef = 0;
185 //********************************************************************************
186 //    Resources
187
188 const size_t kMaxResTypeLength = 31;
189 typedef WCFixedString31 WTResType;
190 typedef short       WTResID;
191 const   WTResID     kIllegalResID = -1;
192
193
194 typedef struct WTResContainerType*                      WTResContainerRef;
195 typedef struct WTResourceType*                                  WTResRef;
196 const WTResContainerRef kIllegalContainerRef = 0;
197 const WTResRef kIllegalResourceRef = 0;
198
199 #ifdef __MACOS__
200         typedef struct WTNativeResourceType*    WTNativeResourceRef;    // for use when need to have access to the native resource without going though resource manager caching anf conversion.
201     const WTNativeResourceRef           kIllegalNativeResourceRef = 0;
202 #endif
203 #ifdef _WINDOWS
204         typedef struct WTNativeResourceType*    WTNativeResourceRef; //HGLOBAL  // for use when need to have access to the native resource without going though resource manager caching anf conversion.
205     const WTNativeResourceRef           kIllegalNativeResourceRef = 0;
206 #endif
207 #ifdef __linux__
208 typedef void*                                   WTNativeResourceRef;   // WTOpenFileRef // for use when need to have access to the native resource without going though resource manager caching anf conversion.
209     const WTNativeResourceRef           kIllegalNativeResourceRef = 0;
210 #endif
211
212 //********************************************************************************
213 //    OpenGL
214
215 typedef struct WCOGLContext*                    WCOGLContextRef;
216 typedef struct WCOGLTexture*                    WCOGLTextureRef;
217 typedef struct WSPluginView*            WCPluginViewRef;
218 typedef struct WSMenu*                  WCMenuRef;
219 typedef struct WCPluginNativeView*      WCPluginNativeViewRef;
220
221 const WCOGLContextRef kIllegalOGLContextRef = 0;
222 const WCOGLTextureRef kIllegalOGLTextureRef = 0;
223 const WCPluginViewRef kIllegalPluginViewRef = 0;
224 const WCMenuRef kIllegalWCMenuRef = 0;
225
226 const intptr_t kIllegalTexturesMaster = -1;        
227
228
229 typedef unsigned int WTTextureRef;
230 const WTTextureRef kIllegalTextureRef = 0;
231
232 // type for storing pointer to functions. Used to avoid warning such as "C++ forbids conversion between pointer to function and pointer to object"
233 typedef void (*DUMMY_FUNC_PTR)(void);
234
235 // type for a generic callback function with one parameter
236 typedef intptr_t (*CALLBACK_1_PARAM_FUNC_PTR)(intptr_t);
237
238 //////////////////////////////////////////////////////////////
239 // Timer
240 typedef intptr_t WTTimerRef;
241 const WTTimerRef kIllegalTimerRef = 0;
242 typedef void (*WTTimerCallback)(intptr_t);
243
244 // generic type for OS native pointer
245 typedef void* WTPtr;
246
247 #endif //__WUTypes_h__