mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-16 08:34:10 +02:00
Merge pull request #1345 from Paul-Licameli/extract-lib-math
Extract lib math
This commit is contained in:
commit
13cb2c2a3f
@ -160,7 +160,6 @@ set_conan_vars_to_parent()
|
|||||||
#
|
#
|
||||||
# directory option symbol req chk version
|
# directory option symbol req chk version
|
||||||
addlib( libsndfile sndfile SNDFILE YES YES "sndfile >= 1.0.28" )
|
addlib( libsndfile sndfile SNDFILE YES YES "sndfile >= 1.0.28" )
|
||||||
addlib( libsoxr soxr SOXR YES YES "soxr >= 0.1.1" )
|
|
||||||
addlib( portaudio-v19 portaudio PORTAUDIO YES YES "" )
|
addlib( portaudio-v19 portaudio PORTAUDIO YES YES "" )
|
||||||
addlib( sqlite sqlite SQLITE YES YES "sqlite3 >= 3.32.0" )
|
addlib( sqlite sqlite SQLITE YES YES "sqlite3 >= 3.32.0" )
|
||||||
|
|
||||||
|
@ -95,3 +95,6 @@ target_compile_definitions( ${TARGET} PRIVATE ${DEFINES} )
|
|||||||
target_compile_options( ${TARGET} PRIVATE ${OPTIONS} )
|
target_compile_options( ${TARGET} PRIVATE ${OPTIONS} )
|
||||||
target_include_directories( ${TARGET} PRIVATE ${INCLUDES} )
|
target_include_directories( ${TARGET} PRIVATE ${INCLUDES} )
|
||||||
|
|
||||||
|
if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
|
||||||
|
target_compile_options( ${TARGET} PRIVATE -fPIC )
|
||||||
|
endif()
|
||||||
|
@ -58,162 +58,6 @@
|
|||||||
// until proper public headers are created for the stuff in here.
|
// until proper public headers are created for the stuff in here.
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// A native 64-bit integer...used when referring to any number of samples
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class sampleCount
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
using type = long long;
|
|
||||||
static_assert(sizeof(type) == 8, "Wrong width of sampleCount");
|
|
||||||
|
|
||||||
sampleCount () : value { 0 } {}
|
|
||||||
|
|
||||||
// Allow implicit conversion from integral types
|
|
||||||
sampleCount ( type v ) : value { v } {}
|
|
||||||
sampleCount ( unsigned long long v ) : value ( v ) {}
|
|
||||||
sampleCount ( int v ) : value { v } {}
|
|
||||||
sampleCount ( unsigned v ) : value { v } {}
|
|
||||||
sampleCount ( long v ) : value { v } {}
|
|
||||||
|
|
||||||
// unsigned long is 64 bit on some platforms. Let it narrow.
|
|
||||||
sampleCount ( unsigned long v ) : value ( v ) {}
|
|
||||||
|
|
||||||
// Beware implicit conversions from floating point values!
|
|
||||||
// Otherwise the meaning of binary operators with sampleCount change
|
|
||||||
// their meaning when sampleCount is not an alias!
|
|
||||||
explicit sampleCount ( float f ) : value ( f ) {}
|
|
||||||
explicit sampleCount ( double d ) : value ( d ) {}
|
|
||||||
|
|
||||||
sampleCount ( const sampleCount& ) = default;
|
|
||||||
sampleCount &operator= ( const sampleCount& ) = default;
|
|
||||||
|
|
||||||
float as_float() const { return value; }
|
|
||||||
double as_double() const { return value; }
|
|
||||||
|
|
||||||
long long as_long_long() const { return value; }
|
|
||||||
|
|
||||||
size_t as_size_t() const {
|
|
||||||
wxASSERT(value >= 0);
|
|
||||||
wxASSERT(static_cast<std::make_unsigned<type>::type>(value) <= std::numeric_limits<size_t>::max());
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
sampleCount &operator += (sampleCount b) { value += b.value; return *this; }
|
|
||||||
sampleCount &operator -= (sampleCount b) { value -= b.value; return *this; }
|
|
||||||
sampleCount &operator *= (sampleCount b) { value *= b.value; return *this; }
|
|
||||||
sampleCount &operator /= (sampleCount b) { value /= b.value; return *this; }
|
|
||||||
sampleCount &operator %= (sampleCount b) { value %= b.value; return *this; }
|
|
||||||
|
|
||||||
sampleCount operator - () const { return -value; }
|
|
||||||
|
|
||||||
sampleCount &operator ++ () { ++value; return *this; }
|
|
||||||
sampleCount operator ++ (int)
|
|
||||||
{ sampleCount result{ *this }; ++value; return result; }
|
|
||||||
|
|
||||||
sampleCount &operator -- () { --value; return *this; }
|
|
||||||
sampleCount operator -- (int)
|
|
||||||
{ sampleCount result{ *this }; --value; return result; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
type value;
|
|
||||||
};
|
|
||||||
|
|
||||||
inline bool operator == (sampleCount a, sampleCount b)
|
|
||||||
{
|
|
||||||
return a.as_long_long() == b.as_long_long();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator != (sampleCount a, sampleCount b)
|
|
||||||
{
|
|
||||||
return !(a == b);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator < (sampleCount a, sampleCount b)
|
|
||||||
{
|
|
||||||
return a.as_long_long() < b.as_long_long();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator >= (sampleCount a, sampleCount b)
|
|
||||||
{
|
|
||||||
return !(a < b);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator > (sampleCount a, sampleCount b)
|
|
||||||
{
|
|
||||||
return b < a;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator <= (sampleCount a, sampleCount b)
|
|
||||||
{
|
|
||||||
return !(b < a);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline sampleCount operator + (sampleCount a, sampleCount b)
|
|
||||||
{
|
|
||||||
return sampleCount{ a } += b;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline sampleCount operator - (sampleCount a, sampleCount b)
|
|
||||||
{
|
|
||||||
return sampleCount{ a } -= b;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline sampleCount operator * (sampleCount a, sampleCount b)
|
|
||||||
{
|
|
||||||
return sampleCount{ a } *= b;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline sampleCount operator / (sampleCount a, sampleCount b)
|
|
||||||
{
|
|
||||||
return sampleCount{ a } /= b;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline sampleCount operator % (sampleCount a, sampleCount b)
|
|
||||||
{
|
|
||||||
return sampleCount{ a } %= b;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Function returning the minimum of a sampleCount and a size_t,
|
|
||||||
// hiding the casts
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
inline size_t limitSampleBufferSize( size_t bufferSize, sampleCount limit )
|
|
||||||
{
|
|
||||||
return
|
|
||||||
std::min( sampleCount( bufferSize ), std::max( sampleCount(0), limit ) )
|
|
||||||
.as_size_t();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Supported sample formats
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
enum sampleFormat : unsigned
|
|
||||||
{
|
|
||||||
//! The increasing sequence of these enum values must correspond to the increasing data type width
|
|
||||||
//! These values persist in saved project files, so must not be changed in later program versions
|
|
||||||
int16Sample = 0x00020001,
|
|
||||||
int24Sample = 0x00040001,
|
|
||||||
floatSample = 0x0004000F,
|
|
||||||
|
|
||||||
//! Two synonyms for previous values that might change if more values were added
|
|
||||||
narrowestSampleFormat = int16Sample,
|
|
||||||
widestSampleFormat = floatSample,
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Provide the number of bytes a specific sample will take
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
#define SAMPLE_SIZE(SampleFormat) (SampleFormat >> 16)
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Generic pointer to sample data
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
typedef char *samplePtr;
|
|
||||||
typedef const char *constSamplePtr;
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// The type for plugin IDs
|
// The type for plugin IDs
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -11,6 +11,7 @@ set( LIBRARIES
|
|||||||
lib-basic-ui
|
lib-basic-ui
|
||||||
lib-exceptions
|
lib-exceptions
|
||||||
lib-preferences
|
lib-preferences
|
||||||
|
lib-math
|
||||||
)
|
)
|
||||||
|
|
||||||
if ( ${_OPT}has_networking )
|
if ( ${_OPT}has_networking )
|
||||||
|
36
libraries/lib-math/CMakeLists.txt
Normal file
36
libraries/lib-math/CMakeLists.txt
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#[[
|
||||||
|
A library of mathematical utilities and manipulation of samples
|
||||||
|
]]#
|
||||||
|
|
||||||
|
addlib( libsoxr soxr SOXR YES YES "soxr >= 0.1.1" )
|
||||||
|
|
||||||
|
set( SOURCES
|
||||||
|
Dither.cpp
|
||||||
|
Dither.h
|
||||||
|
FFT.cpp
|
||||||
|
FFT.h
|
||||||
|
InterpolateAudio.cpp
|
||||||
|
InterpolateAudio.h
|
||||||
|
Matrix.cpp
|
||||||
|
Matrix.h
|
||||||
|
RealFFTf.cpp
|
||||||
|
RealFFTf.h
|
||||||
|
Resample.cpp
|
||||||
|
Resample.h
|
||||||
|
SampleCount.cpp
|
||||||
|
SampleCount.h
|
||||||
|
SampleFormat.cpp
|
||||||
|
SampleFormat.h
|
||||||
|
Spectrum.cpp
|
||||||
|
Spectrum.h
|
||||||
|
float_cast.h
|
||||||
|
)
|
||||||
|
set( LIBRARIES
|
||||||
|
libsoxr
|
||||||
|
lib-preferences-interface
|
||||||
|
PRIVATE
|
||||||
|
wxBase
|
||||||
|
)
|
||||||
|
audacity_library( lib-math "${SOURCES}" "${LIBRARIES}"
|
||||||
|
"" ""
|
||||||
|
)
|
@ -10,7 +10,7 @@
|
|||||||
#ifndef __AUDACITY_DITHER_H__
|
#ifndef __AUDACITY_DITHER_H__
|
||||||
#define __AUDACITY_DITHER_H__
|
#define __AUDACITY_DITHER_H__
|
||||||
|
|
||||||
#include "audacity/Types.h" // for samplePtr
|
#include "SampleFormat.h"
|
||||||
|
|
||||||
template< typename Enum > class EnumSetting;
|
template< typename Enum > class EnumSetting;
|
||||||
|
|
||||||
@ -19,13 +19,14 @@ template< typename Enum > class EnumSetting;
|
|||||||
enum DitherType : unsigned {
|
enum DitherType : unsigned {
|
||||||
none = 0, rectangle = 1, triangle = 2, shaped = 3 };
|
none = 0, rectangle = 1, triangle = 2, shaped = 3 };
|
||||||
|
|
||||||
class Dither
|
class MATH_API Dither
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static DitherType FastDitherChoice();
|
static DitherType FastDitherChoice();
|
||||||
static DitherType BestDitherChoice();
|
static DitherType BestDitherChoice();
|
||||||
|
|
||||||
static AUDACITY_DLL_API EnumSetting< DitherType > FastSetting, BestSetting;
|
static EnumSetting< DitherType > FastSetting;
|
||||||
|
static EnumSetting< DitherType > BestSetting;
|
||||||
|
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
Dither();
|
Dither();
|
@ -39,7 +39,6 @@
|
|||||||
* 9: Gaussian(a=4.5)
|
* 9: Gaussian(a=4.5)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "FFT.h"
|
#include "FFT.h"
|
||||||
|
|
||||||
#include "Internat.h"
|
#include "Internat.h"
|
@ -63,6 +63,7 @@ class TranslatableString;
|
|||||||
* input array, and that NumSamples must be a power of two.
|
* input array, and that NumSamples must be a power of two.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
MATH_API
|
||||||
void PowerSpectrum(size_t NumSamples, const float *In, float *Out);
|
void PowerSpectrum(size_t NumSamples, const float *In, float *Out);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -72,7 +73,7 @@ void PowerSpectrum(size_t NumSamples, const float *In, float *Out);
|
|||||||
* NumSamples must be a power of two.
|
* NumSamples must be a power of two.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AUDACITY_DLL_API
|
MATH_API
|
||||||
void RealFFT(size_t NumSamples,
|
void RealFFT(size_t NumSamples,
|
||||||
const float *RealIn, float *RealOut, float *ImagOut);
|
const float *RealIn, float *RealOut, float *ImagOut);
|
||||||
|
|
||||||
@ -81,7 +82,7 @@ void RealFFT(size_t NumSamples,
|
|||||||
* so the output is purely real. NumSamples must be a power of
|
* so the output is purely real. NumSamples must be a power of
|
||||||
* two.
|
* two.
|
||||||
*/
|
*/
|
||||||
AUDACITY_DLL_API
|
MATH_API
|
||||||
void InverseRealFFT(size_t NumSamples,
|
void InverseRealFFT(size_t NumSamples,
|
||||||
const float *RealIn, const float *ImagIn, float *RealOut);
|
const float *RealIn, const float *ImagIn, float *RealOut);
|
||||||
|
|
||||||
@ -91,7 +92,7 @@ void InverseRealFFT(size_t NumSamples,
|
|||||||
* inverse transform as well.
|
* inverse transform as well.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AUDACITY_DLL_API
|
MATH_API
|
||||||
void FFT(size_t NumSamples,
|
void FFT(size_t NumSamples,
|
||||||
bool InverseTransform,
|
bool InverseTransform,
|
||||||
const float *RealIn, const float *ImagIn, float *RealOut, float *ImagOut);
|
const float *RealIn, const float *ImagIn, float *RealOut, float *ImagOut);
|
||||||
@ -120,7 +121,7 @@ enum eWindowFunctions
|
|||||||
eWinFuncCount
|
eWinFuncCount
|
||||||
};
|
};
|
||||||
|
|
||||||
AUDACITY_DLL_API
|
MATH_API
|
||||||
void WindowFunc(int whichFunction, size_t NumSamples, float *data);
|
void WindowFunc(int whichFunction, size_t NumSamples, float *data);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -129,7 +130,7 @@ void WindowFunc(int whichFunction, size_t NumSamples, float *data);
|
|||||||
* otherwise about (NumSamples - 1) / 2
|
* otherwise about (NumSamples - 1) / 2
|
||||||
* All functions have 0 in data[0] except Rectangular, Hamming and Gaussians
|
* All functions have 0 in data[0] except Rectangular, Hamming and Gaussians
|
||||||
*/
|
*/
|
||||||
AUDACITY_DLL_API
|
MATH_API
|
||||||
void NewWindowFunc(int whichFunction, size_t NumSamples, bool extraSample, float *data);
|
void NewWindowFunc(int whichFunction, size_t NumSamples, bool extraSample, float *data);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -139,21 +140,21 @@ void NewWindowFunc(int whichFunction, size_t NumSamples, bool extraSample, float
|
|||||||
* otherwise about (NumSamples - 1) / 2
|
* otherwise about (NumSamples - 1) / 2
|
||||||
* All functions have 0 in data[0] except Rectangular, Hamming and Gaussians
|
* All functions have 0 in data[0] except Rectangular, Hamming and Gaussians
|
||||||
*/
|
*/
|
||||||
AUDACITY_DLL_API
|
MATH_API
|
||||||
void DerivativeOfWindowFunc(int whichFunction, size_t NumSamples, bool extraSample, float *data);
|
void DerivativeOfWindowFunc(int whichFunction, size_t NumSamples, bool extraSample, float *data);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the name of the windowing function (for UI display)
|
* Returns the name of the windowing function (for UI display)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AUDACITY_DLL_API const TranslatableString WindowFuncName(int whichFunction);
|
MATH_API const TranslatableString WindowFuncName(int whichFunction);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the number of windowing functions supported
|
* Returns the number of windowing functions supported
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AUDACITY_DLL_API int NumWindowFuncs();
|
MATH_API int NumWindowFuncs();
|
||||||
|
|
||||||
void DeinitFFT();
|
MATH_API void DeinitFFT();
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -25,7 +25,6 @@
|
|||||||
#ifndef __AUDACITY_INTERPOLATE_AUDIO__
|
#ifndef __AUDACITY_INTERPOLATE_AUDIO__
|
||||||
#define __AUDACITY_INTERPOLATE_AUDIO__
|
#define __AUDACITY_INTERPOLATE_AUDIO__
|
||||||
|
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
// See top of file for a description of the algorithm. Interpolates
|
// See top of file for a description of the algorithm. Interpolates
|
||||||
@ -36,7 +35,7 @@
|
|||||||
// side (6x the number of bad samples on either side is great). However,
|
// side (6x the number of bad samples on either side is great). However,
|
||||||
// it will work with less data, and with the bad samples on one end or
|
// it will work with less data, and with the bad samples on one end or
|
||||||
// the other.
|
// the other.
|
||||||
void AUDACITY_DLL_API InterpolateAudio(float *buffer, size_t len,
|
void MATH_API InterpolateAudio(float *buffer, size_t len,
|
||||||
size_t firstBad, size_t numBad);
|
size_t firstBad, size_t numBad);
|
||||||
|
|
||||||
#endif // __AUDACITY_INTERPOLATE_AUDIO__
|
#endif // __AUDACITY_INTERPOLATE_AUDIO__
|
@ -36,11 +36,8 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "RealFFTf.h"
|
#include "RealFFTf.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
@ -1,10 +1,6 @@
|
|||||||
#ifndef __realfftf_h
|
#ifndef __realfftf_h
|
||||||
#define __realfftf_h
|
#define __realfftf_h
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "MemoryX.h"
|
#include "MemoryX.h"
|
||||||
|
|
||||||
using fft_type = float;
|
using fft_type = float;
|
||||||
@ -17,7 +13,7 @@ struct FFTParam {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AUDACITY_DLL_API FFTDeleter{
|
struct MATH_API FFTDeleter{
|
||||||
void operator () (FFTParam *p) const;
|
void operator () (FFTParam *p) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -25,11 +21,11 @@ using HFFT = std::unique_ptr<
|
|||||||
FFTParam, FFTDeleter
|
FFTParam, FFTDeleter
|
||||||
>;
|
>;
|
||||||
|
|
||||||
AUDACITY_DLL_API HFFT GetFFT(size_t);
|
MATH_API HFFT GetFFT(size_t);
|
||||||
AUDACITY_DLL_API void RealFFTf(fft_type *, const FFTParam *);
|
MATH_API void RealFFTf(fft_type *, const FFTParam *);
|
||||||
AUDACITY_DLL_API void InverseRealFFTf(fft_type *, const FFTParam *);
|
MATH_API void InverseRealFFTf(fft_type *, const FFTParam *);
|
||||||
AUDACITY_DLL_API void ReorderToTime(const FFTParam *hFFT, const fft_type *buffer, fft_type *TimeOut);
|
MATH_API void ReorderToTime(const FFTParam *hFFT, const fft_type *buffer, fft_type *TimeOut);
|
||||||
AUDACITY_DLL_API void ReorderToFreq(const FFTParam *hFFT, const fft_type *buffer,
|
MATH_API void ReorderToFreq(const FFTParam *hFFT, const fft_type *buffer,
|
||||||
fft_type *RealOut, fft_type *ImagOut);
|
fft_type *RealOut, fft_type *ImagOut);
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -12,8 +12,6 @@
|
|||||||
#ifndef __AUDACITY_RESAMPLE_H__
|
#ifndef __AUDACITY_RESAMPLE_H__
|
||||||
#define __AUDACITY_RESAMPLE_H__
|
#define __AUDACITY_RESAMPLE_H__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "SampleFormat.h"
|
#include "SampleFormat.h"
|
||||||
|
|
||||||
template< typename Enum > class EnumSetting;
|
template< typename Enum > class EnumSetting;
|
||||||
@ -25,7 +23,7 @@ struct soxr_deleter {
|
|||||||
};
|
};
|
||||||
using soxrHandle = std::unique_ptr<soxr, soxr_deleter>;
|
using soxrHandle = std::unique_ptr<soxr, soxr_deleter>;
|
||||||
|
|
||||||
class AUDACITY_DLL_API Resample final
|
class MATH_API Resample final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Resamplers may have more than one method, offering a
|
/// Resamplers may have more than one method, offering a
|
26
libraries/lib-math/SampleCount.cpp
Normal file
26
libraries/lib-math/SampleCount.cpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/**********************************************************************
|
||||||
|
|
||||||
|
Audacity: A Digital Audio Editor
|
||||||
|
|
||||||
|
@file SampleCount.cpp
|
||||||
|
|
||||||
|
Paul Licameli split from audacity/Types.h
|
||||||
|
|
||||||
|
**********************************************************************/
|
||||||
|
#include "SampleCount.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <wx/debug.h>
|
||||||
|
|
||||||
|
size_t sampleCount::as_size_t() const {
|
||||||
|
wxASSERT(value >= 0);
|
||||||
|
wxASSERT(static_cast<std::make_unsigned<type>::type>(value) <= std::numeric_limits<size_t>::max());
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t limitSampleBufferSize( size_t bufferSize, sampleCount limit )
|
||||||
|
{
|
||||||
|
return
|
||||||
|
std::min( sampleCount( bufferSize ), std::max( sampleCount(0), limit ) )
|
||||||
|
.as_size_t();
|
||||||
|
}
|
134
libraries/lib-math/SampleCount.h
Normal file
134
libraries/lib-math/SampleCount.h
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
/**********************************************************************
|
||||||
|
|
||||||
|
Audacity: A Digital Audio Editor
|
||||||
|
|
||||||
|
@file SampleCount.h
|
||||||
|
|
||||||
|
Paul Licameli split from audacity/Types.h
|
||||||
|
|
||||||
|
**********************************************************************/
|
||||||
|
#ifndef __AUDACITY_SAMPLE_COUNT__
|
||||||
|
#define __AUDACITY_SAMPLE_COUNT__
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
//! Positions or offsets within audio files need a wide type
|
||||||
|
/*! This type disallows implicit interconversions with narrower types */
|
||||||
|
class MATH_API sampleCount
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using type = long long;
|
||||||
|
static_assert(sizeof(type) == 8, "Wrong width of sampleCount");
|
||||||
|
|
||||||
|
sampleCount () : value { 0 } {}
|
||||||
|
|
||||||
|
// Allow implicit conversion from integral types
|
||||||
|
sampleCount ( type v ) : value { v } {}
|
||||||
|
sampleCount ( unsigned long long v ) : value ( v ) {}
|
||||||
|
sampleCount ( int v ) : value { v } {}
|
||||||
|
sampleCount ( unsigned v ) : value { v } {}
|
||||||
|
sampleCount ( long v ) : value { v } {}
|
||||||
|
|
||||||
|
// unsigned long is 64 bit on some platforms. Let it narrow.
|
||||||
|
sampleCount ( unsigned long v ) : value ( v ) {}
|
||||||
|
|
||||||
|
// Beware implicit conversions from floating point values!
|
||||||
|
// Otherwise the meaning of binary operators with sampleCount change
|
||||||
|
// their meaning when sampleCount is not an alias!
|
||||||
|
explicit sampleCount ( float f ) : value ( f ) {}
|
||||||
|
explicit sampleCount ( double d ) : value ( d ) {}
|
||||||
|
|
||||||
|
sampleCount ( const sampleCount& ) = default;
|
||||||
|
sampleCount &operator= ( const sampleCount& ) = default;
|
||||||
|
|
||||||
|
float as_float() const { return value; }
|
||||||
|
double as_double() const { return value; }
|
||||||
|
|
||||||
|
long long as_long_long() const { return value; }
|
||||||
|
|
||||||
|
size_t as_size_t() const;
|
||||||
|
|
||||||
|
sampleCount &operator += (sampleCount b) { value += b.value; return *this; }
|
||||||
|
sampleCount &operator -= (sampleCount b) { value -= b.value; return *this; }
|
||||||
|
sampleCount &operator *= (sampleCount b) { value *= b.value; return *this; }
|
||||||
|
sampleCount &operator /= (sampleCount b) { value /= b.value; return *this; }
|
||||||
|
sampleCount &operator %= (sampleCount b) { value %= b.value; return *this; }
|
||||||
|
|
||||||
|
sampleCount operator - () const { return -value; }
|
||||||
|
|
||||||
|
sampleCount &operator ++ () { ++value; return *this; }
|
||||||
|
sampleCount operator ++ (int)
|
||||||
|
{ sampleCount result{ *this }; ++value; return result; }
|
||||||
|
|
||||||
|
sampleCount &operator -- () { --value; return *this; }
|
||||||
|
sampleCount operator -- (int)
|
||||||
|
{ sampleCount result{ *this }; --value; return result; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
type value;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool operator == (sampleCount a, sampleCount b)
|
||||||
|
{
|
||||||
|
return a.as_long_long() == b.as_long_long();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator != (sampleCount a, sampleCount b)
|
||||||
|
{
|
||||||
|
return !(a == b);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator < (sampleCount a, sampleCount b)
|
||||||
|
{
|
||||||
|
return a.as_long_long() < b.as_long_long();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator >= (sampleCount a, sampleCount b)
|
||||||
|
{
|
||||||
|
return !(a < b);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator > (sampleCount a, sampleCount b)
|
||||||
|
{
|
||||||
|
return b < a;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator <= (sampleCount a, sampleCount b)
|
||||||
|
{
|
||||||
|
return !(b < a);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline sampleCount operator + (sampleCount a, sampleCount b)
|
||||||
|
{
|
||||||
|
return sampleCount{ a } += b;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline sampleCount operator - (sampleCount a, sampleCount b)
|
||||||
|
{
|
||||||
|
return sampleCount{ a } -= b;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline sampleCount operator * (sampleCount a, sampleCount b)
|
||||||
|
{
|
||||||
|
return sampleCount{ a } *= b;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline sampleCount operator / (sampleCount a, sampleCount b)
|
||||||
|
{
|
||||||
|
return sampleCount{ a } /= b;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline sampleCount operator % (sampleCount a, sampleCount b)
|
||||||
|
{
|
||||||
|
return sampleCount{ a } %= b;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Function returning the minimum of a sampleCount and a size_t,
|
||||||
|
// hiding the casts
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
MATH_API
|
||||||
|
size_t limitSampleBufferSize( size_t bufferSize, sampleCount limit );
|
||||||
|
|
||||||
|
#endif
|
@ -35,6 +35,7 @@
|
|||||||
*//*******************************************************************/
|
*//*******************************************************************/
|
||||||
|
|
||||||
#include "SampleFormat.h"
|
#include "SampleFormat.h"
|
||||||
|
#include "Dither.h" // CYCLE
|
||||||
|
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
@ -11,32 +11,43 @@
|
|||||||
#ifndef __AUDACITY_SAMPLE_FORMAT__
|
#ifndef __AUDACITY_SAMPLE_FORMAT__
|
||||||
#define __AUDACITY_SAMPLE_FORMAT__
|
#define __AUDACITY_SAMPLE_FORMAT__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "MemoryX.h"
|
#include "MemoryX.h"
|
||||||
#include <wx/defs.h>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include "audacity/Types.h"
|
|
||||||
#include "Dither.h"
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Definitions / Meta-Information
|
// Definitions / Meta-Information
|
||||||
//
|
//
|
||||||
|
|
||||||
|
enum DitherType : unsigned;
|
||||||
//! These global variables are assigned at application startup or after change of preferences.
|
//! These global variables are assigned at application startup or after change of preferences.
|
||||||
extern AUDACITY_DLL_API DitherType gLowQualityDither, gHighQualityDither;
|
extern MATH_API DitherType gLowQualityDither, gHighQualityDither;
|
||||||
|
|
||||||
#if 0
|
// ----------------------------------------------------------------------------
|
||||||
// Moved to audacity/types.h
|
// Supported sample formats
|
||||||
typedef enum {
|
// ----------------------------------------------------------------------------
|
||||||
|
enum sampleFormat : unsigned
|
||||||
|
{
|
||||||
|
//! The increasing sequence of these enum values must correspond to the increasing data type width
|
||||||
|
//! These values persist in saved project files, so must not be changed in later program versions
|
||||||
int16Sample = 0x00020001,
|
int16Sample = 0x00020001,
|
||||||
int24Sample = 0x00040001,
|
int24Sample = 0x00040001,
|
||||||
floatSample = 0x0004000F
|
floatSample = 0x0004000F,
|
||||||
} sampleFormat;
|
|
||||||
|
|
||||||
/** \brief Return the size (in memory) of one sample (bytes) */
|
//! Two synonyms for previous values that might change if more values were added
|
||||||
#define SAMPLE_SIZE(SampleFormat) ( size_t{ (SampleFormat) >> 16 } )
|
narrowestSampleFormat = int16Sample,
|
||||||
#endif
|
widestSampleFormat = floatSample,
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Provide the number of bytes a specific sample will take
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
#define SAMPLE_SIZE(SampleFormat) (SampleFormat >> 16)
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Generic pointer to sample data
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
using samplePtr = char *;
|
||||||
|
using constSamplePtr = const char *;
|
||||||
|
|
||||||
// Used to determine how to fill in empty areas of audio.
|
// Used to determine how to fill in empty areas of audio.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -48,7 +59,8 @@ typedef enum {
|
|||||||
#define SAMPLE_SIZE_DISK(SampleFormat) (((SampleFormat) == int24Sample) ? \
|
#define SAMPLE_SIZE_DISK(SampleFormat) (((SampleFormat) == int24Sample) ? \
|
||||||
size_t{ 3 } : SAMPLE_SIZE(SampleFormat) )
|
size_t{ 3 } : SAMPLE_SIZE(SampleFormat) )
|
||||||
|
|
||||||
AUDACITY_DLL_API TranslatableString GetSampleFormatStr(sampleFormat format);
|
class TranslatableString;
|
||||||
|
MATH_API TranslatableString GetSampleFormatStr(sampleFormat format);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocating/Freeing Samples
|
// Allocating/Freeing Samples
|
||||||
@ -128,7 +140,7 @@ private:
|
|||||||
// Copying, Converting and Clearing Samples
|
// Copying, Converting and Clearing Samples
|
||||||
//
|
//
|
||||||
|
|
||||||
AUDACITY_DLL_API
|
MATH_API
|
||||||
//! Copy samples from any format into the widest format, which is 32 bit float, with no dithering
|
//! Copy samples from any format into the widest format, which is 32 bit float, with no dithering
|
||||||
/*!
|
/*!
|
||||||
@param src address of source samples
|
@param src address of source samples
|
||||||
@ -141,7 +153,7 @@ AUDACITY_DLL_API
|
|||||||
void SamplesToFloats(constSamplePtr src, sampleFormat srcFormat,
|
void SamplesToFloats(constSamplePtr src, sampleFormat srcFormat,
|
||||||
float *dst, size_t len, size_t srcStride = 1, size_t dstStride = 1);
|
float *dst, size_t len, size_t srcStride = 1, size_t dstStride = 1);
|
||||||
|
|
||||||
AUDACITY_DLL_API
|
MATH_API
|
||||||
//! Copy samples from any format to any other format; apply dithering only if narrowing the format
|
//! Copy samples from any format to any other format; apply dithering only if narrowing the format
|
||||||
/*!
|
/*!
|
||||||
@copydetails SamplesToFloats()
|
@copydetails SamplesToFloats()
|
||||||
@ -153,11 +165,11 @@ void CopySamples(constSamplePtr src, sampleFormat srcFormat,
|
|||||||
DitherType ditherType = gHighQualityDither, //!< default is loaded from a global variable
|
DitherType ditherType = gHighQualityDither, //!< default is loaded from a global variable
|
||||||
unsigned int srcStride=1, unsigned int dstStride=1);
|
unsigned int srcStride=1, unsigned int dstStride=1);
|
||||||
|
|
||||||
AUDACITY_DLL_API
|
MATH_API
|
||||||
void ClearSamples(samplePtr buffer, sampleFormat format,
|
void ClearSamples(samplePtr buffer, sampleFormat format,
|
||||||
size_t start, size_t len);
|
size_t start, size_t len);
|
||||||
|
|
||||||
AUDACITY_DLL_API
|
MATH_API
|
||||||
void ReverseSamples(samplePtr buffer, sampleFormat format,
|
void ReverseSamples(samplePtr buffer, sampleFormat format,
|
||||||
int start, int len);
|
int start, int len);
|
||||||
|
|
||||||
@ -166,7 +178,7 @@ void ReverseSamples(samplePtr buffer, sampleFormat format,
|
|||||||
// are set in preferences.
|
// are set in preferences.
|
||||||
//
|
//
|
||||||
|
|
||||||
AUDACITY_DLL_API
|
MATH_API
|
||||||
void InitDitherers();
|
void InitDitherers();
|
||||||
|
|
||||||
// These are so commonly done for processing samples in floating point form in memory,
|
// These are so commonly done for processing samples in floating point form in memory,
|
@ -21,7 +21,7 @@
|
|||||||
calculates windowSize/2 frequency samples
|
calculates windowSize/2 frequency samples
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AUDACITY_DLL_API
|
MATH_API
|
||||||
bool ComputeSpectrum(const float * data, size_t width, size_t windowSize,
|
bool ComputeSpectrum(const float * data, size_t width, size_t windowSize,
|
||||||
double rate, float *out, bool autocorrelation,
|
double rate, float *out, bool autocorrelation,
|
||||||
int windowFunc = eWinFuncHann);
|
int windowFunc = eWinFuncHann);
|
@ -35,8 +35,6 @@
|
|||||||
** long int lrint (double x) ;
|
** long int lrint (double x) ;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* The presence of the required functions are detected during the configure
|
/* The presence of the required functions are detected during the configure
|
||||||
** process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in
|
** process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in
|
||||||
** the config.h file.
|
** the config.h file.
|
@ -40,6 +40,7 @@ using NoteTrackConstArray = std::vector < std::shared_ptr< const NoteTrack > >;
|
|||||||
|
|
||||||
#include <wx/event.h> // to declare custom event types
|
#include <wx/event.h> // to declare custom event types
|
||||||
|
|
||||||
|
#include "SampleCount.h"
|
||||||
#include "SampleFormat.h"
|
#include "SampleFormat.h"
|
||||||
|
|
||||||
class wxArrayString;
|
class wxArrayString;
|
||||||
|
@ -129,14 +129,10 @@ list( APPEND SOURCES
|
|||||||
DeviceManager.h
|
DeviceManager.h
|
||||||
Diags.cpp
|
Diags.cpp
|
||||||
Diags.h
|
Diags.h
|
||||||
Dither.cpp
|
|
||||||
Dither.h
|
|
||||||
Envelope.cpp
|
Envelope.cpp
|
||||||
Envelope.h
|
Envelope.h
|
||||||
EnvelopeEditor.cpp
|
EnvelopeEditor.cpp
|
||||||
EnvelopeEditor.h
|
EnvelopeEditor.h
|
||||||
FFT.cpp
|
|
||||||
FFT.h
|
|
||||||
FFmpeg.cpp
|
FFmpeg.cpp
|
||||||
FFmpeg.h
|
FFmpeg.h
|
||||||
FileException.cpp
|
FileException.cpp
|
||||||
@ -157,8 +153,6 @@ list( APPEND SOURCES
|
|||||||
HitTestResult.h
|
HitTestResult.h
|
||||||
ImageManipulation.cpp
|
ImageManipulation.cpp
|
||||||
ImageManipulation.h
|
ImageManipulation.h
|
||||||
InterpolateAudio.cpp
|
|
||||||
InterpolateAudio.h
|
|
||||||
KeyboardCapture.cpp
|
KeyboardCapture.cpp
|
||||||
KeyboardCapture.h
|
KeyboardCapture.h
|
||||||
LabelDialog.cpp
|
LabelDialog.cpp
|
||||||
@ -175,8 +169,6 @@ list( APPEND SOURCES
|
|||||||
LyricsWindow.cpp
|
LyricsWindow.cpp
|
||||||
LyricsWindow.h
|
LyricsWindow.h
|
||||||
MacroMagic.h
|
MacroMagic.h
|
||||||
Matrix.cpp
|
|
||||||
Matrix.h
|
|
||||||
Menus.cpp
|
Menus.cpp
|
||||||
Menus.h
|
Menus.h
|
||||||
Mix.cpp
|
Mix.cpp
|
||||||
@ -232,22 +224,14 @@ list( APPEND SOURCES
|
|||||||
ProjectWindow.h
|
ProjectWindow.h
|
||||||
ProjectWindowBase.cpp
|
ProjectWindowBase.cpp
|
||||||
ProjectWindowBase.h
|
ProjectWindowBase.h
|
||||||
RealFFTf.cpp
|
|
||||||
RealFFTf.h
|
|
||||||
RealFFTf48x.cpp
|
|
||||||
RealFFTf48x.h
|
|
||||||
RefreshCode.h
|
RefreshCode.h
|
||||||
Registrar.h
|
Registrar.h
|
||||||
Registry.cpp
|
Registry.cpp
|
||||||
Registry.h
|
Registry.h
|
||||||
Resample.cpp
|
|
||||||
Resample.h
|
|
||||||
RingBuffer.cpp
|
RingBuffer.cpp
|
||||||
RingBuffer.h
|
RingBuffer.h
|
||||||
SampleBlock.cpp
|
SampleBlock.cpp
|
||||||
SampleBlock.h
|
SampleBlock.h
|
||||||
SampleFormat.cpp
|
|
||||||
SampleFormat.h
|
|
||||||
Screenshot.cpp
|
Screenshot.cpp
|
||||||
Screenshot.h
|
Screenshot.h
|
||||||
SelectUtilities.cpp
|
SelectUtilities.cpp
|
||||||
@ -270,8 +254,6 @@ list( APPEND SOURCES
|
|||||||
Snap.h
|
Snap.h
|
||||||
SoundActivatedRecord.cpp
|
SoundActivatedRecord.cpp
|
||||||
SoundActivatedRecord.h
|
SoundActivatedRecord.h
|
||||||
Spectrum.cpp
|
|
||||||
Spectrum.h
|
|
||||||
SpectrumAnalyst.cpp
|
SpectrumAnalyst.cpp
|
||||||
SpectrumAnalyst.h
|
SpectrumAnalyst.h
|
||||||
SplashDialog.cpp
|
SplashDialog.cpp
|
||||||
@ -332,7 +314,6 @@ list( APPEND SOURCES
|
|||||||
WrappedType.h
|
WrappedType.h
|
||||||
ZoomInfo.cpp
|
ZoomInfo.cpp
|
||||||
ZoomInfo.h
|
ZoomInfo.h
|
||||||
float_cast.h
|
|
||||||
wxFileNameWrapper.h
|
wxFileNameWrapper.h
|
||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
@ -1091,7 +1072,6 @@ list( APPEND LIBRARIES
|
|||||||
expat::expat
|
expat::expat
|
||||||
libmp3lame::libmp3lame
|
libmp3lame::libmp3lame
|
||||||
libsndfile
|
libsndfile
|
||||||
libsoxr
|
|
||||||
portaudio-v19
|
portaudio-v19
|
||||||
sqlite
|
sqlite
|
||||||
$<$<BOOL:${${_OPT}has_crashreports}>:crashreports>
|
$<$<BOOL:${${_OPT}has_crashreports}>:crashreports>
|
||||||
@ -1352,8 +1332,8 @@ target_compile_definitions( ${TARGET} PRIVATE ${DEFINES} )
|
|||||||
target_compile_options( ${TARGET} PRIVATE ${OPTIONS} )
|
target_compile_options( ${TARGET} PRIVATE ${OPTIONS} )
|
||||||
target_include_directories( ${TARGET} PRIVATE ${INCLUDES} )
|
target_include_directories( ${TARGET} PRIVATE ${INCLUDES} )
|
||||||
target_link_options( ${TARGET} PRIVATE ${LDFLAGS} )
|
target_link_options( ${TARGET} PRIVATE ${LDFLAGS} )
|
||||||
target_link_libraries( ${TARGET} ${LIBRARIES} )
|
|
||||||
target_link_libraries( ${TARGET} PUBLIC ${AUDACITY_LIBRARIES} )
|
target_link_libraries( ${TARGET} PUBLIC ${AUDACITY_LIBRARIES} )
|
||||||
|
target_link_libraries( ${TARGET} ${LIBRARIES} )
|
||||||
|
|
||||||
if( CMAKE_VERSION VERSION_GREATER_EQUAL "3.16" AND NOT CCACHE_PROGRAM )
|
if( CMAKE_VERSION VERSION_GREATER_EQUAL "3.16" AND NOT CCACHE_PROGRAM )
|
||||||
if( ${_OPT}use_pch )
|
if( ${_OPT}use_pch )
|
||||||
|
@ -153,6 +153,7 @@ extern "C" {
|
|||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
|
|
||||||
#include "Identifier.h"
|
#include "Identifier.h"
|
||||||
|
#include "SampleFormat.h"
|
||||||
|
|
||||||
class wxDynamicLibrary;
|
class wxDynamicLibrary;
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "audacity/Types.h"
|
|
||||||
#include "Identifier.h"
|
#include "Identifier.h"
|
||||||
|
#include "SampleFormat.h"
|
||||||
|
|
||||||
//#include <mutex>
|
//#include <mutex>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -20,9 +20,11 @@
|
|||||||
#ifndef __AUDACITY_MIX__
|
#ifndef __AUDACITY_MIX__
|
||||||
#define __AUDACITY_MIX__
|
#define __AUDACITY_MIX__
|
||||||
|
|
||||||
|
#include "audacity/Types.h"
|
||||||
#include "SampleFormat.h"
|
#include "SampleFormat.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
class sampleCount;
|
||||||
class Resample;
|
class Resample;
|
||||||
class BoundedEnvelope;
|
class BoundedEnvelope;
|
||||||
class WaveTrackFactory;
|
class WaveTrackFactory;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "RingBuffer.h"
|
#include "RingBuffer.h"
|
||||||
|
#include "Dither.h"
|
||||||
|
|
||||||
RingBuffer::RingBuffer(sampleFormat format, size_t size)
|
RingBuffer::RingBuffer(sampleFormat format, size_t size)
|
||||||
: mFormat{ format }
|
: mFormat{ format }
|
||||||
|
@ -9,7 +9,7 @@ SampleBlock.h
|
|||||||
#ifndef __AUDACITY_SAMPLE_BLOCK__
|
#ifndef __AUDACITY_SAMPLE_BLOCK__
|
||||||
#define __AUDACITY_SAMPLE_BLOCK__
|
#define __AUDACITY_SAMPLE_BLOCK__
|
||||||
|
|
||||||
#include "audacity/Types.h"
|
#include "SampleFormat.h"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "SampleFormat.h"
|
#include "SampleFormat.h"
|
||||||
#include "xml/XMLTagHandler.h"
|
#include "xml/XMLTagHandler.h"
|
||||||
|
|
||||||
#include "Identifier.h"
|
#include "SampleCount.h"
|
||||||
|
|
||||||
class SampleBlock;
|
class SampleBlock;
|
||||||
class SampleBlockFactory;
|
class SampleBlockFactory;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#define M_PI 3.14159265358979323846 /* pi */
|
#define M_PI 3.14159265358979323846 /* pi */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "audacity/Types.h"
|
#include "SampleCount.h"
|
||||||
|
|
||||||
class WaveTrack;
|
class WaveTrack;
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
class BlockArray;
|
class BlockArray;
|
||||||
class Envelope;
|
class Envelope;
|
||||||
class ProgressDialog;
|
class ProgressDialog;
|
||||||
|
class sampleCount;
|
||||||
class SampleBlock;
|
class SampleBlock;
|
||||||
class SampleBlockFactory;
|
class SampleBlockFactory;
|
||||||
using SampleBlockFactoryPtr = std::shared_ptr<SampleBlockFactory>;
|
using SampleBlockFactoryPtr = std::shared_ptr<SampleBlockFactory>;
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#define __AUDACITY_WAVETRACK__
|
#define __AUDACITY_WAVETRACK__
|
||||||
|
|
||||||
#include "Track.h"
|
#include "Track.h"
|
||||||
|
#include "SampleCount.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#define __AUDACITY_DEMO_COMMAND__
|
#define __AUDACITY_DEMO_COMMAND__
|
||||||
|
|
||||||
#include "AudacityCommand.h"
|
#include "AudacityCommand.h"
|
||||||
#include "../SampleFormat.h"
|
#include "SampleFormat.h"
|
||||||
|
|
||||||
class ShuttleGui;
|
class ShuttleGui;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ the pitch without changing the tempo.
|
|||||||
#include "../PitchName.h"
|
#include "../PitchName.h"
|
||||||
#include "../Shuttle.h"
|
#include "../Shuttle.h"
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
#include "../Spectrum.h"
|
#include "Spectrum.h"
|
||||||
#include "../WaveTrack.h"
|
#include "../WaveTrack.h"
|
||||||
#include "../widgets/valnum.h"
|
#include "../widgets/valnum.h"
|
||||||
#include "TimeWarper.h"
|
#include "TimeWarper.h"
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "../LabelTrack.h"
|
#include "../LabelTrack.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
#include "../Resample.h"
|
#include "Resample.h"
|
||||||
#include "../Shuttle.h"
|
#include "../Shuttle.h"
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
#include "../widgets/NumericTextCtrl.h"
|
#include "../widgets/NumericTextCtrl.h"
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#include "../Shuttle.h"
|
#include "../Shuttle.h"
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
#include "../Theme.h"
|
#include "../Theme.h"
|
||||||
#include "../float_cast.h"
|
#include "float_cast.h"
|
||||||
#include "../widgets/Ruler.h"
|
#include "../widgets/Ruler.h"
|
||||||
|
|
||||||
#include "../WaveTrack.h"
|
#include "../WaveTrack.h"
|
||||||
|
@ -9,6 +9,7 @@ Max Maisel
|
|||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
#include "EBUR128.h"
|
#include "EBUR128.h"
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
EBUR128::EBUR128(double rate, size_t channels)
|
EBUR128::EBUR128(double rate, size_t channels)
|
||||||
: mChannelCount(channels)
|
: mChannelCount(channels)
|
||||||
|
@ -27,7 +27,9 @@ class wxWindow;
|
|||||||
|
|
||||||
#include "ConfigInterface.h"
|
#include "ConfigInterface.h"
|
||||||
#include "EffectInterface.h"
|
#include "EffectInterface.h"
|
||||||
|
#include "PluginInterface.h"
|
||||||
|
|
||||||
|
#include "SampleCount.h"
|
||||||
#include "../SelectedRegion.h"
|
#include "../SelectedRegion.h"
|
||||||
|
|
||||||
#include "../Track.h"
|
#include "../Track.h"
|
||||||
|
@ -94,7 +94,7 @@
|
|||||||
#include "../FileNames.h"
|
#include "../FileNames.h"
|
||||||
#include "../Envelope.h"
|
#include "../Envelope.h"
|
||||||
#include "../EnvelopeEditor.h"
|
#include "../EnvelopeEditor.h"
|
||||||
#include "../FFT.h"
|
#include "FFT.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
#include "../Project.h"
|
#include "../Project.h"
|
||||||
#include "../Theme.h"
|
#include "../Theme.h"
|
||||||
@ -106,7 +106,7 @@
|
|||||||
#include "../widgets/AudacityTextEntryDialog.h"
|
#include "../widgets/AudacityTextEntryDialog.h"
|
||||||
#include "../xml/XMLFileReader.h"
|
#include "../xml/XMLFileReader.h"
|
||||||
#include "../AllThemeResources.h"
|
#include "../AllThemeResources.h"
|
||||||
#include "../float_cast.h"
|
#include "float_cast.h"
|
||||||
|
|
||||||
#if wxUSE_ACCESSIBILITY
|
#if wxUSE_ACCESSIBILITY
|
||||||
#include "../widgets/WindowAccessible.h"
|
#include "../widgets/WindowAccessible.h"
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <wx/setup.h> // for wxUSE_* macros
|
#include <wx/setup.h> // for wxUSE_* macros
|
||||||
|
|
||||||
#include "Effect.h"
|
#include "Effect.h"
|
||||||
#include "../RealFFTf.h"
|
#include "RealFFTf.h"
|
||||||
|
|
||||||
// Flags to specialise the UI
|
// Flags to specialise the UI
|
||||||
const int kEqOptionGraphic =1;
|
const int kEqOptionGraphic =1;
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
#include "../widgets/HelpSystem.h"
|
#include "../widgets/HelpSystem.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
#include "../RealFFTf.h"
|
#include "RealFFTf.h"
|
||||||
|
|
||||||
#include "../WaveTrack.h"
|
#include "../WaveTrack.h"
|
||||||
#include "../widgets/AudacityMessageBox.h"
|
#include "../widgets/AudacityMessageBox.h"
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "../Shuttle.h"
|
#include "../Shuttle.h"
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
#include "../FFT.h"
|
#include "FFT.h"
|
||||||
#include "../widgets/valnum.h"
|
#include "../widgets/valnum.h"
|
||||||
#include "../widgets/AudacityMessageBox.h"
|
#include "../widgets/AudacityMessageBox.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
|
@ -28,7 +28,7 @@ the audio, rather than actually finding the clicks.
|
|||||||
|
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
|
|
||||||
#include "../InterpolateAudio.h"
|
#include "InterpolateAudio.h"
|
||||||
#include "../WaveTrack.h"
|
#include "../WaveTrack.h"
|
||||||
#include "../widgets/AudacityMessageBox.h"
|
#include "../widgets/AudacityMessageBox.h"
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "VSTEffect.h"
|
#include "VSTEffect.h"
|
||||||
#include "../../ModuleManager.h"
|
#include "../../ModuleManager.h"
|
||||||
|
#include "SampleCount.h"
|
||||||
|
|
||||||
#include "../../widgets/ProgressDialog.h"
|
#include "../../widgets/ProgressDialog.h"
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include "ModuleInterface.h"
|
#include "ModuleInterface.h"
|
||||||
#include "PluginInterface.h"
|
#include "PluginInterface.h"
|
||||||
|
|
||||||
#include "../../SampleFormat.h"
|
#include "SampleFormat.h"
|
||||||
#include "../../xml/XMLTagHandler.h"
|
#include "../../xml/XMLTagHandler.h"
|
||||||
|
|
||||||
class wxSizerItem;
|
class wxSizerItem;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#if USE_AUDIO_UNITS
|
#if USE_AUDIO_UNITS
|
||||||
#include "AudioUnitEffect.h"
|
#include "AudioUnitEffect.h"
|
||||||
#include "../../ModuleManager.h"
|
#include "../../ModuleManager.h"
|
||||||
|
#include "SampleCount.h"
|
||||||
|
|
||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
#include <wx/base64.h>
|
#include <wx/base64.h>
|
||||||
|
@ -24,6 +24,7 @@ effects from this one class.
|
|||||||
|
|
||||||
|
|
||||||
#include "LadspaEffect.h" // This class's header file
|
#include "LadspaEffect.h" // This class's header file
|
||||||
|
#include "SampleCount.h"
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class NumericTextCtrl;
|
|||||||
#include "PluginInterface.h"
|
#include "PluginInterface.h"
|
||||||
|
|
||||||
#include "ladspa.h"
|
#include "ladspa.h"
|
||||||
#include "../../SampleFormat.h"
|
#include "SampleFormat.h"
|
||||||
|
|
||||||
#define LADSPAEFFECTS_VERSION wxT("1.0.0.0")
|
#define LADSPAEFFECTS_VERSION wxT("1.0.0.0")
|
||||||
/* i18n-hint: abbreviates "Linux Audio Developer's Simple Plugin API"
|
/* i18n-hint: abbreviates "Linux Audio Developer's Simple Plugin API"
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "LV2Effect.h"
|
#include "LV2Effect.h"
|
||||||
|
#include "SampleCount.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class wxArrayString;
|
|||||||
#include <suil/suil.h>
|
#include <suil/suil.h>
|
||||||
|
|
||||||
#include "../../ShuttleGui.h"
|
#include "../../ShuttleGui.h"
|
||||||
#include "../../SampleFormat.h"
|
#include "SampleFormat.h"
|
||||||
|
|
||||||
#include "LoadLV2.h"
|
#include "LoadLV2.h"
|
||||||
#include "NativeWindow.h"
|
#include "NativeWindow.h"
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <wx/filename.h> // member variable
|
#include <wx/filename.h> // member variable
|
||||||
#include "Identifier.h"
|
#include "Identifier.h"
|
||||||
#include "../SampleFormat.h"
|
#include "SampleFormat.h"
|
||||||
#include "../widgets/wxPanelWrapper.h" // to inherit
|
#include "../widgets/wxPanelWrapper.h" // to inherit
|
||||||
#include "../FileNames.h" // for FileTypes
|
#include "../FileNames.h" // for FileTypes
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
#include "../Tags.h"
|
#include "../Tags.h"
|
||||||
#include "../Track.h"
|
#include "../Track.h"
|
||||||
#include "../float_cast.h"
|
#include "float_cast.h"
|
||||||
#include "../widgets/FileHistory.h"
|
#include "../widgets/FileHistory.h"
|
||||||
#include "../widgets/AudacityMessageBox.h"
|
#include "../widgets/AudacityMessageBox.h"
|
||||||
#include "../widgets/ProgressDialog.h"
|
#include "../widgets/ProgressDialog.h"
|
||||||
|
@ -29,7 +29,7 @@ and libvorbis examples, Monty <monty@xiph.org>
|
|||||||
|
|
||||||
#include "FLAC++/encoder.h"
|
#include "FLAC++/encoder.h"
|
||||||
|
|
||||||
#include "../float_cast.h"
|
#include "float_cast.h"
|
||||||
#include "../ProjectSettings.h"
|
#include "../ProjectSettings.h"
|
||||||
#include "../Mix.h"
|
#include "../Mix.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
#include <wx/window.h>
|
#include <wx/window.h>
|
||||||
|
|
||||||
#include "../FileNames.h"
|
#include "../FileNames.h"
|
||||||
#include "../float_cast.h"
|
#include "float_cast.h"
|
||||||
#include "../Mix.h"
|
#include "../Mix.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
#include "../ProjectSettings.h"
|
#include "../ProjectSettings.h"
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "sndfile.h"
|
#include "sndfile.h"
|
||||||
|
|
||||||
|
#include "Dither.h"
|
||||||
#include "../FileFormats.h"
|
#include "../FileFormats.h"
|
||||||
#include "../Mix.h"
|
#include "../Mix.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
|
@ -51,6 +51,7 @@ but little else.
|
|||||||
#include "audacity/Types.h"
|
#include "audacity/Types.h"
|
||||||
#include "Identifier.h"
|
#include "Identifier.h"
|
||||||
#include "Internat.h"
|
#include "Internat.h"
|
||||||
|
#include "SampleFormat.h"
|
||||||
#include "wxArrayStringEx.h"
|
#include "wxArrayStringEx.h"
|
||||||
|
|
||||||
class AudacityProject;
|
class AudacityProject;
|
||||||
|
@ -22,7 +22,7 @@ measurements in subbands or in the entire signal band.
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
|
|
||||||
#include "../FFT.h"
|
#include "FFT.h"
|
||||||
|
|
||||||
SpecPowerCalculation::SpecPowerCalculation(size_t sigLen)
|
SpecPowerCalculation::SpecPowerCalculation(size_t sigLen)
|
||||||
: mSigLen(sigLen)
|
: mSigLen(sigLen)
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#define __AUDACITY_SPECPOWERMETER_H_
|
#define __AUDACITY_SPECPOWERMETER_H_
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include "../SampleFormat.h"
|
#include "SampleFormat.h"
|
||||||
|
|
||||||
class SpecPowerCalculation
|
class SpecPowerCalculation
|
||||||
{
|
{
|
||||||
|
@ -24,9 +24,9 @@
|
|||||||
#include <wx/textctrl.h>
|
#include <wx/textctrl.h>
|
||||||
|
|
||||||
#include "../AudioIOBase.h"
|
#include "../AudioIOBase.h"
|
||||||
#include "../Dither.h"
|
#include "Dither.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
#include "../Resample.h"
|
#include "Resample.h"
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
|
|
||||||
#define ID_SAMPLE_RATE_CHOICE 7001
|
#define ID_SAMPLE_RATE_CHOICE 7001
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <audacity/Types.h>
|
#include <audacity/Types.h>
|
||||||
#include "Prefs.h" // for EnumSetting
|
#include "Prefs.h" // for EnumSetting
|
||||||
|
#include "SampleFormat.h"
|
||||||
|
|
||||||
class IntSetting;
|
class IntSetting;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ Paul Licameli
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "../FFT.h"
|
#include "FFT.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
@ -12,8 +12,8 @@ Paul Licameli
|
|||||||
#define __AUDACITY_SPECTROGRAM_SETTINGS__
|
#define __AUDACITY_SPECTROGRAM_SETTINGS__
|
||||||
|
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
#include "../SampleFormat.h"
|
#include "SampleFormat.h"
|
||||||
#include "../RealFFTf.h"
|
#include "RealFFTf.h"
|
||||||
|
|
||||||
#undef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
#undef SPECTRAL_SELECTION_GLOBAL_SWITCH
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include <wx/checkbox.h>
|
#include <wx/checkbox.h>
|
||||||
#include <wx/textctrl.h>
|
#include <wx/textctrl.h>
|
||||||
|
|
||||||
#include "../FFT.h"
|
#include "FFT.h"
|
||||||
#include "../Project.h"
|
#include "../Project.h"
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
|
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
#include <wx/brush.h> // member variable
|
#include <wx/brush.h> // member variable
|
||||||
|
|
||||||
#include "audacity/Types.h"
|
|
||||||
|
|
||||||
class wxChoice;
|
class wxChoice;
|
||||||
class wxCommandEvent;
|
class wxCommandEvent;
|
||||||
class wxImage;
|
class wxImage;
|
||||||
@ -28,6 +26,7 @@ class AButton;
|
|||||||
class ASlider;
|
class ASlider;
|
||||||
class AudacityProject;
|
class AudacityProject;
|
||||||
class BoundedEnvelope;
|
class BoundedEnvelope;
|
||||||
|
class sampleCount;
|
||||||
class WaveTrack;
|
class WaveTrack;
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_VOICE_DETECTION
|
#ifdef EXPERIMENTAL_VOICE_DETECTION
|
||||||
|
@ -12,7 +12,7 @@ Paul Licameli
|
|||||||
#define __AUDACITY_SAMPLE_HANDLE__
|
#define __AUDACITY_SAMPLE_HANDLE__
|
||||||
|
|
||||||
#include "../../../../UIHandle.h"
|
#include "../../../../UIHandle.h"
|
||||||
#include "audacity/Types.h"
|
#include "SampleCount.h"
|
||||||
|
|
||||||
class wxMouseEvent;
|
class wxMouseEvent;
|
||||||
class wxMouseState;
|
class wxMouseState;
|
||||||
|
@ -13,8 +13,8 @@ Paul Licameli split from class WaveTrack
|
|||||||
|
|
||||||
#include "../../../ui/CommonTrackView.h"
|
#include "../../../ui/CommonTrackView.h"
|
||||||
#include "../../../../ClientData.h"
|
#include "../../../../ClientData.h"
|
||||||
|
#include "SampleCount.h"
|
||||||
namespace WaveTrackViewConstants{ enum Display : int; }
|
namespace WaveTrackViewConstants{ enum Display : int; }
|
||||||
#include "audacity/Types.h"
|
|
||||||
struct WaveTrackSubViewType;
|
struct WaveTrackSubViewType;
|
||||||
|
|
||||||
class CutlineHandle;
|
class CutlineHandle;
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
#include <wx/timer.h> // member variable
|
#include <wx/timer.h> // member variable
|
||||||
|
|
||||||
#include "../SampleFormat.h"
|
#include "SampleFormat.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
#include "MeterPanelBase.h" // to inherit
|
#include "MeterPanelBase.h" // to inherit
|
||||||
#include "Ruler.h" // member variable
|
#include "Ruler.h" // member variable
|
||||||
|
@ -168,7 +168,7 @@ different formats.
|
|||||||
|
|
||||||
#include "NumericTextCtrl.h"
|
#include "NumericTextCtrl.h"
|
||||||
|
|
||||||
#include "audacity/Types.h"
|
#include "SampleCount.h"
|
||||||
#include "../AllThemeResources.h"
|
#include "../AllThemeResources.h"
|
||||||
#include "../AColor.h"
|
#include "../AColor.h"
|
||||||
#include "../KeyboardCapture.h"
|
#include "../KeyboardCapture.h"
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
|
|
||||||
#include "FileNames.h"
|
#include "FileNames.h"
|
||||||
|
#include "SampleFormat.h"
|
||||||
|
|
||||||
// Length check. Is in part about not supplying malicious strings to file functions.
|
// Length check. Is in part about not supplying malicious strings to file functions.
|
||||||
bool XMLValueChecker::IsGoodString(const wxString & str)
|
bool XMLValueChecker::IsGoodString(const wxString & str)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user