25#ifndef __AUDACITY_SELECTEDREGION__
26#define __AUDACITY_SELECTEDREGION__
29#include <wx/chartype.h>
44 static const int UndefinedFrequency = -1;
49 , mF0(UndefinedFrequency)
50 , mF1(UndefinedFrequency)
56 , mF0(UndefinedFrequency)
57 , mF1(UndefinedFrequency)
86 double t0()
const {
return mT0; }
87 double t1()
const {
return mT1; }
89 bool isPoint()
const {
return mT1 <= mT0; }
91 double f0()
const {
return mF0; }
92 double f1()
const {
return mF1; }
94 if (mF0 == UndefinedFrequency ||
95 mF1 == UndefinedFrequency)
96 return UndefinedFrequency;
98 return sqrt(mF0 * mF1);
105 bool setT0(
double t,
bool maySwap =
true) {
108 return ensureOrdering();
117 bool setT1(
double t,
bool maySwap =
true) {
120 return ensureOrdering();
132 return ensureOrdering();
136 bool moveT0(
double delta,
bool maySwap =
true) {
137 return setT0(mT0 + delta, maySwap);
141 bool moveT1(
double delta,
bool maySwap =
true) {
142 return setT1(mT1 + delta, maySwap);
155 bool setF0(
double f,
bool maySwap =
true) {
157 f = UndefinedFrequency;
160 return ensureFrequencyOrdering();
162 if (mF1 >= 0 && mF1 < mF0)
169 bool setF1(
double f,
bool maySwap =
true) {
171 f = UndefinedFrequency;
174 return ensureFrequencyOrdering();
176 if (mF0 >= 0 && mF1 < mF0)
187 return ensureFrequencyOrdering();
202 void WriteXMLAttributes
204 const char *legacyT0Name = sDefaultT0Name,
205 const char *legacyT1Name = sDefaultT1Name)
const;
209 bool HandleXMLAttribute
211 const char *legacyT0Name = sDefaultT0Name,
212 const char* legacyT1Name = sDefaultT1Name);
221 const char *legacyT0Name,
const char* legacyT1Name);
226 const double t = mT1;
240 mF1 = UndefinedFrequency;
242 mF0 = UndefinedFrequency;
244 if (mF0 != UndefinedFrequency &&
245 mF1 != UndefinedFrequency &&
247 const double t = mF1;
256 friend inline bool operator ==
261 && lhs.
mT1 == rhs.mT1
262 && lhs.
mF0 == rhs.mF0
263 && lhs.
mF1 == rhs.mF1
275 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)
bool setF0(double f, bool maySwap=true)
bool setF1(double f, bool maySwap=true)
static const char * sDefaultT1Name
static const char * sDefaultT0Name
bool moveT1(double delta, bool maySwap=true)
bool setFrequencies(double f0, double f1)
bool setT0(double t, bool maySwap=true)
bool setT1(double t, bool maySwap=true)
bool ensureFrequencyOrdering()
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)