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 and release versions.
37 // Most of the time we're in development, so IS_ALPHA should be defined
38 // to 1.
39 #define IS_ALPHA 1
40 
41 // Increment as appropriate every time we release a NEW version.
42 #define AUDACITY_VERSION 2
43 #define AUDACITY_RELEASE 2
44 #define AUDACITY_REVISION 0
45 #define AUDACITY_MODLEVEL 0
46 
47 #if IS_ALPHA
48  #define AUDACITY_SUFFIX wxT("-alpha-") __TDATE__
49 #else
50  //#define AUDACITY_SUFFIX wxT("") // for a stable release
51  #define AUDACITY_SUFFIX wxT("x ") __TDATE__
52 #endif
53 
54 #define AUDACITY_MAKESTR( x ) #x
55 #define AUDACITY_QUOTE( x ) AUDACITY_MAKESTR( x )
56 
57 // Version string for visual display
58 #define AUDACITY_VERSION_STRING wxT( AUDACITY_QUOTE( AUDACITY_VERSION ) ) wxT(".") \
59  wxT( AUDACITY_QUOTE( AUDACITY_RELEASE ) ) wxT(".") \
60  wxT( AUDACITY_QUOTE( AUDACITY_REVISION ) ) \
61  AUDACITY_SUFFIX
62 
63 // DA: x on end of version string.
64 #ifdef EXPERIMENTAL_DA
65 // Version string for file info (under Windows)
66 #define AUDACITY_FILE_VERSION AUDACITY_QUOTE( AUDACITY_VERSION ) "," \
67  AUDACITY_QUOTE( AUDACITY_RELEASE ) "," \
68  AUDACITY_QUOTE( AUDACITY_REVISION ) "," \
69  AUDACITY_QUOTE( AUDACITY_MODLEVEL ) " x"
70 #else
71 #define AUDACITY_FILE_VERSION AUDACITY_QUOTE( AUDACITY_VERSION ) "," \
72  AUDACITY_QUOTE( AUDACITY_RELEASE ) "," \
73  AUDACITY_QUOTE( AUDACITY_REVISION ) "," \
74  AUDACITY_QUOTE( AUDACITY_MODLEVEL )
75 #endif
76 
77 
78 // Increment this every time the prefs need to be reset
79 // the first part (before the r) indicates the version the reset took place
80 // the second part (after the r) indicates the number of times the prefs have been reset within the same version
81 #define AUDACITY_PREFS_VERSION_STRING "1.1.1r1"
82 
83 // Don't change this unless the file format changes
84 // in an irrevocable way
85 #define AUDACITY_FILE_FORMAT_VERSION "1.3.0"
86 
87 class wxWindow;
88 
89 void QuitAudacity(bool bForce);
90 void QuitAudacity();
91 
92 // Please try to support unlimited path length instead of using PLATFORM_MAX_PATH!
93 // Define one constant for maximum path value, so we don't have to do
94 // platform-specific conditionals everywhere we want to check it.
95 #define PLATFORM_MAX_PATH 260 // Play it safe for default, with same value as Windows' MAX_PATH.
96 
97 #ifdef __WXMAC__
98 #include "configmac.h"
99 #undef PLATFORM_MAX_PATH
100 #define PLATFORM_MAX_PATH PATH_MAX
101 #endif
102 
103 #ifdef __WXGTK__
104 #include "configunix.h"
105 // Some systems do not restrict the path length and therefore PATH_MAX is undefined
106 #ifdef PATH_MAX
107 #undef PLATFORM_MAX_PATH
108 #define PLATFORM_MAX_PATH PATH_MAX
109 #endif
110 #endif
111 
112 #ifdef __WXX11__
113 #include "configunix.h"
114 // wxX11 should also get the platform-specific definition of PLATFORM_MAX_PATH, so do not declare here.
115 #endif
116 
117 #ifdef __WXMSW__
118 #include "configwin.h"
119 #undef PLATFORM_MAX_PATH
120 #define PLATFORM_MAX_PATH MAX_PATH
121 #endif
122 
123 /* Magic for dynamic library import and export. This is unfortunately
124  * compiler-specific because there isn't a standard way to do it. Currently it
125  * works with the Visual Studio compiler for windows, and for GCC 4+. Anything
126  * else gets all symbols made public, which gets messy */
127 /* The Visual Studio implementation */
128 #ifdef _MSC_VER
129  #ifndef AUDACITY_DLL_API
130  #ifdef BUILDING_AUDACITY
131  #define AUDACITY_DLL_API _declspec(dllexport)
132  #else
133  #ifdef _DLL
134  #define AUDACITY_DLL_API _declspec(dllimport)
135  #else
136  #define AUDACITY_DLL_API
137  #endif
138  #endif
139  #endif
140 #endif //_MSC_VER
141 
142 // Put extra symbol information in the release build, for the purpose of gathering
143 // profiling information (as from Windows Process Monitor), when there otherwise
144 // isn't a need for AUDACITY_DLL_API.
145 #if IS_ALPHA
146  #define PROFILE_DLL_API AUDACITY_DLL_API
147 #else
148  #define PROFILE_DLL_API
149 #endif
150 
151 /* The GCC-elf implementation */
152 #ifdef HAVE_VISIBILITY // this is provided by the configure script, is only
153 // enabled for suitable GCC versions
154 /* The incantation is a bit weird here because it uses ELF symbol stuff. If we
155  * make a symbol "default" it makes it visible (for import or export). Making it
156  * "hidden" means it is invisible outside the shared object. */
157  #ifndef AUDACITY_DLL_API
158  #ifdef BUILDING_AUDACITY
159  #define AUDACITY_DLL_API __attribute__((visibility("default")))
160  #else
161  #define AUDACITY_DLL_API __attribute__((visibility("default")))
162  #endif
163  #endif
164 #endif
165 
166 /* The GCC-win32 implementation */
167 // bizzarely, GCC-for-win32 supports Visual Studio style symbol visibility, so
168 // we use that if building on Cygwin
169 #if defined __CYGWIN__ && defined __GNUC__
170  #ifndef AUDACITY_DLL_API
171  #ifdef BUILDING_AUDACITY
172  #define AUDACITY_DLL_API _declspec(dllexport)
173  #else
174  #ifdef _DLL
175  #define AUDACITY_DLL_API _declspec(dllimport)
176  #else
177  #define AUDACITY_DLL_API
178  #endif
179  #endif
180  #endif
181 #endif
182 
183 // These macros are used widely, so declared here.
184 #define QUANTIZED_TIME(time, rate) (floor(((double)(time) * (rate)) + 0.5) / (rate))
185 // dB - linear amplitude convesions
186 #define DB_TO_LINEAR(x) (pow(10.0, (x) / 20.0))
187 #define LINEAR_TO_DB(x) (20.0 * log10(x))
188 
189 #define MAX_AUDIO (1. - 1./(1<<15))
190 #define JUST_BELOW_MAX_AUDIO (1.f - 1.f/(1<<14))
191 
192 
193 #ifndef IN_RC
194 //#include <wx/defs.h>
195 //#include <wx/string.h>
196 class wxString;
197 
198 extern const wxString& GetCustomTranslation(const wxString& str1 );
199 extern const wxString& GetCustomSubstitution(const wxString& str1 );
200 
201 // Marks strings for extraction only...must use wxGetTranslation() to translate.
202 #define XO(s) wxT(s)
203 // Marks string for substitution only.
204 #define _TS( s ) GetCustomSubstitution( s )
205 
206 
207 #define WXINTL_NO_GETTEXT_MACRO
208 
209 #ifdef wxPLURAL
210 #undef wxPLURAL
211 #endif
212 
213 #define wxPLURAL(sing, plur, n) wxGetTranslation((sing), (plur), n)
214 
215 
216 #ifdef _
217 #undef _
218 #endif
219 
220 #define _(s) GetCustomTranslation((s))
221 #endif
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__
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