ISTTEngine.hpp and ISTTService.hpp both defined TranscriptionCallback with different signatures: - ISTTEngine: void(const std::string& text) - ISTTService: void(const std::string& text, STTMode mode) This caused compilation errors due to conflicting declarations. Solution: Rename the low-level engine callback to STTEngineCallback to distinguish it from the high-level service callback. Fixes: Compilation errors in Phase 7.1 STT Service Layer - All 120 unit tests passing (282 assertions) - Build successful 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
71 lines
1.8 KiB
C++
71 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <memory>
|
|
#include <vector>
|
|
#include <functional>
|
|
|
|
namespace aissia {
|
|
|
|
/**
|
|
* @brief Callback for transcription results (low-level engine)
|
|
*/
|
|
using STTEngineCallback = std::function<void(const std::string& text)>;
|
|
|
|
/**
|
|
* @brief Interface for Speech-to-Text engines
|
|
*
|
|
* Implementations:
|
|
* - WhisperAPIEngine: OpenAI Whisper API
|
|
*/
|
|
class ISTTEngine {
|
|
public:
|
|
virtual ~ISTTEngine() = default;
|
|
|
|
/**
|
|
* @brief Transcribe audio data
|
|
* @param audioData PCM audio samples (16-bit, 16kHz, mono)
|
|
* @return Transcribed text
|
|
*/
|
|
virtual std::string transcribe(const std::vector<float>& audioData) = 0;
|
|
|
|
/**
|
|
* @brief Transcribe audio file
|
|
* @param filePath Path to audio file (wav, mp3, etc.)
|
|
* @return Transcribed text
|
|
*/
|
|
virtual std::string transcribeFile(const std::string& filePath) = 0;
|
|
|
|
/**
|
|
* @brief Set language for transcription
|
|
* @param language ISO 639-1 code (e.g., "fr", "en")
|
|
*/
|
|
virtual void setLanguage(const std::string& language) = 0;
|
|
|
|
/**
|
|
* @brief Check if engine is available
|
|
*/
|
|
virtual bool isAvailable() const = 0;
|
|
|
|
/**
|
|
* @brief Get engine name
|
|
*/
|
|
virtual std::string getEngineName() const = 0;
|
|
};
|
|
|
|
/**
|
|
* @brief Factory to create STT engine
|
|
*/
|
|
class STTEngineFactory {
|
|
public:
|
|
// Legacy API (for backward compatibility)
|
|
static std::unique_ptr<ISTTEngine> create(const std::string& apiKey);
|
|
|
|
// New API with engine type and config
|
|
static std::unique_ptr<ISTTEngine> create(const std::string& type,
|
|
const std::string& modelPath,
|
|
const std::string& apiKey = "");
|
|
};
|
|
|
|
} // namespace aissia
|