From bb78c52396bddf31b014876d9fa76597deebba6b Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Mon, 14 Aug 2023 07:39:40 +0900 Subject: [PATCH] Leave some comments --- src/Services/Recorder.vala | 14 ++++++++------ src/Widgets/LevelBar.vala | 7 ++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Services/Recorder.vala b/src/Services/Recorder.vala index c413fecc..157f4ac5 100644 --- a/src/Services/Recorder.vala +++ b/src/Services/Recorder.vala @@ -12,15 +12,16 @@ public class Recorder : Object { public signal void save_file (string tmp_full_path, string suffix); public enum RecordingState { - STOPPED, - PAUSED, - RECORDING + STOPPED, // Not recording + PAUSED, // Recording is paused + RECORDING // Recording is ongoing } + // Convert from RecordingState to Gst.State private const Gst.State GST_STATE_TABLE[] = { - Gst.State.NULL, - Gst.State.PAUSED, - Gst.State.PLAYING + Gst.State.NULL, // RecordingState.STOPPED + Gst.State.PAUSED, // RecordingState.PAUSED + Gst.State.PLAYING // RecordingState.RECORDING }; public RecordingState state { @@ -29,6 +30,7 @@ public class Recorder : Object { } set { + // Control actual recording to stop, start, or pause pipeline.set_state (GST_STATE_TABLE[value]); _state = value; } diff --git a/src/Widgets/LevelBar.vala b/src/Widgets/LevelBar.vala index 5836f571..f2d34ea8 100644 --- a/src/Widgets/LevelBar.vala +++ b/src/Widgets/LevelBar.vala @@ -70,9 +70,10 @@ public class LevelBar : Gtk.Box { serie.line.color = { 0.7f, 0.1f, 0.2f, 1.0f }; if (timestamp == -1) { - timestamp = GLib.get_real_time () / 1000; - // Seek on the timeline - config.time.current = GLib.get_real_time () / config.time.conv_us; + // Seek to the current timestamp + int64 now_msec = GLib.get_real_time () / 1000; + timestamp = now_msec; + config.time.current = now_msec; } update_graph_timeout = Timeout.add (REFRESH_USEC, () => {