Fixed seeking in RageSound at non-1x playback rates
This commit is contained in:
@@ -134,8 +134,9 @@ void NoteField::DrawBeatBar( const float fBeat )
|
|||||||
{
|
{
|
||||||
m_textMeasureNumber.SetDiffuse( RageColor(1,1,1,1) );
|
m_textMeasureNumber.SetDiffuse( RageColor(1,1,1,1) );
|
||||||
m_textMeasureNumber.SetGlow( RageColor(1,1,1,0) );
|
m_textMeasureNumber.SetGlow( RageColor(1,1,1,0) );
|
||||||
|
m_textMeasureNumber.SetHorizAlign( Actor::align_right );
|
||||||
m_textMeasureNumber.SetText( ssprintf("%d", iMeasureNoDisplay) );
|
m_textMeasureNumber.SetText( ssprintf("%d", iMeasureNoDisplay) );
|
||||||
m_textMeasureNumber.SetXY( -fWidth/2.f + 10, fYPos );
|
m_textMeasureNumber.SetXY( -fWidth/2, fYPos );
|
||||||
m_textMeasureNumber.Draw();
|
m_textMeasureNumber.Draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -726,7 +726,13 @@ bool RageSound::SetPositionSamples( int samples )
|
|||||||
if( samples < 0 )
|
if( samples < 0 )
|
||||||
samples = 0;
|
samples = 0;
|
||||||
|
|
||||||
int ms = int(float(samples) * 1000.f / samplerate);
|
/* RageSoundReader don't know about out playback rate and our notion of
|
||||||
|
* "logical samples" that are scaled by the playback rate.
|
||||||
|
* So, we have to request the position NOT scaled by the playback rate.
|
||||||
|
* To do this, we'll undo the muliply by the playback rate above.
|
||||||
|
* Glenn: Feel free to change this to whatever method is more elegant.
|
||||||
|
* -Chris */
|
||||||
|
int ms = int(float(samples) * 1000.f / samplerate) * GetPlaybackRate();
|
||||||
|
|
||||||
if(!big) {
|
if(!big) {
|
||||||
/* Just make sure the position is in range. */
|
/* Just make sure the position is in range. */
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ void ScreenEdit::Update( float fDeltaTime )
|
|||||||
|
|
||||||
if( m_EditMode == MODE_RECORDING || m_EditMode == MODE_PLAYING )
|
if( m_EditMode == MODE_RECORDING || m_EditMode == MODE_PLAYING )
|
||||||
{
|
{
|
||||||
// GAMESTATE->m_fSongBeat = fSongBeat;
|
// check for end of playback/record
|
||||||
|
|
||||||
if( GAMESTATE->m_fSongBeat > m_NoteFieldEdit.m_fEndMarker + 4 ) // give a one measure lead out
|
if( GAMESTATE->m_fSongBeat > m_NoteFieldEdit.m_fEndMarker + 4 ) // give a one measure lead out
|
||||||
{
|
{
|
||||||
@@ -457,15 +457,14 @@ void ScreenEdit::Update( float fDeltaTime )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Only update stats every 100 frames because it's slow
|
static float fUpdateCounter = 0.5;
|
||||||
static int iNumTapNotes = 0, iNumHoldNotes = 0;
|
fUpdateCounter -= fDeltaTime;
|
||||||
static int iCounter = 0;
|
if( fUpdateCounter < 0 )
|
||||||
iCounter++;
|
|
||||||
if( iCounter % 100 == 0 )
|
|
||||||
{
|
{
|
||||||
iNumTapNotes = m_NoteFieldEdit.GetNumTapNotes();
|
fUpdateCounter = 0.5;
|
||||||
iNumHoldNotes = m_NoteFieldEdit.GetNumHoldNotes();
|
|
||||||
}
|
int iNumTapNotes = m_NoteFieldEdit.GetNumTapNotes();
|
||||||
|
int iNumHoldNotes = m_NoteFieldEdit.GetNumHoldNotes();
|
||||||
|
|
||||||
CString sText;
|
CString sText;
|
||||||
sText += ssprintf( "Current Beat:\n %.2f\n", GAMESTATE->m_fSongBeat );
|
sText += ssprintf( "Current Beat:\n %.2f\n", GAMESTATE->m_fSongBeat );
|
||||||
@@ -483,6 +482,7 @@ void ScreenEdit::Update( float fDeltaTime )
|
|||||||
|
|
||||||
m_textInfo.SetText( sText );
|
m_textInfo.SetText( sText );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ScreenEdit::DrawPrimitives()
|
void ScreenEdit::DrawPrimitives()
|
||||||
@@ -1324,7 +1324,6 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
|
|||||||
LOG->Trace( "Starting playback at %f", fStartSeconds );
|
LOG->Trace( "Starting playback at %f", fStartSeconds );
|
||||||
m_soundMusic.SetPlaybackRate( GAMESTATE->m_SongOptions.m_fMusicRate );
|
m_soundMusic.SetPlaybackRate( GAMESTATE->m_SongOptions.m_fMusicRate );
|
||||||
m_soundMusic.SetPositionSeconds( fStartSeconds );
|
m_soundMusic.SetPositionSeconds( fStartSeconds );
|
||||||
m_soundMusic.StartPlaying();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case record:
|
case record:
|
||||||
|
|||||||
Reference in New Issue
Block a user