mutterkey
KDE-first push-to-talk transcription tool for KDE Plasma
Loading...
Searching...
No Matches
transcriptionworker.h
Go to the documentation of this file.
1#pragma once
2
3#include "audio/recording.h"
6
7#include <QObject>
8#include <memory>
9
22class TranscriptionWorker final : public QObject
23{
24 Q_OBJECT
25
26public:
32 explicit TranscriptionWorker(std::shared_ptr<const TranscriptionEngine> engine, QObject *parent = nullptr);
38 explicit TranscriptionWorker(std::unique_ptr<TranscriptionSession> transcriber, QObject *parent = nullptr);
39 ~TranscriptionWorker() override = default;
40
41 Q_DISABLE_COPY_MOVE(TranscriptionWorker)
42
43
47 [[nodiscard]] QString backendName() const;
48
53 [[nodiscard]] BackendCapabilities capabilities() const;
54
60
66 bool warmup(RuntimeError *error = nullptr);
67
72 void transcribeRecordingCompat(const Recording &recording);
73
74signals:
79 void transcriptionReady(const QString &text);
80
86
87private:
88 static bool shouldDiscardSession(const RuntimeError &error);
89
90 bool ensureModel(RuntimeError *error = nullptr);
91 bool ensureSession(RuntimeError *error = nullptr);
92
94 std::shared_ptr<const TranscriptionEngine> m_engine;
96 std::shared_ptr<const TranscriptionModelHandle> m_model;
98 BackendCapabilities m_capabilities;
100 RuntimeDiagnostics m_runtimeDiagnostics;
102 RecordingNormalizer m_normalizer;
104 std::unique_ptr<TranscriptionSession> m_transcriber;
105};
Converts captured recordings into mono 16 kHz float samples.
Thread-hosted wrapper around the configured transcription backend.
BackendCapabilities capabilities() const
Returns the active runtime capability snapshot.
void transcriptionFailed(const RuntimeError &error)
Emitted when transcription fails.
void transcriptionReady(const QString &text)
Emitted when transcription succeeds.
RuntimeDiagnostics runtimeDiagnostics() const
Returns runtime diagnostics for the active backend instance.
TranscriptionWorker(std::unique_ptr< TranscriptionSession > transcriber, QObject *parent=nullptr)
Creates a worker around an already-constructed session.
void transcribeRecordingCompat(const Recording &recording)
Transcribes a captured recording and emits a result signal.
bool warmup(RuntimeError *error=nullptr)
Eagerly initializes backend state before the first real transcription.
QString backendName() const
Returns the active transcription backend name.
TranscriptionWorker(std::shared_ptr< const TranscriptionEngine > engine, QObject *parent=nullptr)
Creates a worker with a shared immutable engine.
Shared recorded-audio payload passed between capture and transcription.
Conversion from captured Qt audio to Whisper-ready normalized samples.
Product-owned backend/runtime metadata surfaced to app code.
Immutable-style value object holding one captured audio segment.
Definition recording.h:14
Runtime inspection data kept separate from static backend capabilities.
Structured runtime-layer failure with user-facing and diagnostic text.
Stable engine/session boundary for embedded transcription backends.