Skip to content

Commit

Permalink
ADD: Seek callback
Browse files Browse the repository at this point in the history
  • Loading branch information
grimes2 committed Apr 29, 2023
1 parent e20b18e commit e9b6d79
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions foo_preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ class mainmenu_commands_preview : public mainmenu_commands
{
cfg_preview_length.get(preview_length);
preview_length2 = atoi(preview_length);
cfg_start_time_seconds.get(preview_start);
preview_start2 = atoi(preview_start);
FB2K_console_formatter() << "Preview on";
static_api_ptr_t<playback_control>()->start(playback_control::track_command_play, false);
}
Expand Down Expand Up @@ -279,11 +281,6 @@ class play_callback_preview : public play_callback_static
preview_start2 = distr(gen);
FB2K_console_formatter() << "Random start: " << preview_start2 << "s";
}
else
{
cfg_start_time_seconds.get(preview_start);
preview_start2 = atoi(preview_start);
}
if (preview_start2 > total_length2 - preview_length2) {
preview_start2 = total_length2 - preview_length2;
}
Expand Down Expand Up @@ -319,6 +316,8 @@ class play_callback_preview : public play_callback_static
virtual void on_playback_seek(double p_time) {
if (menu_preview_enabled) {
preview_start2 = p_time;
KillTimer(NULL, ptr3);
ptr3 = SetTimer(NULL, ID_TIMER3, (UINT)preview_length2 * 1000, (TIMERPROC)PreviewTimer);
}
}
virtual void on_playback_starting(play_control::t_track_command, bool) {}
Expand Down

0 comments on commit e9b6d79

Please sign in to comment.