Skip to content
This repository was archived by the owner on May 11, 2022. It is now read-only.

Commit 050ebd0

Browse files
committed
Fixed an error in calculations due to which setting position of the current track wasn't quite accurate to cursor position.
1 parent b04d480 commit 050ebd0

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

ide/BloodyPlayer.pro.user

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE QtCreatorProject>
3-
<!-- Written by QtCreator 4.9.2, 2019-08-30T12:23:04. -->
3+
<!-- Written by QtCreator 4.9.2, 2019-08-30T20:33:02. -->
44
<qtcreator>
55
<data>
66
<variable>EnvironmentId</variable>

src/Model/AudioService/audioservice.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,7 @@ void AudioService::setTrackPos(unsigned int graphPos)
460460
// graphPos - x%
461461

462462
// cast to unsigned long long to avoid overflow
463-
unsigned int iPosInPercent = static_cast<unsigned int>(static_cast<unsigned long long>(graphPos) * 100 / static_cast<double>(tracks[iCurrentlyPlayingTrackIndex]->getMaxValueOnGraph()));
464-
double fPosMult = iPosInPercent / 100.0;
463+
double fPosMult = graphPos / static_cast<double>(tracks[iCurrentlyPlayingTrackIndex]->getMaxValueOnGraph());
465464
unsigned int iPosInMS = static_cast<unsigned int>(tracks[iCurrentlyPlayingTrackIndex]->getLengthInMS() * fPosMult);
466465
if ( tracks[iCurrentlyPlayingTrackIndex]->setPositionInMS(iPosInMS) )
467466
{
@@ -1177,8 +1176,8 @@ void AudioService::drawGraph(size_t* iTrackIndex)
11771176
// 3000 ('iSamplesInOne') - 6000 (sec.)
11781177
// x ('iSamplesInOne') - track length (in sec.)
11791178

1180-
// here we do: 3000 * (tracks[iTrackIndex]->getLengthInMS() / 1000) / 6000, but we can replace this with just:
11811179
mtxGetCurrentDrawingIndex.lock();
1180+
// here we do: 3000 * (tracks[iTrackIndex]->getLengthInMS() / 1000) / 6000, but we can replace this with just:
11821181
iSamplesInOne = tracks[*iTrackIndex]->getLengthInMS() * 3 / 6000;
11831182
if (iSamplesInOne == 0) iSamplesInOne = 1;
11841183

0 commit comments

Comments
 (0)