Skip to content

Commit

Permalink
BeatMap: Allow searching using fractional positions
Browse files Browse the repository at this point in the history
Beat searches using fractional positions should be allowed, only saving
fractional positions should cause a debug assertion. This should fix the
issue reported here:
https://bugs.launchpad.net/mixxx/+bug/1935703/comments/6
  • Loading branch information
Holzhaus committed Jul 10, 2021
1 parent 2253c78 commit 015ad88
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/track/beatmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ audio::FramePos BeatMap::findNthBeat(audio::FramePos position, int n) const {
return audio::kInvalidFramePos;
}

Beat beat = beatFromFramePos(position);
Beat beat = beatFromFramePos(position.toNearestFrameBoundary());

// it points at the first occurrence of beat or the next largest beat
BeatList::const_iterator it =
Expand Down Expand Up @@ -401,7 +401,7 @@ bool BeatMap::findPrevNextBeats(audio::FramePos position,
return false;
}

Beat beat = beatFromFramePos(position);
Beat beat = beatFromFramePos(position.toNearestFrameBoundary());

// it points at the first occurrence of beat or the next largest beat
BeatList::const_iterator it =
Expand Down Expand Up @@ -481,8 +481,8 @@ std::unique_ptr<BeatIterator> BeatMap::findBeats(
return std::unique_ptr<BeatIterator>();
}

Beat startBeat = beatFromFramePos(startPosition);
Beat endBeat = beatFromFramePos(endPosition);
Beat startBeat = beatFromFramePos(startPosition.toUpperFrameBoundary());
Beat endBeat = beatFromFramePos(endPosition.toLowerFrameBoundary());

BeatList::const_iterator curBeat =
std::lower_bound(m_beats.constBegin(), m_beats.constEnd(),
Expand Down

0 comments on commit 015ad88

Please sign in to comment.