firewire_bebob_protocols/terratec/
aureon.rs

1// SPDX-License-Identifier: LGPL-3.0-or-later
2// Copyright (c) 2021 Takashi Sakamoto
3
4//! Protocol implementation for Terratec Aureon 7.1 FW.
5//!
6//! The module includes structure, enumeration, and trait and its implementation for protocol
7//! defined by Terratec for Aureon 7.1 FW.
8//!
9//! ## Diagram of internal signal flow
10//!
11//! ```text
12//! analog-input-1/2 ----------+
13//! analog-input-3/4 ----------|-+
14//! analog-input-5/6 ----------|-|-+
15//! digital-input-1/2 ---------|-|-|-+
16//!                            | | | |
17//!                       (one source only)
18//!                       monitor-source-1/2 -------------------> stream-output-1/2
19//!                                |
20//!                                v
21//!                          ++=========++
22//! stream-input-1/2 ------> ||         || -> mixer-output-7/8 -> analog-output-7/8
23//! stream-input-3/4 ------> || 10 x  8 || -> mixer-output-5/6 -> analog-output-5/6
24//! stream-input-5/6 ------> ||  mixer  || -> mixer-output-2/3 -> analog-output-3/4
25//! stream-input-7/8 ------> ||         || -> mixer-output-1/2 -> analog-output-1/2
26//!        |                 +==========++           |
27//!        +----------------------------------------or----------> digital-output-1/2
28//! ```
29
30use super::*;
31
32/// The protocol implementation for media and sampling clock.
33#[derive(Default, Debug)]
34pub struct AureonClkProtocol;
35
36impl MediaClockFrequencyOperation for AureonClkProtocol {
37    const FREQ_LIST: &'static [u32] = &[32000, 44100, 48000, 88200, 96000, 192000];
38}
39
40impl SamplingClockSourceOperation for AureonClkProtocol {
41    const DST: SignalAddr = SignalAddr::Subunit(SignalSubunitAddr {
42        subunit: MUSIC_SUBUNIT_0,
43        plug_id: 0x03,
44    });
45
46    const SRC_LIST: &'static [SignalAddr] = &[
47        // Internal.
48        SignalAddr::Subunit(SignalSubunitAddr {
49            subunit: MUSIC_SUBUNIT_0,
50            plug_id: 0x03,
51        }),
52    ];
53}
54
55/// The protocol implementation of mixer output.
56#[derive(Default, Debug)]
57pub struct AureonMixerOutputProtocol;
58
59impl AvcAudioFeatureSpecification for AureonMixerOutputProtocol {
60    const ENTRIES: &'static [(u8, AudioCh)] = &[
61        (0x01, AudioCh::Each(0)), // mixer-output-1
62        (0x01, AudioCh::Each(1)), // mixer-output-2
63        (0x01, AudioCh::Each(2)), // mixer-output-3
64        (0x01, AudioCh::Each(3)), // mixer-output-4
65        (0x01, AudioCh::Each(4)), // mixer-output-5
66        (0x01, AudioCh::Each(5)), // mixer-output-6
67        (0x01, AudioCh::Each(6)), // mixer-output-7
68        (0x01, AudioCh::Each(7)), // mixer-output-8
69    ];
70}
71
72impl AvcLevelOperation for AureonMixerOutputProtocol {}
73
74impl AvcMuteOperation for AureonMixerOutputProtocol {}
75
76/// The protocol implementation of analog input.
77#[derive(Default, Debug)]
78pub struct AureonPhysInputProtocol;
79
80impl AvcAudioFeatureSpecification for AureonPhysInputProtocol {
81    const ENTRIES: &'static [(u8, AudioCh)] = &[
82        (0x02, AudioCh::Master), // analog-input-1/2
83        (0x03, AudioCh::Master), // analog-input-3/4
84    ];
85}
86
87impl AvcLevelOperation for AureonPhysInputProtocol {}
88
89/// The protocol implementation of monitor output.
90#[derive(Default, Debug)]
91pub struct AureonMonitorSourceProtocol;
92
93impl AvcSelectorOperation for AureonMonitorSourceProtocol {
94    const FUNC_BLOCK_ID_LIST: &'static [u8] = &[0x01];
95    // NOTE: "analog-input-1/2", "analog-input-3/4", "analog-input-5/6", "digital-input-1/2"
96    const INPUT_PLUG_ID_LIST: &'static [u8] = &[0x00, 0x01, 0x02, 0x03];
97}
98
99/// The protocol implementation of monitor source.
100#[derive(Default, Debug)]
101pub struct AureonMonitorOutputProtocol;
102
103impl AvcAudioFeatureSpecification for AureonMonitorOutputProtocol {
104    const ENTRIES: &'static [(u8, AudioCh)] = &[
105        (0x04, AudioCh::Master), // monitor-output-1/2
106    ];
107}
108
109impl AvcLevelOperation for AureonMonitorOutputProtocol {}
110
111impl AvcMuteOperation for AureonMonitorOutputProtocol {}
112
113/// The protocol implementation of spdif output.
114#[derive(Default, Debug)]
115pub struct AureonSpdifOutputProtocol;
116
117impl AvcSelectorOperation for AureonSpdifOutputProtocol {
118    const FUNC_BLOCK_ID_LIST: &'static [u8] = &[0x02];
119    // NOTE: "mixer-output-1/2", "stream-input-9/10"
120    const INPUT_PLUG_ID_LIST: &'static [u8] = &[0x00, 0x01];
121}