2010-01-23 19:44:49 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
2011-01-06 00:07:59 +00:00
|
|
|
Audacity: A Digital Audio Editor
|
2015-04-07 20:40:02 +00:00
|
|
|
Audacity(R) is copyright (c) 1999-2015 Audacity Team.
|
2011-01-06 00:07:59 +00:00
|
|
|
License: GPL v2. See License.txt.
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2011-01-06 00:07:59 +00:00
|
|
|
Audacity.h
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2011-01-06 00:07:59 +00:00
|
|
|
Dominic Mazzoni
|
|
|
|
Joshua Haberman
|
2015-04-07 20:40:02 +00:00
|
|
|
Vaughan Johnson
|
|
|
|
et alii
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
********************************************************************//*!
|
|
|
|
|
|
|
|
\file Audacity.h
|
|
|
|
|
|
|
|
This is the main include file for Audacity. All files which need
|
|
|
|
any Audacity-specific \#defines or need to access any of Audacity's
|
|
|
|
global functions should \#include this file.
|
|
|
|
|
|
|
|
*//********************************************************************/
|
|
|
|
|
2011-01-12 21:24:01 +00:00
|
|
|
#ifndef __AUDACITY_H__
|
|
|
|
#define __AUDACITY_H__
|
|
|
|
|
2016-10-07 22:07:00 +00:00
|
|
|
// If building with GNU compiler, then must be 4.9 or later.
|
|
|
|
// TODO: This would be much nicer as a standalone test in configure.ac
|
2016-10-21 14:31:15 +00:00
|
|
|
#if !defined(__APPLE__) && defined __GNUC__ && ( __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9))
|
2016-10-07 22:07:00 +00:00
|
|
|
#error insufficient compiler
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2014-06-03 20:30:19 +00:00
|
|
|
// We only do alpha builds and release versions.
|
2010-01-23 19:44:49 +00:00
|
|
|
// Most of the time we're in development, so IS_ALPHA should be defined
|
|
|
|
// to 1.
|
2017-03-17 20:39:11 +00:00
|
|
|
#define IS_ALPHA 1
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2016-02-13 15:43:16 +00:00
|
|
|
// Increment as appropriate every time we release a NEW version.
|
2012-01-23 05:00:52 +00:00
|
|
|
#define AUDACITY_VERSION 2
|
2017-03-17 20:39:11 +00:00
|
|
|
#define AUDACITY_RELEASE 2
|
|
|
|
#define AUDACITY_REVISION 0
|
2010-01-23 19:44:49 +00:00
|
|
|
#define AUDACITY_MODLEVEL 0
|
|
|
|
|
|
|
|
#if IS_ALPHA
|
2014-06-03 20:30:19 +00:00
|
|
|
#define AUDACITY_SUFFIX wxT("-alpha-") __TDATE__
|
2010-01-23 19:44:49 +00:00
|
|
|
#else
|
|
|
|
#define AUDACITY_SUFFIX wxT("") // for a stable release
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define AUDACITY_MAKESTR( x ) #x
|
|
|
|
#define AUDACITY_QUOTE( x ) AUDACITY_MAKESTR( x )
|
|
|
|
|
|
|
|
// Version string for visual display
|
|
|
|
#define AUDACITY_VERSION_STRING wxT( AUDACITY_QUOTE( AUDACITY_VERSION ) ) wxT(".") \
|
|
|
|
wxT( AUDACITY_QUOTE( AUDACITY_RELEASE ) ) wxT(".") \
|
|
|
|
wxT( AUDACITY_QUOTE( AUDACITY_REVISION ) ) \
|
|
|
|
AUDACITY_SUFFIX
|
|
|
|
|
|
|
|
// Version string for file info (under Windows)
|
|
|
|
#define AUDACITY_FILE_VERSION AUDACITY_QUOTE( AUDACITY_VERSION ) "," \
|
|
|
|
AUDACITY_QUOTE( AUDACITY_RELEASE ) "," \
|
|
|
|
AUDACITY_QUOTE( AUDACITY_REVISION ) "," \
|
|
|
|
AUDACITY_QUOTE( AUDACITY_MODLEVEL )
|
|
|
|
|
|
|
|
// Increment this every time the prefs need to be reset
|
|
|
|
// the first part (before the r) indicates the version the reset took place
|
|
|
|
// the second part (after the r) indicates the number of times the prefs have been reset within the same version
|
|
|
|
#define AUDACITY_PREFS_VERSION_STRING "1.1.1r1"
|
|
|
|
|
|
|
|
// Don't change this unless the file format changes
|
|
|
|
// in an irrevocable way
|
|
|
|
#define AUDACITY_FILE_FORMAT_VERSION "1.3.0"
|
|
|
|
|
|
|
|
class wxWindow;
|
|
|
|
|
|
|
|
void QuitAudacity(bool bForce);
|
|
|
|
void QuitAudacity();
|
|
|
|
|
2013-11-21 20:52:17 +00:00
|
|
|
// Please try to support unlimited path length instead of using PLATFORM_MAX_PATH!
|
2014-06-03 20:30:19 +00:00
|
|
|
// Define one constant for maximum path value, so we don't have to do
|
|
|
|
// platform-specific conditionals everywhere we want to check it.
|
2011-01-06 00:07:59 +00:00
|
|
|
#define PLATFORM_MAX_PATH 260 // Play it safe for default, with same value as Windows' MAX_PATH.
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
#include "configmac.h"
|
2011-01-06 00:07:59 +00:00
|
|
|
#undef PLATFORM_MAX_PATH
|
|
|
|
#define PLATFORM_MAX_PATH PATH_MAX
|
2010-01-23 19:44:49 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __WXGTK__
|
|
|
|
#include "configunix.h"
|
2013-11-21 20:52:17 +00:00
|
|
|
// Some systems do not restrict the path length and therefore PATH_MAX is undefined
|
|
|
|
#ifdef PATH_MAX
|
2011-01-06 00:07:59 +00:00
|
|
|
#undef PLATFORM_MAX_PATH
|
|
|
|
#define PLATFORM_MAX_PATH PATH_MAX
|
2010-01-23 19:44:49 +00:00
|
|
|
#endif
|
2013-11-21 20:52:17 +00:00
|
|
|
#endif
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
#ifdef __WXX11__
|
|
|
|
#include "configunix.h"
|
2011-01-06 00:07:59 +00:00
|
|
|
// wxX11 should also get the platform-specific definition of PLATFORM_MAX_PATH, so do not declare here.
|
2010-01-23 19:44:49 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __WXMSW__
|
|
|
|
#include "configwin.h"
|
2011-01-06 00:07:59 +00:00
|
|
|
#undef PLATFORM_MAX_PATH
|
|
|
|
#define PLATFORM_MAX_PATH MAX_PATH
|
2010-01-23 19:44:49 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Magic for dynamic library import and export. This is unfortunately
|
|
|
|
* compiler-specific because there isn't a standard way to do it. Currently it
|
|
|
|
* works with the Visual Studio compiler for windows, and for GCC 4+. Anything
|
|
|
|
* else gets all symbols made public, which gets messy */
|
|
|
|
/* The Visual Studio implementation */
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#ifndef AUDACITY_DLL_API
|
|
|
|
#ifdef BUILDING_AUDACITY
|
|
|
|
#define AUDACITY_DLL_API _declspec(dllexport)
|
|
|
|
#else
|
|
|
|
#ifdef _DLL
|
|
|
|
#define AUDACITY_DLL_API _declspec(dllimport)
|
|
|
|
#else
|
|
|
|
#define AUDACITY_DLL_API
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif //_MSC_VER
|
|
|
|
|
2016-01-29 14:00:02 +00:00
|
|
|
// Put extra symbol information in the release build, for the purpose of gathering
|
|
|
|
// profiling information (as from Windows Process Monitor), when there otherwise
|
|
|
|
// isn't a need for AUDACITY_DLL_API.
|
|
|
|
#if IS_ALPHA
|
|
|
|
#define PROFILE_DLL_API AUDACITY_DLL_API
|
|
|
|
#else
|
|
|
|
#define PROFILE_DLL_API
|
|
|
|
#endif
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
/* The GCC-elf implementation */
|
|
|
|
#ifdef HAVE_VISIBILITY // this is provided by the configure script, is only
|
|
|
|
// enabled for suitable GCC versions
|
2014-06-03 20:30:19 +00:00
|
|
|
/* The incantation is a bit weird here because it uses ELF symbol stuff. If we
|
2010-01-23 19:44:49 +00:00
|
|
|
* make a symbol "default" it makes it visible (for import or export). Making it
|
|
|
|
* "hidden" means it is invisible outside the shared object. */
|
|
|
|
#ifndef AUDACITY_DLL_API
|
|
|
|
#ifdef BUILDING_AUDACITY
|
|
|
|
#define AUDACITY_DLL_API __attribute__((visibility("default")))
|
|
|
|
#else
|
|
|
|
#define AUDACITY_DLL_API __attribute__((visibility("default")))
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The GCC-win32 implementation */
|
|
|
|
// bizzarely, GCC-for-win32 supports Visual Studio style symbol visibility, so
|
|
|
|
// we use that if building on Cygwin
|
|
|
|
#if defined __CYGWIN__ && defined __GNUC__
|
|
|
|
#ifndef AUDACITY_DLL_API
|
|
|
|
#ifdef BUILDING_AUDACITY
|
|
|
|
#define AUDACITY_DLL_API _declspec(dllexport)
|
|
|
|
#else
|
|
|
|
#ifdef _DLL
|
|
|
|
#define AUDACITY_DLL_API _declspec(dllimport)
|
|
|
|
#else
|
|
|
|
#define AUDACITY_DLL_API
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2015-07-24 20:59:34 +00:00
|
|
|
// These macros are used widely, so declared here.
|
2016-08-28 20:11:56 +00:00
|
|
|
#define QUANTIZED_TIME(time, rate) (floor(((double)(time) * (rate)) + 0.5) / (rate))
|
2015-07-24 20:59:34 +00:00
|
|
|
// dB - linear amplitude convesions
|
2015-07-26 04:05:27 +00:00
|
|
|
#define DB_TO_LINEAR(x) (pow(10.0, (x) / 20.0))
|
|
|
|
#define LINEAR_TO_DB(x) (20.0 * log10(x))
|
2011-01-12 21:24:01 +00:00
|
|
|
|
2016-11-22 18:16:03 +00:00
|
|
|
#define MAX_AUDIO (1. - 1./(1<<15))
|
|
|
|
#define JUST_BELOW_MAX_AUDIO (1. - 1./(1<<14))
|
|
|
|
|
2015-04-19 03:49:05 +00:00
|
|
|
// Marks strings for extraction only...must use wxGetTranslation() to translate.
|
|
|
|
#define XO(s) wxT(s)
|
2016-09-11 12:03:37 +00:00
|
|
|
// Marks string for substitution only.
|
|
|
|
#define _TS(s) wxT(s)
|
2015-04-19 03:49:05 +00:00
|
|
|
|
2016-02-19 15:46:23 +00:00
|
|
|
// This renames a good use of this C++ keyword that we don't need to review when hunting for leaks.
|
|
|
|
#define PROHIBITED = delete
|
|
|
|
|
|
|
|
// Reviewed, certified, non-leaky uses of NEW that immediately entrust their results to RAII objects.
|
|
|
|
// You may use it in NEW code when constructing a wxWindow subclass with non-NULL parent window.
|
|
|
|
// You may use it in NEW code when the NEW expression is the constructor argument for a standard smart
|
2016-02-13 23:06:35 +00:00
|
|
|
// pointer like std::unique_ptr or std::shared_ptr.
|
|
|
|
#define safenew new
|
|
|
|
|
2011-01-12 21:24:01 +00:00
|
|
|
#endif // __AUDACITY_H__
|