feat(04-04): wire audio and speech into lesson, reward, forest, and app

- playCorrectSound() on correct keypress in letter and word exercises
- playRewardSound() when reward image appears
- speakText() for companion comment on reward screen
- playForestElementSound() when new forest element renders
- speakText() for companion greeting on forest screen

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 18:22:40 +02:00
co-authored by Claude Opus 4.6
parent a55238f1f9
commit b453efebb4
4 changed files with 20 additions and 9 deletions
+9 -7
View File
@@ -1,11 +1,12 @@
import type { ScreenName } from "./types";
import { openDB, getProgress, saveProgress } from "./storage/db";
import { initWelcomeScreen, initLessonScreen } from "./ui/screens";
import { initForestScreen, renderForestScene } from "./forest/scene";
import { startPreGeneration, initRewardScreen } from "./forest/reward";
import { getGreeting } from "./companion/companion";
import { speakText } from "./audio/speech";
import { companions } from "./companion/characters";
import { showParentCodePrompt, initParentScreen } from "./ui/parent";
import { getGreeting } from "./companion/companion";
import { initRewardScreen, startPreGeneration } from "./forest/reward";
import { initForestScreen, renderForestScene } from "./forest/scene";
import { getProgress, openDB, saveProgress } from "./storage/db";
import type { ScreenName } from "./types";
import { initParentScreen, showParentCodePrompt } from "./ui/parent";
import { initLessonScreen, initWelcomeScreen } from "./ui/screens";
let db: IDBDatabase;
let lessonCleanup: (() => void) | null = null;
@@ -215,6 +216,7 @@ export async function initApp(): Promise<void> {
// Fetch greeting async (shows immediately with avatar, text fills in)
getGreeting(progress.selectedCharacter, db).then((text) => {
textEl.textContent = text;
speakText(text);
});
}
} else {