25 lines
773 B
Go
25 lines
773 B
Go
// Copyright (c) 2026 Storm Dragon
|
|
// Authors: Storm Dragon, Angus Kola
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package sound
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
var speechBeepWAV = tone_wav(440, 40*time.Millisecond, 0.35, 5*time.Millisecond)
|
|
|
|
// SpeechBeep replaces an utterance, independently of role-sound enablement or
|
|
// theme availability. The speech worker owns its ordering and cancellation;
|
|
// sound preferences still supply the output sink and volume.
|
|
func (service *Service) SpeechBeep(ctx context.Context) error {
|
|
service.mutex.Lock()
|
|
player, volume := service.player, service.volume
|
|
service.mutex.Unlock()
|
|
beepContext, cancelBeep := context.WithTimeout(ctx, 3*time.Second)
|
|
defer cancelBeep()
|
|
return player.Play(beepContext, speechBeepWAV, volume, 0)
|
|
}
|