55 WARNINGLOG( QString(
"Provided bpm %1 is too low. Assigning lower bound %2 instead" )
59 WARNINGLOG( QString(
"Provided bpm %1 is too high. Assigning upper bound %2 instead" )
64 ERRORLOG( QString(
"There is already a tempo marker present in column %1. Please remove it first." )
69 std::shared_ptr<TempoMarker> pTempoMarker = std::make_shared<TempoMarker>();
70 pTempoMarker->nColumn = nColumn;
71 pTempoMarker->fBpm = fBpm;
100 if ( nColumn == -1 ) {
106 for (
int ii = 0; ii < static_cast<int>(
m_tempoMarkers.size()); ii++) {
126 if ( tt->nColumn == nColumn ) {
136 std::shared_ptr<TempoMarker> pTempoMarker = std::make_shared<TempoMarker>();
137 pTempoMarker->nColumn = 0;
143 if ( tt->nColumn == nColumn ) {
153 std::shared_ptr<TempoMarker> pTempoMarker = std::make_shared<TempoMarker>();
154 pTempoMarker->nColumn = 0;
158 std::vector<std::shared_ptr<const TempoMarker>> tmpVector;
159 tmpVector.resize( nNumberOfTempoMarkers + 1 );
160 tmpVector[ 0 ] = pTempoMarker;
162 if ( nNumberOfTempoMarkers != 0 ) {
163 for (
int ii = 0; ii < nNumberOfTempoMarkers; ++ii ) {
183 ERRORLOG( QString(
"There is already a tag present in column %1. Please remove it first." )
188 std::shared_ptr<Tag> pTag(
new Tag );
189 pTag->nColumn = nColumn;
192 m_tags.push_back( std::move( pTag ) );
199 if (
m_tags.size() >= 1 ){
200 for (
int t = 0; t <
m_tags.size(); t++ ){
201 if (
m_tags[t]->nColumn == nColumn ) {
212 QString sCurrentTag(
"");
214 for (
int t = 0; t < static_cast<int>(
m_tags.size()); t++ ){
215 if (
m_tags[t]->nColumn > nColumn ){
218 sCurrentTag =
m_tags[t]->sTag;
225 for (
const auto& tt :
m_tags ){
226 if ( tt->nColumn == nColumn ) {
243 sOutput = QString(
"%1[Timeline]\n" ).arg( sPrefix )
244 .append( QString(
"%1%2m_fDefaultBpm: %3\n" ).arg( sPrefix ).arg( s ).arg(
m_fDefaultBpm ) )
245 .append( QString(
"%1%2m_tempoMarkers:\n" ).arg( sPrefix ).arg( s ) );
247 if ( tt !=
nullptr ) {
248 sOutput.append( QString(
"%1[column: %2 , bpm: %3]\n" ).arg( sPrefix + s + s ).arg( tt->nColumn ).arg( tt->fBpm ) );
251 sOutput.append( QString(
"%1%2m_tags:\n" ).arg( sPrefix ).arg( s ) );
252 for (
auto const& tt :
m_tags ) {
253 if ( tt !=
nullptr ) {
254 sOutput.append( QString(
"%1[column: %2 , tag: %3]\n" ).arg( sPrefix + s + s ).arg( tt->nColumn ).arg( tt->sTag ) );
259 sOutput = QString(
"%1[Timeline] " ).arg( sPrefix )
260 .append( QString(
"m_fDefaultBpm: %1, " ).arg(
m_fDefaultBpm ) )
261 .append( QString(
"m_tempoMarkers: [" ) );
263 if ( tt !=
nullptr ) {
264 sOutput.append( QString(
" [column: %1 , bpm: %2]" ).arg( tt->nColumn ).arg( tt->fBpm ) );
267 sOutput.append( QString(
"], m_tags: [" ) );
268 for (
auto const& tt :
m_tags ) {
269 if ( tt !=
nullptr ) {
270 sOutput.append( QString(
" [column: %1 , tag: %2]" ).arg( tt->nColumn ).arg( tt->sTag ) );
273 sOutput.append(
" ]");
282 if ( nDecimals >= 0 ) {
283 nPrec = std::min( nDecimals + (
fBpm >= 100 ? 3 : 2 ),
286 QString sOut = QString::number(
fBpm,
'g', nPrec );
288 return std::move( sOut );
295 sOutput = QString(
"%1[TempoMarker]\n" ).arg( sPrefix )
296 .append( QString(
"%1%2nColumn: %3\n" ).arg( sPrefix ).arg( s ).arg(
nColumn ) )
297 .append( QString(
"%1%2fBpm: %3\n" ).arg( sPrefix ).arg( s ).arg(
fBpm ) );
300 sOutput = QString(
"%1[TempoMarker] " ).arg( sPrefix )
301 .append( QString(
"nColumn: %3, " ).arg(
nColumn ) )
302 .append( QString(
"fBpm: %3" ).arg(
fBpm ) );
312 sOutput = QString(
"%1[TempoMarker]\n" ).arg( sPrefix )
313 .append( QString(
"%1%2nColumn: %3\n" ).arg( sPrefix ).arg( s ).arg(
nColumn ) )
314 .append( QString(
"%1%2sTag: %3\n" ).arg( sPrefix ).arg( s ).arg(
sTag ) );
317 sOutput = QString(
"%1[TempoMarker] " ).arg( sPrefix )
318 .append( QString(
"nColumn: %3, " ).arg(
nColumn ) )
319 .append( QString(
"sTag: %3" ).arg(
sTag ) );
static QString sPrintIndention
String used to format the debugging string output of some core classes.
std::shared_ptr< Song > getSong() const
Get the current song.
static Hydrogen * get_instance()
Returns the current Hydrogen instance __instance.
void deleteTag(int nColumn)
void setDefaultBpm(float fDefaultBpm)
void deleteTempoMarker(int nColumn)
Delete all tempo markers except for the first one and mark the tempo of the Timeline m_bUnset.
bool hasColumnTempoMarker(int nColumn) const
bool isFirstTempoMarkerSpecial() const
Whether there is a TempoMarker introduced by the user at the first column.
float getTempoAtColumn(int nColumn) const
Returns the tempo of the Song at a given column.
bool hasColumnTag(int nColumn) const
void addTag(int nColumn, QString sTag)
Adds a Tag to the Timeline.
std::shared_ptr< const Timeline::TempoMarker > getTempoMarkerAtColumn(int nColumn) const
void activate()
Registers the current playback tempo to m_fDefaultBpm.
void deactivate()
Convencience function in order to create a symmetric pair with activate.
std::vector< std::shared_ptr< const TempoMarker > > m_tempoMarkers
std::vector< std::shared_ptr< const Tag > > m_tags
const std::vector< std::shared_ptr< const TempoMarker > > getAllTempoMarkers() const
const QString getTagAtColumn(int nColumn) const
Returns the tag of the Song at a given column.
void addTempoMarker(int nColumn, float fBpm)
Adds a TempoMarker to the Timeline.
QString toQString(const QString &sPrefix="", bool bShort=true) const override
Formatted string version for debugging purposes.
float m_fDefaultBpm
Tempo used for the special tempo marker.
Tag specifies a note added to a certain position in the Song.
QString toQString(const QString &sPrefix="", bool bShort=true) const
QString toQString(const QString &sPrefix="", bool bShort=true) const
QString getPrettyString(int nDecimals=2) const