25#ifndef __AUDACITY_SELECTEDREGION__
26#define __AUDACITY_SELECTEDREGION__
29#include <wx/chartype.h>
44 static const int UndefinedFrequency = -1;
49#ifdef EXPERIMENTAL_SPECTRAL_EDITING
50 , mF0(UndefinedFrequency)
51 , mF1(UndefinedFrequency)
58#ifdef EXPERIMENTAL_SPECTRAL_EDITING
59 , mF0(UndefinedFrequency)
60 , mF1(UndefinedFrequency)
73#ifdef EXPERIMENTAL_SPECTRAL_EDITING
84#ifdef EXPERIMENTAL_SPECTRAL_EDITING
94 double t0()
const {
return mT0; }
95 double t1()
const {
return mT1; }
97 bool isPoint()
const {
return mT1 <= mT0; }
99#ifdef EXPERIMENTAL_SPECTRAL_EDITING
100 double f0()
const {
return mF0; }
101 double f1()
const {
return mF1; }
103 if (mF0 == UndefinedFrequency ||
104 mF1 == UndefinedFrequency)
105 return UndefinedFrequency;
107 return sqrt(mF0 * mF1);
115 bool setT0(
double t,
bool maySwap =
true) {
118 return ensureOrdering();
127 bool setT1(
double t,
bool maySwap =
true) {
130 return ensureOrdering();
142 return ensureOrdering();
146 bool moveT0(
double delta,
bool maySwap =
true) {
147 return setT0(mT0 + delta, maySwap);
151 bool moveT1(
double delta,
bool maySwap =
true) {
152 return setT1(mT1 + delta, maySwap);
164#ifdef EXPERIMENTAL_SPECTRAL_EDITING
166 bool setF0(
double f,
bool maySwap =
true) {
168 f = UndefinedFrequency;
171 return ensureFrequencyOrdering();
173 if (mF1 >= 0 && mF1 < mF0)
180 bool setF1(
double f,
bool maySwap =
true) {
182 f = UndefinedFrequency;
185 return ensureFrequencyOrdering();
187 if (mF0 >= 0 && mF1 < mF0)
194 bool setFrequencies(
double f0,
double f1)
198 return ensureFrequencyOrdering();
214 void WriteXMLAttributes
216 const char *legacyT0Name = sDefaultT0Name,
217 const char *legacyT1Name = sDefaultT1Name)
const;
221 bool HandleXMLAttribute
223 const char *legacyT0Name = sDefaultT0Name,
224 const char* legacyT1Name = sDefaultT1Name);
233 const char *legacyT0Name,
const char* legacyT1Name);
238 const double t = mT1;
249#ifdef EXPERIMENTAL_SPECTRAL_EDITING
250 bool ensureFrequencyOrdering()
253 mF1 = UndefinedFrequency;
255 mF0 = UndefinedFrequency;
257 if (mF0 != UndefinedFrequency &&
258 mF1 != UndefinedFrequency &&
260 const double t = mF1;
270 friend inline bool operator ==
275 && lhs.
mT1 == rhs.mT1
276#ifdef EXPERIMENTAL_SPECTRAL_EDITING
277 && lhs.mF0 == rhs.mF0
278 && lhs.mF1 == rhs.mF1
285#ifdef EXPERIMENTAL_SPECTRAL_EDITING
294 return !(lhs == rhs);
bool operator!=(const SelectedRegion &lhs, const SelectedRegion &rhs)
Defines a selected portion of a project.
SelectedRegion & operator=(const SelectedRegion &x)
bool moveT0(double delta, bool maySwap=true)
bool setTimes(double t0, double t1)
SelectedRegion(double t0, double t1)
SelectedRegion(const SelectedRegion &x)
static const char * sDefaultT1Name
static const char * sDefaultT0Name
bool moveT1(double delta, bool maySwap=true)
bool setT0(double t, bool maySwap=true)
bool setT1(double t, bool maySwap=true)
A view into an attribute value. The class does not take the ownership of the data.
std::vector< std::pair< std::string, Mutator< Substructure > > > Mutators
A helper type alias for a list of mutators, associated with tag strings.
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
__finl float_x4 __vecc sqrt(const float_x4 &a)