loop playback and record

This commit is contained in:
Chris Danford
2006-04-04 21:58:20 +00:00
parent fd5fc24083
commit d3bbde5f05
+30 -24
View File
@@ -920,8 +920,12 @@ void ScreenEdit::Update( float fDeltaTime )
fLastBeat = m_pSong->m_Timing.GetBeatFromElapsedTime( fSeconds + 0.5f ); fLastBeat = m_pSong->m_Timing.GetBeatFromElapsedTime( fSeconds + 0.5f );
} }
if( GAMESTATE->m_fSongBeat > fLastBeat ) float fStopAtSeconds = m_pSong->m_Timing.GetElapsedTimeFromBeat( NoteRowToBeat(m_iStopPlayingAt) ) + 1;
TransitionEditState( STATE_EDITING ); if( GAMESTATE->m_fMusicSeconds > fStopAtSeconds )
{
// loop
TransitionEditState( STATE_PLAYING );
}
} }
@@ -1831,7 +1835,6 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
case EDIT_BUTTON_RECORD_FROM_CURSOR: case EDIT_BUTTON_RECORD_FROM_CURSOR:
m_iStartPlayingAt = BeatToNoteRow(GAMESTATE->m_fSongBeat); m_iStartPlayingAt = BeatToNoteRow(GAMESTATE->m_fSongBeat);
m_iStopPlayingAt = m_NoteDataEdit.GetLastRow(); m_iStopPlayingAt = m_NoteDataEdit.GetLastRow();
m_iStopPlayingAt += BeatToNoteRow(4); // give a one measure lead out
TransitionEditState( STATE_RECORDING ); TransitionEditState( STATE_RECORDING );
break; break;
@@ -2039,6 +2042,8 @@ void ScreenEdit::TransitionEditState( EditState em )
if( old == STATE_RECORDING_PAUSED && em == STATE_PLAYING ) if( old == STATE_RECORDING_PAUSED && em == STATE_PLAYING )
m_bReturnToRecordMenuAfterPlay = true; m_bReturnToRecordMenuAfterPlay = true;
const bool bStateChanging = em != old;
#if 0 #if 0
// //
// If switching out of record, open the menu. // If switching out of record, open the menu.
@@ -2062,28 +2067,31 @@ void ScreenEdit::TransitionEditState( EditState em )
m_soundAssistTick.StopPlaying(); m_soundAssistTick.StopPlaying();
GAMESTATE->m_bGameplayLeadIn.Set( true ); GAMESTATE->m_bGameplayLeadIn.Set( true );
switch( old ) if( bStateChanging )
{ {
case STATE_EDITING: switch( old )
// If exiting EDIT mode, save the cursor position. {
m_fBeatToReturnTo = GAMESTATE->m_fSongBeat; case STATE_EDITING:
break; // If exiting EDIT mode, save the cursor position.
m_fBeatToReturnTo = GAMESTATE->m_fSongBeat;
break;
case STATE_PLAYING: case STATE_PLAYING:
if( AdjustSync::IsSyncDataChanged() ) if( AdjustSync::IsSyncDataChanged() )
ScreenSaveSync::PromptSaveSync(); ScreenSaveSync::PromptSaveSync();
break; break;
case STATE_RECORDING: case STATE_RECORDING:
SaveUndo(); SaveUndo();
// delete old TapNotes in the range // delete old TapNotes in the range
m_NoteDataEdit.ClearRange( m_iStartPlayingAt, m_iStopPlayingAt ); m_NoteDataEdit.ClearRange( m_iStartPlayingAt, m_iStopPlayingAt );
m_NoteDataEdit.CopyRange( m_NoteDataRecord, m_iStartPlayingAt, m_iStopPlayingAt, m_iStartPlayingAt ); m_NoteDataEdit.CopyRange( m_NoteDataRecord, m_iStartPlayingAt, m_iStopPlayingAt, m_iStartPlayingAt );
m_NoteDataRecord.ClearAll(); m_NoteDataRecord.ClearAll();
CheckNumberOfNotesAndUndo(); CheckNumberOfNotesAndUndo();
break; break;
}
} }
// //
@@ -2131,7 +2139,8 @@ void ScreenEdit::TransitionEditState( EditState em )
case STATE_PLAYING: case STATE_PLAYING:
case STATE_RECORDING: case STATE_RECORDING:
{ {
AdjustSync::ResetOriginalSyncData(); if( bStateChanging )
AdjustSync::ResetOriginalSyncData();
/* Give a 1 second lead-in. If we're loading Player, this must be done first. */ /* Give a 1 second lead-in. If we're loading Player, this must be done first. */
float fSeconds = m_pSong->m_Timing.GetElapsedTimeFromBeat( NoteRowToBeat(m_iStartPlayingAt) ) - 1; float fSeconds = m_pSong->m_Timing.GetElapsedTimeFromBeat( NoteRowToBeat(m_iStartPlayingAt) ) - 1;
@@ -2642,7 +2651,6 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
{ {
m_iStartPlayingAt = 0; m_iStartPlayingAt = 0;
m_iStopPlayingAt = m_NoteDataEdit.GetLastRow(); m_iStopPlayingAt = m_NoteDataEdit.GetLastRow();
m_iStopPlayingAt += BeatToNoteRow(4); // give a one measure lead out
TransitionEditState( STATE_PLAYING ); TransitionEditState( STATE_PLAYING );
} }
break; break;
@@ -2650,7 +2658,6 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
{ {
m_iStartPlayingAt = m_NoteFieldEdit.m_iBeginMarker; m_iStartPlayingAt = m_NoteFieldEdit.m_iBeginMarker;
m_iStopPlayingAt = m_NoteDataEdit.GetLastRow(); m_iStopPlayingAt = m_NoteDataEdit.GetLastRow();
m_iStopPlayingAt += BeatToNoteRow(4); // give a one measure lead out
TransitionEditState( STATE_PLAYING ); TransitionEditState( STATE_PLAYING );
} }
break; break;
@@ -2658,7 +2665,6 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
{ {
m_iStartPlayingAt = BeatToNoteRow(GAMESTATE->m_fSongBeat); m_iStartPlayingAt = BeatToNoteRow(GAMESTATE->m_fSongBeat);
m_iStopPlayingAt = m_NoteDataEdit.GetLastRow(); m_iStopPlayingAt = m_NoteDataEdit.GetLastRow();
m_iStopPlayingAt += BeatToNoteRow(4); // give a one measure lead out
TransitionEditState( STATE_PLAYING ); TransitionEditState( STATE_PLAYING );
} }
break; break;