Audacity  2.2.0
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 2
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 2
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 #include "configunix.h"
128 // Some systems do not restrict the path length and therefore PATH_MAX is undefined
129 #ifdef PATH_MAX
130 #undef PLATFORM_MAX_PATH
131 #define PLATFORM_MAX_PATH PATH_MAX
132 #endif
133 #endif
134 
135 #ifdef __WXX11__
136 #include "configunix.h"
137 // wxX11 should also get the platform-specific definition of PLATFORM_MAX_PATH, so do not declare here.
138 #endif
139 
140 #ifdef __WXMSW__
141 #include "configwin.h"
142 #undef PLATFORM_MAX_PATH
143 #define PLATFORM_MAX_PATH MAX_PATH
144 #endif
145 
146 /* Magic for dynamic library import and export. This is unfortunately
147  * compiler-specific because there isn't a standard way to do it. Currently it
148  * works with the Visual Studio compiler for windows, and for GCC 4+. Anything
149  * else gets all symbols made public, which gets messy */
150 /* The Visual Studio implementation */
151 #ifdef _MSC_VER
152  #ifndef AUDACITY_DLL_API
153  #ifdef BUILDING_AUDACITY
154  #define AUDACITY_DLL_API _declspec(dllexport)
155  #else
156  #ifdef _DLL
157  #define AUDACITY_DLL_API _declspec(dllimport)
158  #else
159  #define AUDACITY_DLL_API
160  #endif
161  #endif
162  #endif
163 #endif //_MSC_VER
164 
165 // Put extra symbol information in the release build, for the purpose of gathering
166 // profiling information (as from Windows Process Monitor), when there otherwise
167 // isn't a need for AUDACITY_DLL_API.
168 #ifdef IS_ALPHA
169  #define PROFILE_DLL_API AUDACITY_DLL_API
170 #else
171  #define PROFILE_DLL_API
172 #endif
173 
174 /* The GCC-elf implementation */
175 #ifdef HAVE_VISIBILITY // this is provided by the configure script, is only
176 // enabled for suitable GCC versions
177 /* The incantation is a bit weird here because it uses ELF symbol stuff. If we
178  * make a symbol "default" it makes it visible (for import or export). Making it
179  * "hidden" means it is invisible outside the shared object. */
180  #ifndef AUDACITY_DLL_API
181  #ifdef BUILDING_AUDACITY
182  #define AUDACITY_DLL_API __attribute__((visibility("default")))
183  #else
184  #define AUDACITY_DLL_API __attribute__((visibility("default")))
185  #endif
186  #endif
187 #endif
188 
189 /* The GCC-win32 implementation */
190 // bizzarely, GCC-for-win32 supports Visual Studio style symbol visibility, so
191 // we use that if building on Cygwin
192 #if defined __CYGWIN__ && defined __GNUC__
193  #ifndef AUDACITY_DLL_API
194  #ifdef BUILDING_AUDACITY
195  #define AUDACITY_DLL_API _declspec(dllexport)
196  #else
197  #ifdef _DLL
198  #define AUDACITY_DLL_API _declspec(dllimport)
199  #else
200  #define AUDACITY_DLL_API
201  #endif
202  #endif
203  #endif
204 #endif
205 
206 // These macros are used widely, so declared here.
207 #define QUANTIZED_TIME(time, rate) (floor(((double)(time) * (rate)) + 0.5) / (rate))
208 // dB - linear amplitude convesions
209 #define DB_TO_LINEAR(x) (pow(10.0, (x) / 20.0))
210 #define LINEAR_TO_DB(x) (20.0 * log10(x))
211 
212 #define MAX_AUDIO (1. - 1./(1<<15))
213 #define JUST_BELOW_MAX_AUDIO (1.f - 1.f/(1<<14))
214 
215 
216 #ifndef IN_RC
217 //#include <wx/defs.h>
218 //#include <wx/string.h>
219 class wxString;
220 
221 extern const wxString& GetCustomTranslation(const wxString& str1 );
222 extern const wxString& GetCustomSubstitution(const wxString& str1 );
223 
224 // Marks strings for extraction only...must use wxGetTranslation() to translate.
225 #define XO(s) wxT(s)
226 // Marks string for substitution only.
227 #define _TS( s ) GetCustomSubstitution( s )
228 
229 
230 #define WXINTL_NO_GETTEXT_MACRO
231 
232 #ifdef wxPLURAL
233 #undef wxPLURAL
234 #endif
235 
236 // Note: The strings will go to the .pot file (do not use _(...)).
237 #define wxPLURAL(sing, plur, n) wxGetTranslation((sing), (plur), n)
238 
239 
240 #ifdef _
241 #undef _
242 #endif
243 
244 #define _(s) GetCustomTranslation((s))
245 #endif
246 
247 // This renames a good use of this C++ keyword that we don't need to review when hunting for leaks.
248 #define PROHIBITED = delete
249 
250 // Reviewed, certified, non-leaky uses of NEW that immediately entrust their results to RAII objects.
251 // You may use it in NEW code when constructing a wxWindow subclass with non-NULL parent window.
252 // You may use it in NEW code when the NEW expression is the constructor argument for a standard smart
253 // pointer like std::unique_ptr or std::shared_ptr.
254 #define safenew new
255 
256 #endif // __AUDACITY_H__
const wxString & GetCustomTranslation(const wxString &str1)
Definition: Internat.cpp:74
void QuitAudacity(bool bForce)
Definition: AudacityApp.cpp:269
const wxString & GetCustomSubstitution(const wxString &str1)
Definition: Internat.cpp:66