blob: 88cd5d8e21d40d283a769510e9f291b728e0570b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
from dataclasses import dataclass
from enum import Enum
from typing import Any, TYPE_CHECKING, Dict
from ..hardware import SysInfo
from ..output import info
from ...default_profiles.applications.pipewire import PipewireProfile
if TYPE_CHECKING:
_: Any
@dataclass
class Audio(Enum):
Pipewire = 'pipewire'
Pulseaudio = 'pulseaudio'
@staticmethod
def no_audio_text() -> str:
return str(_('No audio server'))
@dataclass
class AudioConfiguration:
audio: Audio
def json(self) -> Dict[str, Any]:
return {
'audio': self.audio.value
}
@staticmethod
def parse_arg(arg: Dict[str, Any]) -> 'AudioConfiguration':
return AudioConfiguration(
Audio(arg['audio'])
)
def install_audio_config(
self,
installation: Any
):
info(f'Installing audio server: {self.audio.name}')
match self.audio:
case Audio.Pipewire:
PipewireProfile().install(installation)
case Audio.Pulseaudio:
installation.add_additional_packages("pulseaudio")
if SysInfo.requires_sof_fw():
installation.add_additional_packages('sof-firmware')
if SysInfo.requires_alsa_fw():
installation.add_additional_packages('alsa-firmware')
|