Replace wpctl volume control with SDL_mixer VolumeMusic
Remove all PipeWire/wpctl system calls (SetDefaultSinkVolume, listSinkIDs, listSinks, SetAllSinkVolumes, parseSinks, parseSinkLine, Sink struct). Volume is now managed entirely through SDL_mixer's VolumeMusic(), making audio fully system-agnostic. Changes: - mixer.go: delete ~170 lines of wpctl code; add SetVolume() public API using mix.VolumeMusic(math.Round(level * MAX_VOLUME)) - Init/Play/SwitchDevice set volume inline (they already hold the mutex) - Play() now uses stored currentVolume instead of hardcoded MAX_VOLUME - AudioOptions: SetAllSinkVolumes -> SetVolume - mixer_test.go: add TestSetVolume (validation + error path coverage)
This commit is contained in:
@@ -333,8 +333,8 @@ func (p *AudioOptions) UpdateVolume(level int) {
|
||||
}
|
||||
config.SavedVolume = newVol
|
||||
p.Context.DbPtr.Save(&config)
|
||||
if err := mixer.SetAllSinkVolumes(newVol); err != nil {
|
||||
logger.Error("Error setting allSinkVolumes: %v", err)
|
||||
if err := mixer.SetVolume(newVol); err != nil {
|
||||
logger.Error("Error setting volume: %v", err)
|
||||
}
|
||||
if err := p.CreateVolumePercentItem(); err != nil {
|
||||
logger.Error("failed to refresh volume percent item: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user