feat: Hearo 1차 구현 — 프로그램 소리 실시간 번역 자막

프로그램별 오디오를 캡처해 로컬 GPU에서 음성인식→번역하고 화면 위
자막으로 보여주는 데스크톱 앱. 한/영/일/중 4개 언어.

구성
- audio: WASAPI 프로그램별 캡처(C++ 보조 프로그램) + 장치 루프백 폴백,
  적응형 VAD 발화 분할
- models: 속도~품질 5단계 티어, faster-whisper + CTranslate2/LLM 2백엔드,
  용어집(플레이스홀더 보호 + 프롬프트 주입)
- core: Qt 비의존 파이프라인 엔진 (캡처/분할/추론 3스레드, 큐 연결)
- ui: 사이드바 5화면 + 무테두리 항상위 자막 오버레이, 자체 다크 테마

모델 선정 근거는 docs/MODELS.md, 추가학습 가능 여부와 방법은
docs/FINETUNING.md 참고.

검증: pytest 39개 통과 (GPU·오디오 장치 없이 실행), ruff clean

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-09-21 10:47:11 +09:00
parent c24e5f938d
commit 1a87ec6677
49 changed files with 4975 additions and 1 deletions

58
tests/test_config.py Normal file
View File

@@ -0,0 +1,58 @@
import json
from hearo.config import AppConfig
from hearo.models.tiers import DEFAULT_TIER
def test_defaults_are_sane():
cfg = AppConfig()
assert cfg.models.tier == DEFAULT_TIER
assert cfg.models.target_lang == "ko"
assert cfg.subtitle.font_size > 0
assert cfg.audio.silence_ms > 0
def test_save_load_roundtrip(tmp_path):
path = tmp_path / "config.json"
cfg = AppConfig()
cfg.subtitle.font_size = 52
cfg.subtitle.text_color = "#FF00AA"
cfg.models.tier = "precision"
cfg.audio.target_pid = 4242
cfg.save(path)
loaded = AppConfig.load(path)
assert loaded.subtitle.font_size == 52
assert loaded.subtitle.text_color == "#FF00AA"
assert loaded.models.tier == "precision"
assert loaded.audio.target_pid == 4242
def test_missing_file_gives_defaults(tmp_path):
assert AppConfig.load(tmp_path / "nope.json").models.tier == DEFAULT_TIER
def test_corrupt_file_gives_defaults(tmp_path):
path = tmp_path / "config.json"
path.write_text("{ this is not json", encoding="utf-8")
assert AppConfig.load(path).models.tier == DEFAULT_TIER
def test_unknown_keys_are_ignored_and_missing_keys_defaulted(tmp_path):
"""스키마가 바뀌어도 사용자의 기존 설정이 깨지면 안 된다."""
path = tmp_path / "config.json"
path.write_text(
json.dumps(
{
"theme": "light",
"removed_option": True,
"subtitle": {"font_size": 40, "gone_field": 1},
}
),
encoding="utf-8",
)
cfg = AppConfig.load(path)
assert cfg.theme == "light"
assert cfg.subtitle.font_size == 40
assert cfg.subtitle.bold is True # 기본값 유지
assert not hasattr(cfg, "removed_option")