diff options
-rw-r--r-- | bragi.nix | 8 | ||||
m--------- | custom/trivmix | 0 | ||||
-rw-r--r-- | custom/trivmix-service.nix | 17 |
3 files changed, 20 insertions, 5 deletions
@@ -210,11 +210,11 @@ in rec { | |||
210 | "outnode0" = { initial = "1"; adjustable = false; }; | 210 | "outnode0" = { initial = "1"; adjustable = false; }; |
211 | "outnode1" = { initial = "1"; adjustable = false; }; | 211 | "outnode1" = { initial = "1"; adjustable = false; }; |
212 | 212 | ||
213 | "headphones0" = { connectOut = "system:playback_3"; connectIn = "outnode0:out"; group = "headphones"; initial = "1"; }; | 213 | "headphones0" = { connectOut = "system:playback_3"; connectIn = "outnode0:out"; group = "headphones"; initial = "1"; balance = "right"; }; |
214 | "headphones1" = { connectOut = "system:playback_4"; connectIn = "outnode1:out"; group = "headphones"; initial = "1"; }; | 214 | "headphones1" = { connectOut = "system:playback_4"; connectIn = "outnode1:out"; group = "headphones"; initial = "1"; balance = "left"; }; |
215 | 215 | ||
216 | "speakers0" = { connectOut = "system:playback_7"; connectIn = "outnode0:out"; group = "speakers"; initial = "0"; }; | 216 | "speakers0" = { connectOut = "system:playback_7"; connectIn = "outnode0:out"; group = "speakers"; initial = "0"; balance = "right"; }; |
217 | "speakers1" = { connectOut = "system:playback_8"; connectIn = "outnode1:out"; group = "speakers"; initial = "0"; }; | 217 | "speakers1" = { connectOut = "system:playback_8"; connectIn = "outnode1:out"; group = "speakers"; initial = "0"; balance = "left"; }; |
218 | }; | 218 | }; |
219 | 219 | ||
220 | services.mpd = { | 220 | services.mpd = { |
diff --git a/custom/trivmix b/custom/trivmix | |||
Subproject 31a88f4dd0800caeeb56d785b1876a9c2b88fb9 | Subproject 72dfd7bdb13e71c04604c0458582960259ec8fb | ||
diff --git a/custom/trivmix-service.nix b/custom/trivmix-service.nix index 9ebf02f1..f2d549fe 100644 --- a/custom/trivmix-service.nix +++ b/custom/trivmix-service.nix | |||
@@ -39,6 +39,18 @@ let | |||
39 | description = "Volumes of mixers that share a group name are synchronised"; | 39 | description = "Volumes of mixers that share a group name are synchronised"; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | balance = mkOption { | ||
43 | type = types.nullOr types.str; | ||
44 | default = null; | ||
45 | description = "Volumes of mixers are multiplied with their balances, this is the name of the file that contains the factor for this mixer"; | ||
46 | }; | ||
47 | |||
48 | initialBalance = mkOption { | ||
49 | type = types.str; | ||
50 | default = "1"; | ||
51 | description = "Initial balance"; | ||
52 | }; | ||
53 | |||
42 | initial = mkOption { | 54 | initial = mkOption { |
43 | type = types.str; | 55 | type = types.str; |
44 | default = "1"; | 56 | default = "1"; |
@@ -60,8 +72,11 @@ let | |||
60 | 72 | ||
61 | mixerDeps = filter (x: any (hasPrefix (x + ":")) connectIn || any (hasPrefix (x + ":")) connectOut) (attrNames cfg); | 73 | mixerDeps = filter (x: any (hasPrefix (x + ":")) connectIn || any (hasPrefix (x + ":")) connectOut) (attrNames cfg); |
62 | 74 | ||
63 | trivmixArgs = [ "--client" name "--level" initial ] | 75 | trivmixArgs = let |
76 | dirName = if isNull group then name else group; | ||
77 | in [ "--client" name "--level" initial "--initial-balance" initialBalance] | ||
64 | ++ optionals connect ["--run" connectScript] | 78 | ++ optionals connect ["--run" connectScript] |
79 | ++ optionals (adjustable && (! isNull balance)) ["--balance" "/dev/shm/mix/${dirName}/${balance}"] | ||
65 | ++ optional (adjustable && isNull group) "/dev/shm/mix/${name}/level" | 80 | ++ optional (adjustable && isNull group) "/dev/shm/mix/${name}/level" |
66 | ++ optional (! isNull group) "/dev/shm/mix/${group}/level"; | 81 | ++ optional (! isNull group) "/dev/shm/mix/${group}/level"; |
67 | in { | 82 | in { |