summaryrefslogtreecommitdiffstats
path: root/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/30-alsa-monitor.lua
blob: fd6b7ecb5d9689d07c830c21b8faf4391ebdf840 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
-- ALSA monitor config file --

alsa_monitor = {}

alsa_monitor.properties = {
  ["alsa.jack-device"] = false,
  ["alsa.reserve"] = false,
}

alsa_monitor.rules = {
  -- disable ACP (PulseAudio-like profiles)
  {
    matches = {
      {
        { "device.name", "matches", "alsa_card.*" },
      },
    },
    apply_properties = {
      ["api.alsa.use-acp"] = false,
    },
  },

  --
  -- Bump priority of well-known output devices
  -- Higher priority means it gets selected as the default if it's present
  --

  -- USB card
  {
    matches = {
      {
        { "node.name", "matches", "alsa_output.*" },
        { "api.alsa.card.driver", "=", "USB-Audio" },
      },
    },
    apply_properties = {
      ["priority.driver"]        = 1300,
      ["priority.session"]       = 1300,
    }
  },

  -- fiberdyne amp
  {
    matches = {
      {
        { "node.name", "matches", "alsa_output.*" },
        { "api.alsa.card.id", "=", "ep016ch" },
      },
    },
    apply_properties = {
      ["priority.driver"]        = 1200,
      ["priority.session"]       = 1200,
    }
  },

  -- well-known internal devices
  {
    matches = {
      {
        -- ak4613
        { "node.name", "matches", "alsa_output.*" },
        { "api.alsa.card.id", "=", "ak4613" },
        { "api.alsa.pcm.device", "=", "0" },
      },
      {
        -- dra7xx
        { "node.name", "matches", "alsa_output.*" },
        { "api.alsa.card.id", "=", "DRA7xx-EVM" },
      },
      {
        -- imx8mq
        { "node.name", "matches", "alsa_output.*" },
        { "api.alsa.card.id", "=", "wm8524audio" },
      },
      {
        -- rcarsound
        { "node.name", "matches", "alsa_output.*" },
        { "api.alsa.card.id", "=", "rcarsound" },
        { "api.alsa.pcm.device", "=", "0" },
      },
      {
        -- rpi3
        { "node.name", "matches", "alsa_output.*" },
        { "api.alsa.pcm.name", "=", "bcm2835 ALSA" },
      },
    },
    apply_properties = {
      ["priority.driver"]        = 1100,
      ["priority.session"]       = 1100,
    }
  },

  --
  -- Same for input devices
  --

  -- USB card
  {
    matches = {
      {
        { "node.name", "matches", "alsa_input.*" },
        { "api.alsa.card.driver", "=", "USB-Audio" },
      },
    },
    apply_properties = {
      ["priority.driver"]        = 2300,
      ["priority.session"]       = 2300,
    }
  },

  -- microchip mic
  {
    matches = {
      {
        { "node.name", "matches", "alsa_input.*" },
        { "api.alsa.card.id", "=", "ep811ch" },
      },
    },
    apply_properties = {
      ["priority.driver"]        = 2200,
      ["priority.session"]       = 2200,
    }
  },

  -- well-known internal devices
  {
    matches = {
      {
        -- ak4613
        { "node.name", "matches", "alsa_input.*" },
        { "api.alsa.card.id", "=", "ak4613" },
      },
      {
        -- dra7xx
        { "node.name", "matches", "alsa_input.*" },
        { "api.alsa.card.id", "=", "DRA7xx-EVM" },
      },
      {
        -- imx8mq
        { "node.name", "matches", "alsa_input.*" },
        { "api.alsa.card.id", "=", "wm8524audio" },
      },
      {
        -- rcarsound
        { "node.name", "matches", "alsa_input.*" },
        { "api.alsa.card.id", "=", "rcarsound" },
      },
    },
    apply_properties = {
      ["priority.driver"]        = 2100,
      ["priority.session"]       = 2100,
    }
  },
}

function alsa_monitor.enable()
  load_monitor("alsa", {
    properties = alsa_monitor.properties,
    rules = alsa_monitor.rules,
  })
end