MCPcopy Create free account
hub / github.com/efogdev/mpris-timer / LoadSound

Function LoadSound

internal/core/sound.go:18–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16var sound []byte
17
18func LoadSound() error {
19 if Overrides.SoundFilename == "" {
20 log.Println("default sound init requested")
21 sound = defaultSound
22 return nil
23 }
24
25 log.Printf("custom sound requested: %s", Overrides.SoundFilename)
26 file, err := os.Open(Overrides.SoundFilename)
27 if err != nil {
28 return err
29 }
30
31 sound, err = io.ReadAll(file)
32 if err != nil {
33 return err
34 }
35
36 return nil
37}
38
39func PlaySound() error {
40 dec, err := mp3.NewDecoder(bytes.NewReader(sound))

Callers 2

mainFunction · 0.92
SetSoundFilenameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected