Audacity  2.2.2
Audacity.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4  Audacity(R) is copyright (c) 1999-2015 Audacity Team.
5  License: GPL v2. See License.txt.
6 
7  Audacity.h
8 
9  Dominic Mazzoni
10  Joshua Haberman
11  Vaughan Johnson
12  et alii
13 
14 ********************************************************************//********************************************************************/
23 
24 #ifndef __AUDACITY_H__
25 #define __AUDACITY_H__
26 
27 // If building with GNU compiler, then must be 4.9 or later.
28 // TODO: This would be much nicer as a standalone test in configure.ac
29 #if !defined(__APPLE__) && !defined(__clang__) && \
30  defined __GNUC__ && ( __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9))
31 
32  #error Audacity requires at least GCC 4.9
33 #endif
34 
35 
36 // We only do alpha builds, beta builds, and release versions.
37 // Most of the time we're in development, so AUDACITY_BUILD_LEVEL should be
38 // defined to 0.
39 // Its value may be more than 0 for pre-release "Beta" builds that differ only
40 // in the welcome screen, and hiding of some development menu commands, but
41 // still link to the alpha manual online.
42 #define AUDACITY_BUILD_LEVEL 0
43 
44 // used #ifdef not #if for IS_ALPHA, IS_BETA, IS_RELEASE, USE_ALPHA_MANUAL
45 #undef IS_ALPHA
46 #undef IS_BETA
47 #undef IS_RELEASE
48 #undef USE_ALPHA_MANUAL
49 
50 #if AUDACITY_BUILD_LEVEL == 0
51  #define IS_ALPHA
52  #define USE_ALPHA_MANUAL
53 #elif AUDACITY_BUILD_LEVEL == 1
54  #define IS_BETA
55  #define USE_ALPHA_MANUAL
56 #else
57  #define IS_RELEASE
58 #endif
59 
60 
61 
62 // Increment as appropriate every time we release a NEW version.
63 #define AUDACITY_VERSION 2
64 #define AUDACITY_RELEASE 3
65 #define AUDACITY_REVISION 0
66 #define AUDACITY_MODLEVEL 0
67 
68 #if defined(IS_BETA)
69  #define AUDACITY_SUFFIX wxT("-beta-") __TDATE__
70 #elif defined(IS_ALPHA)
71  #define AUDACITY_SUFFIX wxT("-alpha-") __TDATE__
72 #else
73  #define AUDACITY_SUFFIX wxT("") // for a stable release
74  //#define AUDACITY_SUFFIX wxT("x ") __TDATE__
75 #endif
76 
77 #define AUDACITY_MAKESTR( x ) #x
78 #define AUDACITY_QUOTE( x ) AUDACITY_MAKESTR( x )
79 
80 // Version string for visual display
81 #define AUDACITY_VERSION_STRING wxT( AUDACITY_QUOTE( AUDACITY_VERSION ) ) wxT(".") \
82  wxT( AUDACITY_QUOTE( AUDACITY_RELEASE ) ) wxT(".") \
83  wxT( AUDACITY_QUOTE( AUDACITY_REVISION ) ) \
84  AUDACITY_SUFFIX
85 
86 // DA: x on end of version string.
87 #ifdef EXPERIMENTAL_DA
88 // Version string for file info (under Windows)
89 #define AUDACITY_FILE_VERSION AUDACITY_QUOTE( AUDACITY_VERSION ) "," \
90  AUDACITY_QUOTE( AUDACITY_RELEASE ) "," \
91  AUDACITY_QUOTE( AUDACITY_REVISION ) "," \
92  AUDACITY_QUOTE( AUDACITY_MODLEVEL ) " x"
93 #else
94 #define AUDACITY_FILE_VERSION AUDACITY_QUOTE( AUDACITY_VERSION ) "," \
95  AUDACITY_QUOTE( AUDACITY_RELEASE ) "," \
96  AUDACITY_QUOTE( AUDACITY_REVISION ) "," \
97  AUDACITY_QUOTE( AUDACITY_MODLEVEL )
98 #endif
99 
100 
101 // Increment this every time the prefs need to be reset
102 // the first part (before the r) indicates the version the reset took place
103 // the second part (after the r) indicates the number of times the prefs have been reset within the same version
104 #define AUDACITY_PREFS_VERSION_STRING "1.1.1r1"
105 
106 // Don't change this unless the file format changes
107 // in an irrevocable way
108 #define AUDACITY_FILE_FORMAT_VERSION "1.3.0"
109 
110 class wxWindow;
111 
112 void QuitAudacity(bool bForce);
113 void QuitAudacity();
114 
115 // Please try to support unlimited path length instead of using PLATFORM_MAX_PATH!
116 // Define one constant for maximum path value, so we don't have to do
117 // platform-specific conditionals everywhere we want to check it.
118 #define PLATFORM_MAX_PATH 260 // Play it safe for default, with same value as Windows' MAX_PATH.
119 
120 #ifdef __WXMAC__
121 #include "configmac.h"
122 #undef PLATFORM_MAX_PATH
123 #define PLATFORM_MAX_PATH PATH_MAX
124 #endif
125 
126 #ifdef __WXGTK__
127 #ifndef __CONFIG_UNIX_INCLUDED
128  #define __CONFIG_UNIX_INCLUDED
129  #include "configunix.h"
130 #endif
131 
132 // Some systems do not restrict the path length and therefore PATH_MAX is undefined
133 #ifdef PATH_MAX
134 #undef PLATFORM_MAX_PATH
135 #define PLATFORM_MAX_PATH PATH_MAX
136 #endif
137 #endif
138 
139 #ifdef __WXX11__
140 #ifndef __CONFIG_UNIX_INCLUDED
141  #define __CONFIG_UNIX_INCLUDED
142  #include "configunix.h"
143 #endif
144 // wxX11 should also get the platform-specific definition of PLATFORM_MAX_PATH, so do not declare here.
145 #endif
146 
147 #ifdef __WXMSW__
148 #include "configwin.h"
149 #undef PLATFORM_MAX_PATH
150 #define PLATFORM_MAX_PATH MAX_PATH
151 #endif
152 
153 /* Magic for dynamic library import and export. This is unfortunately
154  * compiler-specific because there isn't a standard way to do it. Currently it
155  * works with the Visual Studio compiler for windows, and for GCC 4+. Anything
156  * else gets all symbols made public, which gets messy */
157 /* The Visual Studio implementation */
158 #ifdef _MSC_VER
159  #ifndef AUDACITY_DLL_API
160  #ifdef BUILDING_AUDACITY
161  #define AUDACITY_DLL_API _declspec(dllexport)
162  #else
163  #ifdef _DLL
164  #define AUDACITY_DLL_API _declspec(dllimport)
165  #else
166  #define AUDACITY_DLL_API
167  #endif
168  #endif
169  #endif
170 #endif //_MSC_VER
171 
172 // Put extra symbol information in the release build, for the purpose of gathering
173 // profiling information (as from Windows Process Monitor), when there otherwise
174 // isn't a need for AUDACITY_DLL_API.
175 #ifdef IS_ALPHA
176  #define PROFILE_DLL_API AUDACITY_DLL_API
177 #else
178  #define PROFILE_DLL_API
179 #endif
180 
181 /* The GCC-elf implementation */
182 #ifdef HAVE_VISIBILITY // this is provided by the configure script, is only
183 // enabled for suitable GCC versions
184 /* The incantation is a bit weird here because it uses ELF symbol stuff. If we
185  * make a symbol "default" it makes it visible (for import or export). Making it
186  * "hidden" means it is invisible outside the shared object. */
187  #ifndef AUDACITY_DLL_API
188  #ifdef BUILDING_AUDACITY
189  #define AUDACITY_DLL_API __attribute__((visibility("default")))
190  #else
191  #define AUDACITY_DLL_API __attribute__((visibility("default")))
192  #endif
193  #endif
194 #endif
195 
196 /* The GCC-win32 implementation */
197 // bizzarely, GCC-for-win32 supports Visual Studio style symbol visibility, so
198 // we use that if building on Cygwin
199 #if defined __CYGWIN__ && defined __GNUC__
200  #ifndef AUDACITY_DLL_API
201  #ifdef BUILDING_AUDACITY
202  #define AUDACITY_DLL_API _declspec(dllexport)
203  #else
204  #ifdef _DLL
205  #define AUDACITY_DLL_API _declspec(dllimport)
206  #else
207  #define AUDACITY_DLL_API
208  #endif
209  #endif
210  #endif
211 #endif
212 
213 // These macros are used widely, so declared here.
214 #define QUANTIZED_TIME(time, rate) (floor(((double)(time) * (rate)) + 0.5) / (rate))
215 // dB - linear amplitude convesions
216 #define DB_TO_LINEAR(x) (pow(10.0, (x) / 20.0))
217 #define LINEAR_TO_DB(x) (20.0 * log10(x))
218 
219 #define MAX_AUDIO (1. - 1./(1<<15))
220 #define JUST_BELOW_MAX_AUDIO (1.f - 1.f/(1<<14))
221 
222 
223 // This renames a good use of this C++ keyword that we don't need to review when hunting for leaks.
224 #define PROHIBITED = delete
225 
226 // Reviewed, certified, non-leaky uses of NEW that immediately entrust their results to RAII objects.
227 // You may use it in NEW code when constructing a wxWindow subclass with non-NULL parent window.
228 // You may use it in NEW code when the NEW expression is the constructor argument for a standard smart
229 // pointer like std::unique_ptr or std::shared_ptr.
230 #define safenew new
231 
232 #endif // __AUDACITY_H__
void QuitAudacity(bool bForce)