Replaced all calls to clock() in Qt TAS editor. Clock was giving inconsistent time stamps since it actually returns CPU use time, not actual time. Instead use SDL_GetTicks() to get actual time in milliseconds.
This commit is contained in:
parent
ed29139b87
commit
94eab8f8ef
|
@ -99,6 +99,7 @@ enum DRAG_MODES
|
||||||
static char pianoRollSaveID[PIANO_ROLL_ID_LEN] = "PIANO_ROLL";
|
static char pianoRollSaveID[PIANO_ROLL_ID_LEN] = "PIANO_ROLL";
|
||||||
static char pianoRollSkipSaveID[PIANO_ROLL_ID_LEN] = "PIANO_ROLX";
|
static char pianoRollSkipSaveID[PIANO_ROLL_ID_LEN] = "PIANO_ROLX";
|
||||||
static TasFindNoteWindow *findWin = NULL;
|
static TasFindNoteWindow *findWin = NULL;
|
||||||
|
static uint64_t tasEditorTimeStamp = 0;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
//---- Main TAS Editor Window
|
//---- Main TAS Editor Window
|
||||||
|
@ -131,6 +132,11 @@ bool isTaseditorRecording(void)
|
||||||
return true; // record
|
return true; // record
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t getTasEditorTime(void)
|
||||||
|
{
|
||||||
|
return tasEditorTimeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
void recordInputByTaseditor(void)
|
void recordInputByTaseditor(void)
|
||||||
{
|
{
|
||||||
if ( recorder )
|
if ( recorder )
|
||||||
|
@ -1443,6 +1449,11 @@ QPoint TasEditorWindow::getPreviewPopupCoordinates(void)
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
int TasEditorWindow::initModules(void)
|
int TasEditorWindow::initModules(void)
|
||||||
{
|
{
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 18)
|
||||||
|
tasEditorTimeStamp = SDL_GetTicks64();
|
||||||
|
#else
|
||||||
|
tasEditorTimeStamp = SDL_GetTicks();
|
||||||
|
#endif
|
||||||
// init modules
|
// init modules
|
||||||
//editor.init();
|
//editor.init();
|
||||||
//pianoRoll.init();
|
//pianoRoll.init();
|
||||||
|
@ -1505,7 +1516,13 @@ void TasEditorWindow::frameUpdate(void)
|
||||||
{
|
{
|
||||||
FCEU_WRAPPER_LOCK();
|
FCEU_WRAPPER_LOCK();
|
||||||
|
|
||||||
//printf("TAS Frame Update: %zi\n", currMovieData.records.size());
|
#if SDL_VERSION_ATLEAST(2, 0, 18)
|
||||||
|
tasEditorTimeStamp = SDL_GetTicks64();
|
||||||
|
#else
|
||||||
|
tasEditorTimeStamp = SDL_GetTicks();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//printf("TAS Frame Update: %zi %u\n", currMovieData.records.size(), tasEditorTimeStamp);
|
||||||
|
|
||||||
//taseditorWindow.update();
|
//taseditorWindow.update();
|
||||||
greenzone.update();
|
greenzone.update();
|
||||||
|
@ -4634,7 +4651,7 @@ void QPianoRoll::mouseDoubleClickEvent(QMouseEvent * event)
|
||||||
// clicked on Input
|
// clicked on Input
|
||||||
if (headerClicked)
|
if (headerClicked)
|
||||||
{
|
{
|
||||||
drawingStartTimestamp = clock();
|
drawingStartTimestamp = getTasEditorTime();
|
||||||
int joy = (column_index - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS;
|
int joy = (column_index - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS;
|
||||||
int button = (column_index - COLUMN_JOYPAD1_A) % NUM_JOYPAD_BUTTONS;
|
int button = (column_index - COLUMN_JOYPAD1_A) % NUM_JOYPAD_BUTTONS;
|
||||||
int selection_beginning = selection->getCurrentRowsSelectionBeginning();
|
int selection_beginning = selection->getCurrentRowsSelectionBeginning();
|
||||||
|
@ -4654,7 +4671,7 @@ void QPianoRoll::mouseDoubleClickEvent(QMouseEvent * event)
|
||||||
selection->setRowSelection(row_index);
|
selection->setRowSelection(row_index);
|
||||||
}
|
}
|
||||||
// toggle Input
|
// toggle Input
|
||||||
drawingStartTimestamp = clock();
|
drawingStartTimestamp = getTasEditorTime();
|
||||||
int joy = (column_index - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS;
|
int joy = (column_index - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS;
|
||||||
int button = (column_index - COLUMN_JOYPAD1_A) % NUM_JOYPAD_BUTTONS;
|
int button = (column_index - COLUMN_JOYPAD1_A) % NUM_JOYPAD_BUTTONS;
|
||||||
int selection_beginning = selection->getCurrentRowsSelectionBeginning();
|
int selection_beginning = selection->getCurrentRowsSelectionBeginning();
|
||||||
|
@ -4908,7 +4925,7 @@ void QPianoRoll::mousePressEvent(QMouseEvent * event)
|
||||||
// clicked on Input
|
// clicked on Input
|
||||||
if (headerClicked)
|
if (headerClicked)
|
||||||
{
|
{
|
||||||
drawingStartTimestamp = clock();
|
drawingStartTimestamp = getTasEditorTime();
|
||||||
int joy = (column_index - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS;
|
int joy = (column_index - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS;
|
||||||
int button = (column_index - COLUMN_JOYPAD1_A) % NUM_JOYPAD_BUTTONS;
|
int button = (column_index - COLUMN_JOYPAD1_A) % NUM_JOYPAD_BUTTONS;
|
||||||
int selection_beginning = selection->getCurrentRowsSelectionBeginning();
|
int selection_beginning = selection->getCurrentRowsSelectionBeginning();
|
||||||
|
@ -4928,7 +4945,7 @@ void QPianoRoll::mousePressEvent(QMouseEvent * event)
|
||||||
selection->setRowSelection(row_index);
|
selection->setRowSelection(row_index);
|
||||||
}
|
}
|
||||||
// toggle Input
|
// toggle Input
|
||||||
drawingStartTimestamp = clock();
|
drawingStartTimestamp = getTasEditorTime();
|
||||||
int joy = (column_index - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS;
|
int joy = (column_index - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS;
|
||||||
int button = (column_index - COLUMN_JOYPAD1_A) % NUM_JOYPAD_BUTTONS;
|
int button = (column_index - COLUMN_JOYPAD1_A) % NUM_JOYPAD_BUTTONS;
|
||||||
int selection_beginning = selection->getCurrentRowsSelectionBeginning();
|
int selection_beginning = selection->getCurrentRowsSelectionBeginning();
|
||||||
|
@ -5805,9 +5822,9 @@ void QPianoRoll::periodicUpdate(void)
|
||||||
updateDrag();
|
updateDrag();
|
||||||
|
|
||||||
// once per 40 milliseconds update colors alpha in the Header
|
// once per 40 milliseconds update colors alpha in the Header
|
||||||
if (clock() > nextHeaderUpdateTime)
|
if (getTasEditorTime() > nextHeaderUpdateTime)
|
||||||
{
|
{
|
||||||
nextHeaderUpdateTime = clock() + HEADER_LIGHT_UPDATE_TICK;
|
nextHeaderUpdateTime = getTasEditorTime() + HEADER_LIGHT_UPDATE_TICK;
|
||||||
bool changes_made = false;
|
bool changes_made = false;
|
||||||
int light_value = 0;
|
int light_value = 0;
|
||||||
// 1 - update Frame# columns' heads
|
// 1 - update Frame# columns' heads
|
||||||
|
@ -5873,7 +5890,7 @@ void QPianoRoll::setLightInHeaderColumn(int column, int level)
|
||||||
{
|
{
|
||||||
headerColors[column] = level;
|
headerColors[column] = level;
|
||||||
//redrawHeader();
|
//redrawHeader();
|
||||||
nextHeaderUpdateTime = clock() + HEADER_LIGHT_UPDATE_TICK;
|
nextHeaderUpdateTime = getTasEditorTime() + HEADER_LIGHT_UPDATE_TICK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
@ -104,7 +105,7 @@ enum PIANO_ROLL_COLUMNS
|
||||||
#define HEADER_LIGHT_HOLD 5
|
#define HEADER_LIGHT_HOLD 5
|
||||||
#define HEADER_LIGHT_MOUSEOVER_SEL 3
|
#define HEADER_LIGHT_MOUSEOVER_SEL 3
|
||||||
#define HEADER_LIGHT_MOUSEOVER 0
|
#define HEADER_LIGHT_MOUSEOVER 0
|
||||||
#define HEADER_LIGHT_UPDATE_TICK (CLOCKS_PER_SEC / 25) // 25FPS
|
#define HEADER_LIGHT_UPDATE_TICK (40) // 25FPS
|
||||||
|
|
||||||
struct NewProjectParameters
|
struct NewProjectParameters
|
||||||
{
|
{
|
||||||
|
@ -298,8 +299,8 @@ class QPianoRoll : public QWidget
|
||||||
int mouse_x;
|
int mouse_x;
|
||||||
int mouse_y;
|
int mouse_y;
|
||||||
int gridPixelWidth;
|
int gridPixelWidth;
|
||||||
clock_t drawingStartTimestamp;
|
uint64_t drawingStartTimestamp;
|
||||||
clock_t nextHeaderUpdateTime;
|
uint64_t nextHeaderUpdateTime;
|
||||||
|
|
||||||
int playbackCursorPos;
|
int playbackCursorPos;
|
||||||
|
|
||||||
|
@ -654,4 +655,6 @@ void tasWindowSetFocus(bool val);
|
||||||
bool isTaseditorRecording(void);
|
bool isTaseditorRecording(void);
|
||||||
void recordInputByTaseditor(void);
|
void recordInputByTaseditor(void);
|
||||||
|
|
||||||
|
uint64_t getTasEditorTime(void);
|
||||||
|
|
||||||
extern TasEditorWindow *tasWin;
|
extern TasEditorWindow *tasWin;
|
||||||
|
|
|
@ -119,7 +119,7 @@ void BOOKMARKS::reset_vars()
|
||||||
mouseOverBranchesBitmap = false;
|
mouseOverBranchesBitmap = false;
|
||||||
mustCheckItemUnderMouse = true;
|
mustCheckItemUnderMouse = true;
|
||||||
bookmarkLeftclicked = bookmarkRightclicked = ITEM_UNDER_MOUSE_NONE;
|
bookmarkLeftclicked = bookmarkRightclicked = ITEM_UNDER_MOUSE_NONE;
|
||||||
nextFlashUpdateTime = clock() + BOOKMARKS_FLASH_TICK;
|
nextFlashUpdateTime = getTasEditorTime() + BOOKMARKS_FLASH_TICK;
|
||||||
imageItem = 0;
|
imageItem = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,9 +201,9 @@ void BOOKMARKS::update()
|
||||||
commands.resize(0);
|
commands.resize(0);
|
||||||
|
|
||||||
// once per 100 milliseconds update bookmark flashes
|
// once per 100 milliseconds update bookmark flashes
|
||||||
if (clock() > nextFlashUpdateTime)
|
if (getTasEditorTime() > nextFlashUpdateTime)
|
||||||
{
|
{
|
||||||
nextFlashUpdateTime = clock() + BOOKMARKS_FLASH_TICK;
|
nextFlashUpdateTime = getTasEditorTime() + BOOKMARKS_FLASH_TICK;
|
||||||
for (int i = 0; i < TOTAL_BOOKMARKS; ++i)
|
for (int i = 0; i < TOTAL_BOOKMARKS; ++i)
|
||||||
{
|
{
|
||||||
if (bookmarkRightclicked == i || bookmarkLeftclicked == i)
|
if (bookmarkRightclicked == i || bookmarkLeftclicked == i)
|
||||||
|
|
|
@ -42,7 +42,7 @@ enum BOOKMARK_COMMANDS
|
||||||
#define ITEM_UNDER_MOUSE_CLOUD (-1)
|
#define ITEM_UNDER_MOUSE_CLOUD (-1)
|
||||||
#define ITEM_UNDER_MOUSE_FIREBALL (TOTAL_BOOKMARKS)
|
#define ITEM_UNDER_MOUSE_FIREBALL (TOTAL_BOOKMARKS)
|
||||||
|
|
||||||
#define BOOKMARKS_FLASH_TICK (CLOCKS_PER_SEC / 10) // 10 Hz
|
#define BOOKMARKS_FLASH_TICK 100 // in milliseconds
|
||||||
|
|
||||||
// listview columns
|
// listview columns
|
||||||
enum
|
enum
|
||||||
|
@ -128,7 +128,7 @@ private:
|
||||||
std::vector<int> commands;
|
std::vector<int> commands;
|
||||||
int selectedSlot;
|
int selectedSlot;
|
||||||
int mouseX, mouseY;
|
int mouseX, mouseY;
|
||||||
clock_t nextFlashUpdateTime;
|
uint64_t nextFlashUpdateTime;
|
||||||
|
|
||||||
// GUI stuff
|
// GUI stuff
|
||||||
QFont font;
|
QFont font;
|
||||||
|
|
|
@ -237,19 +237,19 @@ void BRANCHES::resetVars()
|
||||||
playbackCursorX = playbackCursorY = 0;
|
playbackCursorX = playbackCursorY = 0;
|
||||||
branchRightclicked = lastItemUnderMouse = -1;
|
branchRightclicked = lastItemUnderMouse = -1;
|
||||||
mustRecalculateBranchesTree = mustRedrawBranchesBitmap = true;
|
mustRecalculateBranchesTree = mustRedrawBranchesBitmap = true;
|
||||||
nextAnimationTime = clock() + BRANCHES_ANIMATION_TICK;
|
nextAnimationTime = getTasEditorTime() + BRANCHES_ANIMATION_TICK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BRANCHES::update()
|
void BRANCHES::update()
|
||||||
{
|
{
|
||||||
clock_t currentTime;
|
unsigned int currentTime;
|
||||||
|
|
||||||
if (mustRecalculateBranchesTree)
|
if (mustRecalculateBranchesTree)
|
||||||
{
|
{
|
||||||
recalculateBranchesTree();
|
recalculateBranchesTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
currentTime = clock();
|
currentTime = getTasEditorTime();
|
||||||
|
|
||||||
// once per 40 milliseconds update branches_bitmap
|
// once per 40 milliseconds update branches_bitmap
|
||||||
if (currentTime > nextAnimationTime)
|
if (currentTime > nextAnimationTime)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#define BRANCHES_ANIMATION_TICK (CLOCKS_PER_SEC / 25) // animate at 25FPS
|
#define BRANCHES_ANIMATION_TICK (40) // animate at 25FPS
|
||||||
#define BRANCHES_TRANSITION_MAX 12
|
#define BRANCHES_TRANSITION_MAX 12
|
||||||
#define CURSOR_MIN_DISTANCE 1.0
|
#define CURSOR_MIN_DISTANCE 1.0
|
||||||
#define CURSOR_MAX_DISTANCE 256.0
|
#define CURSOR_MAX_DISTANCE 256.0
|
||||||
|
@ -179,7 +179,7 @@ private:
|
||||||
// not saved vars
|
// not saved vars
|
||||||
int transitionPhase;
|
int transitionPhase;
|
||||||
int currentAnimationFrame;
|
int currentAnimationFrame;
|
||||||
clock_t nextAnimationTime;
|
uint64_t nextAnimationTime;
|
||||||
int playbackCursorX, playbackCursorY;
|
int playbackCursorX, playbackCursorY;
|
||||||
double cornersCursorX, cornersCursorY;
|
double cornersCursorX, cornersCursorY;
|
||||||
std::vector<int> branchX; // in pixels
|
std::vector<int> branchX; // in pixels
|
||||||
|
|
|
@ -41,7 +41,7 @@ GREENZONE::GREENZONE()
|
||||||
void GREENZONE::init()
|
void GREENZONE::init()
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
nextCleaningTime = clock() + TIME_BETWEEN_CLEANINGS;
|
nextCleaningTime = getTasEditorTime() + TIME_BETWEEN_CLEANINGS;
|
||||||
}
|
}
|
||||||
void GREENZONE::free()
|
void GREENZONE::free()
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ void GREENZONE::update()
|
||||||
}
|
}
|
||||||
|
|
||||||
// run cleaning from time to time
|
// run cleaning from time to time
|
||||||
if (clock() > nextCleaningTime)
|
if (getTasEditorTime() > nextCleaningTime)
|
||||||
runGreenzoneCleaning();
|
runGreenzoneCleaning();
|
||||||
|
|
||||||
// also log lag frames
|
// also log lag frames
|
||||||
|
@ -180,7 +180,7 @@ finish:
|
||||||
bookmarks->redrawBookmarksList();
|
bookmarks->redrawBookmarksList();
|
||||||
}
|
}
|
||||||
// shedule next cleaning
|
// shedule next cleaning
|
||||||
nextCleaningTime = clock() + TIME_BETWEEN_CLEANINGS;
|
nextCleaningTime = getTasEditorTime() + TIME_BETWEEN_CLEANINGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true if actually cleared savestate data
|
// returns true if actually cleared savestate data
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#define GREENZONE_ID_LEN 10
|
#define GREENZONE_ID_LEN 10
|
||||||
|
|
||||||
#define TIME_BETWEEN_CLEANINGS (10 * CLOCKS_PER_SEC)
|
#define TIME_BETWEEN_CLEANINGS (10000)
|
||||||
|
|
||||||
// Greenzone cleaning masks
|
// Greenzone cleaning masks
|
||||||
#define EVERY16TH 0xFFFFFFF0
|
#define EVERY16TH 0xFFFFFFF0
|
||||||
|
@ -61,6 +61,6 @@ private:
|
||||||
std::vector<std::vector<uint8_t>> savestates;
|
std::vector<std::vector<uint8_t>> savestates;
|
||||||
|
|
||||||
// not saved data
|
// not saved data
|
||||||
clock_t nextCleaningTime;
|
uint64_t nextCleaningTime;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -101,7 +101,7 @@ void HISTORY::init(void)
|
||||||
{
|
{
|
||||||
updateScheduled = false;
|
updateScheduled = false;
|
||||||
// shedule first autocompression
|
// shedule first autocompression
|
||||||
nextAutocompressTime = clock() + TIME_BETWEEN_AUTOCOMPRESSIONS;
|
nextAutocompressTime = getTasEditorTime() + TIME_BETWEEN_AUTOCOMPRESSIONS;
|
||||||
}
|
}
|
||||||
void HISTORY::free()
|
void HISTORY::free()
|
||||||
{
|
{
|
||||||
|
@ -144,7 +144,7 @@ void HISTORY::update()
|
||||||
showUndoHint = false;
|
showUndoHint = false;
|
||||||
if (undoHintPos >= 0)
|
if (undoHintPos >= 0)
|
||||||
{
|
{
|
||||||
if ((int)clock() < undoHintTimer)
|
if (getTasEditorTime() < undoHintTimer)
|
||||||
showUndoHint = true;
|
showUndoHint = true;
|
||||||
else
|
else
|
||||||
undoHintPos = -1; // finished hinting
|
undoHintPos = -1; // finished hinting
|
||||||
|
@ -159,7 +159,7 @@ void HISTORY::update()
|
||||||
// pianoRoll.redrawRow(undoHintPos);
|
// pianoRoll.redrawRow(undoHintPos);
|
||||||
|
|
||||||
// When CPU is idle, compress items from time to time
|
// When CPU is idle, compress items from time to time
|
||||||
if (clock() > nextAutocompressTime)
|
if (getTasEditorTime() > nextAutocompressTime)
|
||||||
{
|
{
|
||||||
if (FCEUI_EmulationPaused())
|
if (FCEUI_EmulationPaused())
|
||||||
{
|
{
|
||||||
|
@ -179,7 +179,7 @@ void HISTORY::update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nextAutocompressTime = clock() + TIME_BETWEEN_AUTOCOMPRESSIONS;
|
nextAutocompressTime = getTasEditorTime() + TIME_BETWEEN_AUTOCOMPRESSIONS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,7 +347,7 @@ int HISTORY::jumpInTime(int new_pos)
|
||||||
undoHintPos = getCurrentSnapshot().keyFrame; // redo
|
undoHintPos = getCurrentSnapshot().keyFrame; // redo
|
||||||
else
|
else
|
||||||
undoHintPos = getNextToCurrentSnapshot().keyFrame; // undo
|
undoHintPos = getNextToCurrentSnapshot().keyFrame; // undo
|
||||||
undoHintTimer = clock() + UNDO_HINT_TIME;
|
undoHintTimer = getTasEditorTime() + UNDO_HINT_TIME;
|
||||||
showUndoHint = true;
|
showUndoHint = true;
|
||||||
|
|
||||||
real_pos = (historyStartPos + historyCursorPos) % historySize;
|
real_pos = (historyStartPos + historyCursorPos) % historySize;
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
#include "Qt/TasEditor/bookmark.h"
|
#include "Qt/TasEditor/bookmark.h"
|
||||||
#include "Qt/TasEditor/snapshot.h"
|
#include "Qt/TasEditor/snapshot.h"
|
||||||
|
|
||||||
#define UNDO_HINT_TIME (CLOCKS_PER_SEC / 5) // in milliseconds
|
#define UNDO_HINT_TIME (200) // in milliseconds
|
||||||
|
|
||||||
#define SAVING_HISTORY_PROGRESSBAR_UPDATE_RATE 10
|
#define SAVING_HISTORY_PROGRESSBAR_UPDATE_RATE 10
|
||||||
#define TIME_BETWEEN_AUTOCOMPRESSIONS (CLOCKS_PER_SEC / 2) // in milliseconds
|
#define TIME_BETWEEN_AUTOCOMPRESSIONS (500) // in milliseconds
|
||||||
|
|
||||||
#define HISTORY_LIST_WIDTH 500
|
#define HISTORY_LIST_WIDTH 500
|
||||||
|
|
||||||
|
@ -157,10 +157,10 @@ private:
|
||||||
int historySize;
|
int historySize;
|
||||||
|
|
||||||
int undoHintPos, oldUndoHintPos;
|
int undoHintPos, oldUndoHintPos;
|
||||||
clock_t undoHintTimer;
|
uint64_t undoHintTimer;
|
||||||
bool showUndoHint, oldShowUndoHint;
|
bool showUndoHint, oldShowUndoHint;
|
||||||
bool updateScheduled;
|
bool updateScheduled;
|
||||||
clock_t nextAutocompressTime;
|
uint64_t nextAutocompressTime;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -71,10 +71,10 @@ void PLAYBACK::update()
|
||||||
{
|
{
|
||||||
if (!rewindButtonOldState)
|
if (!rewindButtonOldState)
|
||||||
{
|
{
|
||||||
buttonHoldTimer = clock();
|
buttonHoldTimer = getTasEditorTime();
|
||||||
//handleRewindFrame();
|
//handleRewindFrame();
|
||||||
}
|
}
|
||||||
else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < clock())
|
else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < getTasEditorTime())
|
||||||
{
|
{
|
||||||
handleRewindFrame();
|
handleRewindFrame();
|
||||||
}
|
}
|
||||||
|
@ -85,10 +85,10 @@ void PLAYBACK::update()
|
||||||
{
|
{
|
||||||
if (!forwardButtonOldState)
|
if (!forwardButtonOldState)
|
||||||
{
|
{
|
||||||
buttonHoldTimer = clock();
|
buttonHoldTimer = getTasEditorTime();
|
||||||
//handleForwardFrame();
|
//handleForwardFrame();
|
||||||
}
|
}
|
||||||
else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < clock())
|
else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < getTasEditorTime())
|
||||||
{
|
{
|
||||||
handleForwardFrame();
|
handleForwardFrame();
|
||||||
}
|
}
|
||||||
|
@ -100,10 +100,10 @@ void PLAYBACK::update()
|
||||||
{
|
{
|
||||||
if (!rewindFullButtonOldState)
|
if (!rewindFullButtonOldState)
|
||||||
{
|
{
|
||||||
buttonHoldTimer = clock();
|
buttonHoldTimer = getTasEditorTime();
|
||||||
//handleRewindFull();
|
//handleRewindFull();
|
||||||
}
|
}
|
||||||
else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < clock())
|
else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < getTasEditorTime())
|
||||||
{
|
{
|
||||||
handleRewindFull();
|
handleRewindFull();
|
||||||
}
|
}
|
||||||
|
@ -114,10 +114,10 @@ void PLAYBACK::update()
|
||||||
{
|
{
|
||||||
if (!forwardFullButtonOldState)
|
if (!forwardFullButtonOldState)
|
||||||
{
|
{
|
||||||
buttonHoldTimer = clock();
|
buttonHoldTimer = getTasEditorTime();
|
||||||
//handleForwardFull();
|
//handleForwardFull();
|
||||||
}
|
}
|
||||||
else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < clock())
|
else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < getTasEditorTime())
|
||||||
{
|
{
|
||||||
handleForwardFull();
|
handleForwardFull();
|
||||||
}
|
}
|
||||||
|
@ -178,9 +178,9 @@ void PLAYBACK::update()
|
||||||
if (pauseFrame)
|
if (pauseFrame)
|
||||||
{
|
{
|
||||||
if (emuPausedState)
|
if (emuPausedState)
|
||||||
showPauseFrame = (int)(clock() / PAUSEFRAME_BLINKING_PERIOD_WHEN_PAUSED) & 1;
|
showPauseFrame = (int)(getTasEditorTime() / PAUSEFRAME_BLINKING_PERIOD_WHEN_PAUSED) & 1;
|
||||||
else
|
else
|
||||||
showPauseFrame = (int)(clock() / PAUSEFRAME_BLINKING_PERIOD_WHEN_SEEKING) & 1;
|
showPauseFrame = (int)(getTasEditorTime() / PAUSEFRAME_BLINKING_PERIOD_WHEN_SEEKING) & 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
#define PROGRESSBAR_WIDTH 200
|
#define PROGRESSBAR_WIDTH 200
|
||||||
|
|
||||||
#define PAUSEFRAME_BLINKING_PERIOD_WHEN_SEEKING (CLOCKS_PER_SEC / 10)
|
#define PAUSEFRAME_BLINKING_PERIOD_WHEN_SEEKING (100)
|
||||||
#define PAUSEFRAME_BLINKING_PERIOD_WHEN_PAUSED (CLOCKS_PER_SEC / 4)
|
#define PAUSEFRAME_BLINKING_PERIOD_WHEN_PAUSED (250)
|
||||||
|
|
||||||
#define BUTTON_HOLD_REPEAT_DELAY (CLOCKS_PER_SEC / 4) // in milliseconds
|
#define BUTTON_HOLD_REPEAT_DELAY (250) // in milliseconds
|
||||||
|
|
||||||
class UpperMarkerNoteEdit : public QLineEdit
|
class UpperMarkerNoteEdit : public QLineEdit
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@ private:
|
||||||
bool forwardButtonState, forwardButtonOldState;
|
bool forwardButtonState, forwardButtonOldState;
|
||||||
bool rewindFullButtonState, rewindFullButtonOldState;
|
bool rewindFullButtonState, rewindFullButtonOldState;
|
||||||
bool forwardFullButtonState, forwardFullButtonOldState;
|
bool forwardFullButtonState, forwardFullButtonOldState;
|
||||||
clock_t buttonHoldTimer;
|
uint64_t buttonHoldTimer;
|
||||||
int seekingBeginningFrame;
|
int seekingBeginningFrame;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -93,9 +93,9 @@ void SELECTION::update()
|
||||||
{
|
{
|
||||||
if (!previousMarkerButtonOldState)
|
if (!previousMarkerButtonOldState)
|
||||||
{
|
{
|
||||||
buttonHoldTimer = clock();
|
buttonHoldTimer = getTasEditorTime();
|
||||||
jumpToPreviousMarker();
|
jumpToPreviousMarker();
|
||||||
} else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < clock())
|
} else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < getTasEditorTime())
|
||||||
{
|
{
|
||||||
jumpToPreviousMarker();
|
jumpToPreviousMarker();
|
||||||
}
|
}
|
||||||
|
@ -106,10 +106,10 @@ void SELECTION::update()
|
||||||
{
|
{
|
||||||
if (!nextMarkerButtonOldState)
|
if (!nextMarkerButtonOldState)
|
||||||
{
|
{
|
||||||
buttonHoldTimer = clock();
|
buttonHoldTimer = getTasEditorTime();
|
||||||
jumpToNextMarker();
|
jumpToNextMarker();
|
||||||
}
|
}
|
||||||
else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < clock())
|
else if (buttonHoldTimer + BUTTON_HOLD_REPEAT_DELAY < getTasEditorTime())
|
||||||
{
|
{
|
||||||
jumpToNextMarker();
|
jumpToNextMarker();
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ private:
|
||||||
|
|
||||||
bool previousMarkerButtonState, previousMarkerButtonOldState;
|
bool previousMarkerButtonState, previousMarkerButtonOldState;
|
||||||
bool nextMarkerButtonState, nextMarkerButtonOldState;
|
bool nextMarkerButtonState, nextMarkerButtonOldState;
|
||||||
clock_t buttonHoldTimer;
|
uint64_t buttonHoldTimer;
|
||||||
|
|
||||||
std::vector<RowsSelection> rowsSelectionHistory;
|
std::vector<RowsSelection> rowsSelectionHistory;
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ void TASEDITOR_PROJECT::reset()
|
||||||
void TASEDITOR_PROJECT::update()
|
void TASEDITOR_PROJECT::update()
|
||||||
{
|
{
|
||||||
// if it's time to autosave - pop Save As dialog
|
// if it's time to autosave - pop Save As dialog
|
||||||
if (changed && /*taseditorWindow.TASEditorIsInFocus &&*/ taseditorConfig->autosaveEnabled && !projectFile.empty() && clock() >= nextSaveShedule /*&& pianoRoll.dragMode == DRAG_MODE_NONE*/)
|
if (changed && /*taseditorWindow.TASEditorIsInFocus &&*/ taseditorConfig->autosaveEnabled && !projectFile.empty() && getTasEditorTime() >= nextSaveShedule /*&& pianoRoll.dragMode == DRAG_MODE_NONE*/)
|
||||||
{
|
{
|
||||||
if (taseditorConfig->autosaveSilent)
|
if (taseditorConfig->autosaveSilent)
|
||||||
{
|
{
|
||||||
|
@ -411,7 +411,7 @@ bool TASEDITOR_PROJECT::getProjectChanged()
|
||||||
|
|
||||||
void TASEDITOR_PROJECT::sheduleNextAutosave()
|
void TASEDITOR_PROJECT::sheduleNextAutosave()
|
||||||
{
|
{
|
||||||
nextSaveShedule = clock() + taseditorConfig->autosavePeriod * AUTOSAVE_PERIOD_SCALE;
|
nextSaveShedule = getTasEditorTime() + taseditorConfig->autosavePeriod * AUTOSAVE_PERIOD_SCALE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#define LVS_EX_DOUBLEBUFFER 0x00010000
|
#define LVS_EX_DOUBLEBUFFER 0x00010000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define AUTOSAVE_PERIOD_SCALE (60 * CLOCKS_PER_SEC) // = 1 minute in milliseconds
|
#define AUTOSAVE_PERIOD_SCALE (60000) // = 1 minute in milliseconds
|
||||||
|
|
||||||
#define MARKERS_SAVED 1
|
#define MARKERS_SAVED 1
|
||||||
#define BOOKMARKS_SAVED 2
|
#define BOOKMARKS_SAVED 2
|
||||||
|
@ -69,7 +69,7 @@ public:
|
||||||
private:
|
private:
|
||||||
bool changed;
|
bool changed;
|
||||||
bool updateCaptionFlag;
|
bool updateCaptionFlag;
|
||||||
clock_t nextSaveShedule;
|
uint64_t nextSaveShedule;
|
||||||
|
|
||||||
std::string projectFile; // full path
|
std::string projectFile; // full path
|
||||||
std::string projectName; // file name only
|
std::string projectName; // file name only
|
||||||
|
|
Loading…
Reference in New Issue