| 1 |
/* |
| 2 |
* Audacity: A Digital Audio Editor |
| 3 |
*/ |
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include "timecodeformatter.h" |
| 7 |
|
| 8 |
namespace au::playback { |
| 9 |
class BeatsFormatter : public TimecodeFormatter |
| 10 |
{ |
| 11 |
public: |
| 12 |
BeatsFormatter(const QString& formatStr, int fracPart); |
| 13 |
|
| 14 |
void init() override; |
| 15 |
|
| 16 |
ConversionResult valueToString(double value, bool nearest) const override; |
| 17 |
|
| 18 |
std::optional<double> stringToValue(const QString& value) const override; |
| 19 |
|
| 20 |
double singleStep(double value, int digitIndex, bool upwards) override; |
| 21 |
|
| 22 |
private: |
| 23 |
void updateResultString(ConversionResult& result) const; |
| 24 |
|
| 25 |
bool checkField(size_t fieldIndex, int value) const; |
| 26 |
bool checkFracField(int newLts) const; |
| 27 |
void updateFields(size_t barsDigits); |
| 28 |
|
| 29 |
std::array<double, 3> m_fieldLengths; |
| 30 |
int m_fieldValueOffset = 1; |
| 31 |
int m_fracPart = 0; |
| 32 |
}; |
| 33 |
} |