mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +01:00
add an idle callback at FPS
This commit is contained in:
parent
01864b43e0
commit
16443f44a2
4 changed files with 45 additions and 0 deletions
|
|
@ -151,6 +151,7 @@ UIConfiguration *ARDOUR_UI::ui_config = 0;
|
|||
sigc::signal<void,bool> ARDOUR_UI::Blink;
|
||||
sigc::signal<void> ARDOUR_UI::RapidScreenUpdate;
|
||||
sigc::signal<void> ARDOUR_UI::SuperRapidScreenUpdate;
|
||||
sigc::signal<void> ARDOUR_UI::FPSUpdate;
|
||||
sigc::signal<void, framepos_t, bool, framepos_t> ARDOUR_UI::Clock;
|
||||
sigc::signal<void> ARDOUR_UI::CloseAllDialogs;
|
||||
|
||||
|
|
@ -992,6 +993,7 @@ If you still wish to quit, please use the\n\n\
|
|||
second_connection.disconnect ();
|
||||
point_one_second_connection.disconnect ();
|
||||
point_zero_something_second_connection.disconnect();
|
||||
fps_connection.disconnect();
|
||||
}
|
||||
|
||||
delete ARDOUR_UI::instance()->video_timeline;
|
||||
|
|
@ -1139,6 +1141,35 @@ ARDOUR_UI::every_point_zero_something_seconds ()
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gint
|
||||
ARDOUR_UI::every_fps ()
|
||||
{
|
||||
FPSUpdate(); /* EMIT_SIGNAL */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::set_fps_timeout_connection ()
|
||||
{
|
||||
unsigned int interval = 40;
|
||||
if (!_session) return;
|
||||
if (_session->timecode_frames_per_second() != 0) {
|
||||
/* ideally we'll use a select() to sleep and not accumulate
|
||||
* idle time to provide a regular periodic signal.
|
||||
* See linux_vst_gui_support.cc 'elapsed_time_ms'.
|
||||
* However, that'll require a dedicated thread and cross-thread
|
||||
* signals to the GUI Thread..
|
||||
*/
|
||||
interval = floor(500. /* update twice per FPS, since Glib::signal_timeout is very irregular */
|
||||
* _session->frame_rate() / _session->nominal_frame_rate()
|
||||
/ _session->timecode_frames_per_second()
|
||||
);
|
||||
interval = std::max(8u, interval); // at most 120Hz.
|
||||
}
|
||||
fps_connection.disconnect();
|
||||
fps_connection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &ARDOUR_UI::every_fps), interval);
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI::update_sample_rate (framecnt_t)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -190,6 +190,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
/** point_zero_something_seconds -- currently 25Hz ^= 40ms */
|
||||
static sigc::signal<void> SuperRapidScreenUpdate;
|
||||
|
||||
/** every_fps -- see set_fps_timeout_connection() 25Hz < x < 120Hz */
|
||||
static sigc::signal<void> FPSUpdate;
|
||||
|
||||
/** Emitted frequently with the audible frame, false, and the edit point as
|
||||
* parameters respectively.
|
||||
*
|
||||
|
|
@ -548,10 +551,14 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
|||
gint every_second ();
|
||||
gint every_point_one_seconds ();
|
||||
gint every_point_zero_something_seconds ();
|
||||
gint every_fps ();
|
||||
|
||||
sigc::connection second_connection;
|
||||
sigc::connection point_one_second_connection;
|
||||
sigc::connection point_zero_something_second_connection;
|
||||
sigc::connection fps_connection;
|
||||
|
||||
void set_fps_timeout_connection ();
|
||||
|
||||
void open_session ();
|
||||
void open_recent_session ();
|
||||
|
|
|
|||
|
|
@ -183,6 +183,7 @@ ARDOUR_UI::set_session (Session *s)
|
|||
second_connection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &ARDOUR_UI::every_second), 1000);
|
||||
point_one_second_connection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &ARDOUR_UI::every_point_one_seconds), 100);
|
||||
point_zero_something_second_connection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &ARDOUR_UI::every_point_zero_something_seconds), 40);
|
||||
set_fps_timeout_connection();
|
||||
|
||||
update_format ();
|
||||
|
||||
|
|
@ -274,6 +275,7 @@ ARDOUR_UI::unload_session (bool hide_stuff)
|
|||
second_connection.disconnect ();
|
||||
point_one_second_connection.disconnect ();
|
||||
point_zero_something_second_connection.disconnect();
|
||||
fps_connection.disconnect();
|
||||
|
||||
if (editor_meter) {
|
||||
meter_box.remove(*editor_meter);
|
||||
|
|
|
|||
|
|
@ -367,6 +367,7 @@ ARDOUR_UI::parameter_changed (std::string p)
|
|||
} else if (p == "sync-source") {
|
||||
|
||||
synchronize_sync_source_and_video_pullup ();
|
||||
set_fps_timeout_connection ();
|
||||
|
||||
} else if (p == "show-track-meters") {
|
||||
editor->toggle_meter_updating();
|
||||
|
|
@ -426,7 +427,11 @@ ARDOUR_UI::session_parameter_changed (std::string p)
|
|||
{
|
||||
if (p == "native-file-data-format" || p == "native-file-header-format") {
|
||||
update_format ();
|
||||
} else if (p == "timecode-format") {
|
||||
set_fps_timeout_connection ();
|
||||
} else if (p == "video-pullup" || p == "timecode-format") {
|
||||
set_fps_timeout_connection ();
|
||||
|
||||
synchronize_sync_source_and_video_pullup ();
|
||||
reset_main_clocks ();
|
||||
editor->queue_visual_videotimeline_update();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue