Initial public release of JustOneCacophony

This commit is contained in:
TheM14 committed 2026-09-01 16:31:38 +08:00
commit aa3a519f79
38 files changed
+9073

No files matched your search

+764
View File
@@ -0,0 +1,764 @@
"""Standard speaker-layout geometry used by the spatial renderer.
Coordinates are unsigned Q15 room coordinates. This is geometry/topology data,
not a sampled gain table.
"""
from __future__ import annotations
from dataclasses import dataclass
@dataclass(frozen=True)
class RegionGeometry:
coordinates_q15: tuple[tuple[int, int, int], ...]
speaker_ids: tuple[int, ...]
axis0_groups: tuple[tuple[int, ...], ...]
axis1_groups: tuple[tuple[int, ...], ...]
mode: int
@dataclass(frozen=True)
class SpeakerLayout:
name: str
out_ch_config: int
speaker_bitfield: int
channels: tuple[str, ...]
internal_to_standard: tuple[int, ...]
regions: tuple[RegionGeometry, ...]
@property
def channel_count(self) -> int:
return len(self.channels)
_RAW_LAYOUTS = {'20': {'out_ch_config': 0,
'speaker_bitfield': 1,
'channels': ('L', 'R'),
'internal_to_standard': (0, 1),
'regions': ({'coordinates_q15': ((0, 0, 0), (32767, 0, 0)),
'speaker_ids': (0, 1),
'axis0_groups': ((0, 1),),
'axis1_groups': (),
'mode': 1},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0)),
'speaker_ids': (0, 1),
'axis0_groups': ((0, 1),),
'axis1_groups': (),
'mode': 1},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0)),
'speaker_ids': (0, 1),
'axis0_groups': ((0, 1),),
'axis1_groups': (),
'mode': 1},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0)),
'speaker_ids': (0, 1),
'axis0_groups': ((0, 1),),
'axis1_groups': (),
'mode': 1},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0)),
'speaker_ids': (0, 1),
'axis0_groups': ((0, 1),),
'axis1_groups': (),
'mode': 1},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0)),
'speaker_ids': (0, 1),
'axis0_groups': ((0, 1),),
'axis1_groups': (),
'mode': 1},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0)),
'speaker_ids': (0, 1),
'axis0_groups': ((0, 1),),
'axis1_groups': (),
'mode': 1})},
'31': {'out_ch_config': 3,
'speaker_bitfield': 7,
'channels': ('L', 'R', 'C', 'LFE'),
'internal_to_standard': (0, 1, 2, 3),
'regions': ({'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0)),
'speaker_ids': (0, 1, 2),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': (),
'mode': 1},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0)),
'speaker_ids': (0, 1, 2),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': (),
'mode': 1},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0)),
'speaker_ids': (0, 1, 2),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': (),
'mode': 1},
{'coordinates_q15': ((16384, 0, 0),),
'speaker_ids': (2,),
'axis0_groups': ((0,),),
'axis1_groups': (),
'mode': 1},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0)),
'speaker_ids': (0, 1, 2),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': (),
'mode': 1},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0)),
'speaker_ids': (0, 1, 2),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': (),
'mode': 1},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0)),
'speaker_ids': (0, 1, 2),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': (),
'mode': 1})},
'51': {'out_ch_config': 7,
'speaker_bitfield': 15,
'channels': ('L', 'R', 'C', 'LFE', 'Ls', 'Rs'),
'internal_to_standard': (0, 1, 2, 3, 4, 5),
'regions': ({'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0), (0, 32767, 0), (32767, 32767, 0)),
'speaker_ids': (0, 1, 2, 4, 5),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': (),
'mode': 2},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0), (0, 32767, 0), (32767, 32767, 0)),
'speaker_ids': (0, 1, 2, 4, 5),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': (),
'mode': 2},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0), (0, 32767, 0), (32767, 32767, 0)),
'speaker_ids': (0, 1, 2, 4, 5),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': (),
'mode': 2},
{'coordinates_q15': ((16384, 0, 0), (0, 32767, 0), (32767, 32767, 0)),
'speaker_ids': (2, 4, 5),
'axis0_groups': ((0,), (1, 2)),
'axis1_groups': (),
'mode': 2},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0)),
'speaker_ids': (0, 1, 2),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': (),
'mode': 1},
{'coordinates_q15': ((0, 32767, 0), (32767, 32767, 0)),
'speaker_ids': (4, 5),
'axis0_groups': ((0, 1),),
'axis1_groups': (),
'mode': 1},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0)),
'speaker_ids': (0, 1, 2),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': (),
'mode': 1})},
'71': {'out_ch_config': 11,
'speaker_bitfield': 31,
'channels': ('L', 'R', 'C', 'LFE', 'Ls', 'Rs', 'Lrs', 'Rrs'),
'internal_to_standard': (0, 1, 2, 3, 6, 7, 4, 5),
'regions': ({'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0)),
'speaker_ids': (0, 1, 2, 4, 5, 6, 7),
'axis0_groups': ((0, 2, 1), (3, 4), (5, 6)),
'axis1_groups': (),
'mode': 2},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0), (0, 16384, 0), (32767, 16384, 0)),
'speaker_ids': (0, 1, 2, 4, 5),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': (),
'mode': 2},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0), (0, 32767, 0), (32767, 32767, 0)),
'speaker_ids': (0, 1, 2, 6, 7),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': (),
'mode': 2},
{'coordinates_q15': ((16384, 0, 0), (0, 32767, 0), (32767, 32767, 0)),
'speaker_ids': (2, 6, 7),
'axis0_groups': ((0,), (1, 2)),
'axis1_groups': (),
'mode': 2},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0)),
'speaker_ids': (0, 1, 2),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': (),
'mode': 1},
{'coordinates_q15': ((0, 16384, 0), (32767, 16384, 0), (0, 32767, 0), (32767, 32767, 0)),
'speaker_ids': (4, 5, 6, 7),
'axis0_groups': ((0, 1), (2, 3)),
'axis1_groups': (),
'mode': 2},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0)),
'speaker_ids': (0, 1, 2),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': (),
'mode': 1})},
'512': {'out_ch_config': 13,
'speaker_bitfield': 1039,
'channels': ('L', 'R', 'C', 'LFE', 'Ls', 'Rs', 'Ltm', 'Rtm'),
'internal_to_standard': (0, 1, 2, 3, 4, 5, 6, 7),
'regions': ({'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 6, 7),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': ((5, 6),),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 6, 7),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': ((5, 6),),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 6, 7),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': ((5, 6),),
'mode': 3},
{'coordinates_q15': ((16384, 0, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (2, 4, 5, 6, 7),
'axis0_groups': ((0,), (1, 2)),
'axis1_groups': ((3, 4),),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (0, 1, 2, 6, 7),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': ((3, 4),),
'mode': 3},
{'coordinates_q15': ((0, 32767, 0),
(32767, 32767, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (4, 5, 6, 7),
'axis0_groups': ((0, 1),),
'axis1_groups': ((2, 3),),
'mode': 3},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0)),
'speaker_ids': (0, 1, 2),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': (),
'mode': 1})},
'514': {'out_ch_config': 14,
'speaker_bitfield': 2575,
'channels': ('L', 'R', 'C', 'LFE', 'Ls', 'Rs', 'Ltf', 'Rtf', 'Ltr', 'Rtr'),
'internal_to_standard': (0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
'regions': ({'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 6, 7, 8, 9),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': ((5, 6), (7, 8)),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 6, 7, 8, 9),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': ((5, 6), (7, 8)),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 6, 7, 8, 9),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': ((5, 6), (7, 8)),
'mode': 3},
{'coordinates_q15': ((16384, 0, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (2, 4, 5, 6, 7, 8, 9),
'axis0_groups': ((0,), (1, 2)),
'axis1_groups': ((3, 4), (5, 6)),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (0, 1, 2, 6, 7, 8, 9),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': ((3, 4), (5, 6)),
'mode': 3},
{'coordinates_q15': ((0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (4, 5, 6, 7, 8, 9),
'axis0_groups': ((0, 1),),
'axis1_groups': ((2, 3), (4, 5)),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(7928, 7928, 32767),
(24840, 7928, 32767)),
'speaker_ids': (0, 1, 2, 6, 7),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': ((3, 4),),
'mode': 3})},
'712': {'out_ch_config': 15,
'speaker_bitfield': 1055,
'channels': ('L', 'R', 'C', 'LFE', 'Ls', 'Rs', 'Lrs', 'Rrs', 'Ltm', 'Rtm'),
'internal_to_standard': (0, 1, 2, 3, 6, 7, 4, 5, 8, 9),
'regions': ({'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 6, 7, 8, 9),
'axis0_groups': ((0, 2, 1), (3, 4), (5, 6)),
'axis1_groups': ((7, 8),),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 8, 9),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': ((5, 6),),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (0, 1, 2, 6, 7, 8, 9),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': ((5, 6),),
'mode': 3},
{'coordinates_q15': ((16384, 0, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (2, 6, 7, 8, 9),
'axis0_groups': ((0,), (1, 2)),
'axis1_groups': ((3, 4),),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (0, 1, 2, 8, 9),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': ((3, 4),),
'mode': 3},
{'coordinates_q15': ((0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (4, 5, 6, 7, 8, 9),
'axis0_groups': ((0, 1), (2, 3)),
'axis1_groups': ((4, 5),),
'mode': 3},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0)),
'speaker_ids': (0, 1, 2),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': (),
'mode': 1})},
'714': {'out_ch_config': 16,
'speaker_bitfield': 2591,
'channels': ('L', 'R', 'C', 'LFE', 'Ls', 'Rs', 'Lrs', 'Rrs', 'Ltf', 'Rtf', 'Ltr', 'Rtr'),
'internal_to_standard': (0, 1, 2, 3, 6, 7, 4, 5, 8, 9, 10, 11),
'regions': ({'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11),
'axis0_groups': ((0, 2, 1), (3, 4), (5, 6)),
'axis1_groups': ((7, 8), (9, 10)),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 8, 9, 10, 11),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': ((5, 6), (7, 8)),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (0, 1, 2, 6, 7, 8, 9, 10, 11),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': ((5, 6), (7, 8)),
'mode': 3},
{'coordinates_q15': ((16384, 0, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (2, 6, 7, 8, 9, 10, 11),
'axis0_groups': ((0,), (1, 2)),
'axis1_groups': ((3, 4), (5, 6)),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (0, 1, 2, 8, 9, 10, 11),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': ((3, 4), (5, 6)),
'mode': 3},
{'coordinates_q15': ((0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (4, 5, 6, 7, 8, 9, 10, 11),
'axis0_groups': ((0, 1), (2, 3)),
'axis1_groups': ((4, 5), (6, 7)),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(7928, 7928, 32767),
(24840, 7928, 32767)),
'speaker_ids': (0, 1, 2, 8, 9),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': ((3, 4),),
'mode': 3})},
'914': {'out_ch_config': 19,
'speaker_bitfield': 2719,
'channels': ('L', 'R', 'C', 'LFE', 'Ls', 'Rs', 'Lrs', 'Rrs', 'Lw', 'Rw', 'Ltf', 'Rtf', 'Ltr', 'Rtr'),
'internal_to_standard': (0, 1, 2, 3, 6, 7, 4, 5, 10, 11, 12, 13, 8, 9),
'regions': ({'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0),
(0, 5285, 0),
(32767, 5285, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13),
'axis0_groups': ((0, 2, 1), (7, 8), (3, 4), (5, 6)),
'axis1_groups': ((9, 10), (11, 12)),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(0, 5285, 0),
(32767, 5285, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 8, 9, 10, 11, 12, 13),
'axis0_groups': ((0, 2, 1), (5, 6), (3, 4)),
'axis1_groups': ((7, 8), (9, 10)),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (0, 1, 2, 6, 7, 10, 11, 12, 13),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': ((5, 6), (7, 8)),
'mode': 3},
{'coordinates_q15': ((16384, 0, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (2, 6, 7, 10, 11, 12, 13),
'axis0_groups': ((0,), (1, 2)),
'axis1_groups': ((3, 4), (5, 6)),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (0, 1, 2, 10, 11, 12, 13),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': ((3, 4), (5, 6)),
'mode': 3},
{'coordinates_q15': ((0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (4, 5, 6, 7, 10, 11, 12, 13),
'axis0_groups': ((0, 1), (2, 3)),
'axis1_groups': ((4, 5), (6, 7)),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 5285, 0),
(32767, 5285, 0),
(7928, 7928, 32767),
(24840, 7928, 32767)),
'speaker_ids': (0, 1, 2, 8, 9, 10, 11),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': ((5, 6),),
'mode': 3})},
'916': {'out_ch_config': 20,
'speaker_bitfield': 3743,
'channels': ('L',
'R',
'C',
'LFE',
'Ls',
'Rs',
'Lrs',
'Rrs',
'Lw',
'Rw',
'Ltf',
'Rtf',
'Ltm',
'Rtm',
'Ltr',
'Rtr'),
'internal_to_standard': (0, 1, 2, 3, 6, 7, 4, 5, 10, 11, 14, 15, 12, 13, 8, 9),
'regions': ({'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0),
(0, 5285, 0),
(32767, 5285, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 16384, 32767),
(24840, 16384, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15),
'axis0_groups': ((0, 2, 1), (7, 8), (3, 4), (5, 6)),
'axis1_groups': ((9, 10), (11, 12), (13, 14)),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(0, 5285, 0),
(32767, 5285, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 16384, 32767),
(24840, 16384, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15),
'axis0_groups': ((0, 2, 1), (5, 6), (3, 4)),
'axis1_groups': ((7, 8), (9, 10), (11, 12)),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 16384, 32767),
(24840, 16384, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (0, 1, 2, 6, 7, 10, 11, 12, 13, 14, 15),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': ((5, 6), (7, 8), (9, 10)),
'mode': 3},
{'coordinates_q15': ((16384, 0, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 16384, 32767),
(24840, 16384, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (2, 6, 7, 10, 11, 12, 13, 14, 15),
'axis0_groups': ((0,), (1, 2)),
'axis1_groups': ((3, 4), (5, 6), (7, 8)),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 16384, 32767),
(24840, 16384, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (0, 1, 2, 10, 11, 12, 13, 14, 15),
'axis0_groups': ((0, 2, 1),),
'axis1_groups': ((3, 4), (5, 6), (7, 8)),
'mode': 3},
{'coordinates_q15': ((0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 16384, 32767),
(24840, 16384, 32767),
(7928, 24840, 32767),
(24840, 24840, 32767)),
'speaker_ids': (4, 5, 6, 7, 10, 11, 12, 13, 14, 15),
'axis0_groups': ((0, 1), (2, 3)),
'axis1_groups': ((4, 5), (6, 7), (8, 9)),
'mode': 3},
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 5285, 0),
(32767, 5285, 0),
(7928, 7928, 32767),
(24840, 7928, 32767)),
'speaker_ids': (0, 1, 2, 8, 9, 10, 11),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': ((5, 6),),
'mode': 3})}}
def _make_layout(name: str, item: dict) -> SpeakerLayout:
return SpeakerLayout(
name=name,
out_ch_config=item["out_ch_config"],
speaker_bitfield=item["speaker_bitfield"],
channels=item["channels"],
internal_to_standard=item["internal_to_standard"],
regions=tuple(RegionGeometry(**region) for region in item["regions"]),
)
SPEAKER_LAYOUTS = {name: _make_layout(name, item) for name, item in _RAW_LAYOUTS.items()}
SPEAKER_LAYOUT_ALIASES = {
"2.0": "20",
"3.1": "31",
"5.1": "51",
"7.1": "71",
"5.1.2": "512",
"5.1.4": "514",
"7.1.2": "712",
"7.1.4": "714",
"9.1.4": "914",
"9.1.6": "916",
}
SPEAKER_LAYOUT_CHOICES = tuple(SPEAKER_LAYOUT_ALIASES)
SPEAKER_LAYOUT_DISPLAY_NAMES = {value: key for key, value in SPEAKER_LAYOUT_ALIASES.items()}
def get_speaker_layout(name: str) -> SpeakerLayout:
key = SPEAKER_LAYOUT_ALIASES.get(name, name)
try:
return SPEAKER_LAYOUTS[key]
except KeyError as exc:
raise ValueError(f"unsupported speaker layout: {name}") from exc
def speaker_layout_display_name(layout: str | SpeakerLayout) -> str:
target = get_speaker_layout(layout) if isinstance(layout, str) else layout
return SPEAKER_LAYOUT_DISPLAY_NAMES[target.name]