Skip to content

Commit 18c2f26

Browse files
committed
Use playhead sample pos instead of current buffered sample pos
1 parent f2e9d9f commit 18c2f26

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

Source/Processors/FileReader/FileReader.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,11 @@ void FileReader::setPlaybackStop (int64 stopSample)
464464
this->stopSample = stopSample;
465465
}
466466

467+
int64 FileReader::getPlayheadPosition()
468+
{
469+
return playbackSamplePos.get();
470+
}
471+
467472
String FileReader::getFile() const
468473
{
469474
if (input)

Source/Processors/FileReader/FileReader.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ class FileReader : public GenericProcessor,
152152
/** Sets the sample number to stop playback */
153153
void setPlaybackStop (int64 stopSampleNumber);
154154

155+
/** Gets the current playhead position */
156+
int64 getPlayheadPosition();
157+
155158
/** Returns the sample number where playback stops */
156159
int64 getPlaybackStop();
157160

Source/Processors/FileReader/ScrubberInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ void ScrubberInterface::updateTimeLabels()
476476

477477
// Get current playhead time from currentSample
478478
float sampleRate = fileReader->getCurrentSampleRate();
479-
int64 currentSample = fileReader->getCurrentSample();
479+
int64 currentSample = fileReader->getPlayheadPosition();
480480
float currentTime = currentSample / sampleRate * 1000.0f;
481481
TimeParameter::TimeValue currentTimeValue = TimeParameter::TimeValue (currentTime);
482482
fullMiddleTimeLabel->setText (currentTimeValue.toString(), juce::sendNotificationAsync);

0 commit comments

Comments
 (0)