MCPcopy Create free account
hub / github.com/SolarLune/masterplan / UpdateVolume

Method UpdateVolume

sound.go:89–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

87}
88
89func (sound *Sound) UpdateVolume() {
90 speaker.Lock()
91
92 var v float64
93 switch sound.channel {
94 case AudioChannelSoundCard:
95 v = globals.Settings.Get(SettingsAudioSoundVolume).AsFloat()
96 case AudioChannelUI:
97 v = globals.Settings.Get(SettingsAudioUIVolume).AsFloat()
98 }
99
100 if v > 0 {
101 sound.volume.Silent = false
102 sound.volume.Volume = v - 1
103 } else {
104 sound.volume.Silent = true
105 }
106
107 speaker.Unlock()
108}
109
110func (sound *Sound) Play() {
111

Callers 3

ReloadStreamMethod · 0.95
ReceiveMessageMethod · 0.80
ReceiveMessageMethod · 0.80

Calls 2

AsFloatMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected