@@ -5,9 +5,9 @@ import * as SoundController from "./sound-controller";
55
66let voice : SpeechSynthesisUtterance | undefined ;
77let isInitialized = false ;
8- let isSpeaking = false ;
9- let currentWordIndex = - 1 ;
10- let totalWords = 0 ;
8+ let _isSpeaking = false ;
9+ let _currentWordIndex = - 1 ;
10+ let _totalWords = 0 ;
1111
1212// Audio oscillator for additional feedback
1313let audioContext : AudioContext | undefined ;
@@ -33,22 +33,22 @@ export async function init(): Promise<void> {
3333 await initAudioContext ( ) ;
3434
3535 isInitialized = true ;
36- currentWordIndex = - 1 ;
37- totalWords = 0 ;
36+ _currentWordIndex = - 1 ;
37+ _totalWords = 0 ;
3838}
3939
4040export function clear ( ) : void {
4141 window . speechSynthesis . cancel ( ) ;
4242 voice = undefined ;
4343 isInitialized = false ;
44- isSpeaking = false ;
45- currentWordIndex = - 1 ;
46- totalWords = 0 ;
44+ _isSpeaking = false ;
45+ _currentWordIndex = - 1 ;
46+ _totalWords = 0 ;
4747}
4848
4949export function stop ( ) : void {
5050 window . speechSynthesis . cancel ( ) ;
51- isSpeaking = false ;
51+ _isSpeaking = false ;
5252}
5353
5454async function speak ( text : string , rate ?: number ) : Promise < void > {
@@ -60,13 +60,13 @@ async function speak(text: string, rate?: number): Promise<void> {
6060 voice . text = text ;
6161 voice . rate = rate ?? Config . blindModeSpeechRate ;
6262
63- isSpeaking = true ;
63+ _isSpeaking = true ;
6464
6565 window . speechSynthesis . speak ( voice ) ;
6666
6767 // Wait for speech to end
6868 voice . onend = ( ) => {
69- isSpeaking = false ;
69+ _isSpeaking = false ;
7070 } ;
7171}
7272
@@ -133,7 +133,7 @@ export async function announceNextWord(word: string, wordIndex: number): Promise
133133 if ( Config . blindModeAudioFeedback === "off" ) return ;
134134 if ( ! Config . blindMode ) return ;
135135
136- currentWordIndex = wordIndex ;
136+ _currentWordIndex = wordIndex ;
137137
138138 if ( Config . blindModeAudioFeedback === "full" ) {
139139 // In full mode, speak each word
@@ -192,7 +192,7 @@ export async function announceWordCompletion(isCorrect: boolean): Promise<void>
192192export async function announceTestStart (
193193 mode : string ,
194194 value : number ,
195- language : string
195+ _language : string
196196) : Promise < void > {
197197 if ( Config . blindModeAudioFeedback === "off" ) return ;
198198 if ( ! Config . blindMode ) return ;
@@ -201,7 +201,7 @@ export async function announceTestStart(
201201 if ( mode === "time" ) {
202202 await speak ( `${ value } second test starting` ) ;
203203 } else if ( mode === "words" ) {
204- totalWords = value ;
204+ _totalWords = value ;
205205 await speak ( `${ value } word test starting` ) ;
206206 } else {
207207 await speak ( "Test starting" ) ;
@@ -228,19 +228,20 @@ export async function announceTestComplete(
228228 } else if ( Config . blindModeAudioFeedback === "minimal" ) {
229229 // Play a completion sound sequence
230230 if ( audioContext ) {
231+ const ctx = audioContext ;
231232 const playNote = ( freq : number , delay : number ) : void => {
232233 setTimeout ( ( ) => {
233- const oscillator = audioContext . createOscillator ( ) ;
234- const gainNode = audioContext . createGain ( ) ;
234+ const oscillator = ctx . createOscillator ( ) ;
235+ const gainNode = ctx . createGain ( ) ;
235236
236237 oscillator . connect ( gainNode ) ;
237- gainNode . connect ( audioContext . destination ) ;
238+ gainNode . connect ( ctx . destination ) ;
238239
239240 oscillator . frequency . value = freq ;
240241 gainNode . gain . value = 0.15 * Config . soundVolume ;
241242
242243 oscillator . start ( ) ;
243- oscillator . stop ( audioContext . currentTime + 0.15 ) ;
244+ oscillator . stop ( ctx . currentTime + 0.15 ) ;
244245 } , delay ) ;
245246 } ;
246247
@@ -264,7 +265,7 @@ export async function announceTimeWarning(secondsLeft: number): Promise<void> {
264265 }
265266
266267 // Always play the time warning sound
267- SoundController . playTimeWarning ( ) ;
268+ void SoundController . playTimeWarning ( ) ;
268269}
269270
270271/**
0 commit comments