1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-05 14:49:25 +02:00

Make the SelectionBar match up better with what is visually selected in the tracks.

Shows up when zoomed in to sample level and looking at Start and Length.
This commit is contained in:
martynshaw99 2010-08-31 22:27:37 +00:00
parent f455fa3f22
commit fb296d0206
2 changed files with 10 additions and 2 deletions

View File

@ -400,7 +400,14 @@ void SelectionBar::ValuesToControls()
if (mRightEndButton->GetValue())
mRightTime->SetTimeValue(mEnd);
else
mRightTime->SetTimeValue(mEnd - mStart);
{ // mRightTime is the length.
// Be sure to take into account the sub-sample offset.
// See TimeToLongSamples and LongSamplesToTime but here at the project rate.
double t = (sampleCount)floor(mEnd * mRate + 0.5);
t -= (sampleCount)floor(mStart * mRate + 0.5);
t /= mRate;
mRightTime->SetTimeValue(t);
}
mAudioTime->SetTimeValue(mAudio);
}

View File

@ -1315,7 +1315,8 @@ void TimeTextCtrl::ValueToControls()
void TimeConverter::ValueToControls( double RawTime )
{
double theValue = RawTime * mScalingFactor + .000001;
RawTime = (double)((sampleCount)floor(RawTime * mSampleRate + 0.5)) / mSampleRate; // put on a sample
double theValue = RawTime * mScalingFactor + .000001; // what's this .000001 for?
int t_int = int(theValue);
double t_frac = (theValue - t_int);
unsigned int i;