abaddon icon indicating copy to clipboard operation
abaddon copied to clipboard

Refactor audio handling

Open ryze312 opened this issue 3 months ago • 44 comments

Hey, here is another PR from me! Made a few changes to audio handling and cleaned up some of the code. In particular audio devices get started/stopped on demand upon entering voice call. This allows audio backends like PipeWire to suspend sinks when they there isn't anything active connected to them.

AudioManager:

  • Audio devices get started/stopped on voice connect/disconnect
  • Reduce code duplication with Open/TryOpen functions
  • Don't store device configs and ids

AudioDevices:

  • Rename [Get/Set]ActivePlaybackDevice to [Get/Set]ActivePlaybackDeviceIter
  • Declare getters as const and [[nodiscard]]
  • Reduce code duplication by using Get[Playback/Capture]DeviceIDFromModel
  • Add GetActive[Playback/Capture]

TODO:

  • [x] Start/stop voice audio devices on demand
  • [x] Move notification sounds handling to SystemAudio
  • [x] Start/stop notification audio device after timeout as well
  • [x] Split voice audio into multiple devices per user
  • [x] Add options for persistent audio devices and split voice audio

ryze312 avatar Mar 08 '24 13:03 ryze312