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

Commit e834f1d

Browse files
committed
Fixed a bug which caused an overflow, and it was impossible to set the position of the track if it is longer than 70 minutes.
1 parent 940bc62 commit e834f1d

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
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-03T21:09:41. -->
3+
<!-- Written by QtCreator 4.9.2, 2019-08-06T17:39:28. -->
44
<qtcreator>
55
<data>
66
<variable>EnvironmentId</variable>

src/Model/AudioService/audioservice.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,8 @@ void AudioService::setTrackPos(unsigned int graphPos)
423423

424424
if ( (tracks.size() > 0) && (bIsSomeTrackPlaying) )
425425
{
426-
unsigned int posInMS = graphPos * tracks[iCurrentlyPlayingTrackIndex]->getLengthInMS() / MAX_X_AXIS_VALUE;
426+
// static_cast<size_t> because overflow may occur if the track is longer than 70 minutes, for example: graphPos = 800 and track length is 110 minutes.
427+
unsigned int posInMS = static_cast<unsigned int>(static_cast<size_t>(graphPos) * tracks[iCurrentlyPlayingTrackIndex]->getLengthInMS() / MAX_X_AXIS_VALUE);
427428
if ( tracks[iCurrentlyPlayingTrackIndex]->setPositionInMS( posInMS ) )
428429
{
429430
pMainWindow->clearGraph();
@@ -619,6 +620,8 @@ void AudioService::setPan(float fPan)
619620
pMaster->setPan(fPan);
620621
}
621622

623+
pSystem->update();
624+
622625
mtxTracksVec.unlock();
623626
}
624627

@@ -628,6 +631,8 @@ void AudioService::setPitch(float fPitch)
628631
{
629632
pPitch->setParameterFloat(FMOD_DSP_PITCHSHIFT_PITCH, fPitch);
630633
pPitch->setParameterInt(FMOD_DSP_PITCHSHIFT_FFTSIZE, 4096);
634+
635+
pSystem->update();
631636
}
632637
}
633638

@@ -645,6 +650,8 @@ void AudioService::setSpeedByPitch(float fSpeed)
645650
}
646651
}
647652

653+
pSystem->update();
654+
648655
mtxTracksVec.unlock();
649656
}
650657

@@ -668,6 +675,8 @@ void AudioService::setSpeedByTime(float fSpeed)
668675
if (fSpeed != 1.0f) pFaderForTime->setParameterFloat(FMOD_DSP_FADER_GAIN, 3);
669676
else pFaderForTime->setParameterFloat(FMOD_DSP_FADER_GAIN, 0);
670677

678+
pSystem->update();
679+
671680
mtxTracksVec.unlock();
672681
}
673682

@@ -676,6 +685,7 @@ void AudioService::setReverbVolume(float fVolume)
676685
if (pReverb)
677686
{
678687
pReverb->setParameterFloat(FMOD_DSP_SFXREVERB_WETLEVEL, fVolume);
688+
pSystem->update();
679689
}
680690
}
681691

@@ -684,6 +694,7 @@ void AudioService::setEchoVolume(float fEchoVolume)
684694
if (pEcho)
685695
{
686696
pEcho->setParameterFloat(FMOD_DSP_ECHO_WETLEVEL, fEchoVolume);
697+
pSystem->update();
687698
}
688699
}
689700

src/View/MainWindow/mainwindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void MainWindow::on_actionOpen_triggered()
252252

253253
void MainWindow::on_actionAbout_triggered()
254254
{
255-
QMessageBox::information(nullptr, "Bloody Player", "Bloody Player v1.10");
255+
QMessageBox::information(nullptr, "Bloody Player", "Bloody Player v1.10.5");
256256
}
257257

258258
void MainWindow::on_pushButton_Play_clicked()

0 commit comments

Comments
 (0)