Class RecordManager#
Defined in File record_manager.hpp
Inheritance Relationships#
Base Type#
public QObject
Class Documentation#
-
class RecordManager : public QObject#
Central coordinator for a recording session.
RecordManager is the single point of control for starting and stopping all recording channels. It:
Creates a timestamped session folder under
AppSettings::record.directory.Writes
session_meta.jsonimmediately on start (even if later steps fail).Starts the trigger CSV, audio recorders, and video pipeline in the correct order, then stops them in reverse order.
Drives a 100 ms elapsed-time ticker used by the QML monitor view.
All public methods must be called from the main thread.
See also
AppSettings::RecordSettings, VideoManager, AudioManager, TriggerManager
- Typical usage
// Wired up by Application — most code accesses this via app.record_manager() RecordManager rm(settings, triggerMgr, audioMgr, videoMgr, "my_lab"); connect(&rm, &RecordManager::recording_started, this, [](const QString& path) { qDebug() << "Recording to" << path; }); if (rm.start()) { // recording is live } // ... later ... rm.stop();
Public Functions
-
explicit RecordManager(AppSettings &settings, TriggerManager *triggerMgr, AudioManager *audioMgr, VideoManager *videoMgr = nullptr, const QString &username = "guest", QObject *parent = nullptr)#
- Parameters:
settings – Application settings (record, video, audio, trigger sub-structs).
triggerMgr – Trigger manager — receives start/stop_recording() calls. May be
nullptr(triggers are then skipped).audioMgr – Audio manager. May be
nullptr.videoMgr – Video manager. May be
nullptr.username – Profile name embedded in
session_meta.jsonas"recorded_by". Defaults to"guest".parent – Qt parent object.
-
~RecordManager() override#
-
bool start()#
Begins a new recording session.
Creates the session folder, writes
session_meta.json, then starts triggers → audio → video in that order.- Returns:
falseif already recording or the session directory cannot be created; logs the reason on failure.
-
void stop()#
Ends the current session.
Stops video → audio → triggers in reverse order, then emits
recording_stopped(). Safe to call even when not recording.
-
bool is_recording() const#
- Returns:
truewhile a session is active.
-
int elapsed_ms() const#
- Returns:
Milliseconds elapsed since the session started (0 when idle).
-
QString current_session_path() const#
- Returns:
Absolute path to the current session folder, or an empty string when no session has been started yet.
Signals
-
void recording_started(QString sessionPath)#
Emitted when a session starts successfully.
- Parameters:
sessionPath – Absolute path to the session folder.
-
void recording_stopped(QString sessionPath, int durationMs)#
Emitted when a session ends (normally or via stop()).
- Parameters:
sessionPath – Absolute path to the session folder.
durationMs – Session duration in milliseconds.
-
void elapsed_ms_changed(int ms)#
Emitted every 100 ms while recording is active.
- Parameters:
ms – Milliseconds elapsed since session start.
-
void error_occurred(QString message)#
Emitted when a non-recoverable error prevents recording from starting.
- Parameters:
message – Human-readable error description (also logged).