firewire_fireworks_protocols/audiofire.rs
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// Copyright (c) 2023 Takashi Sakamoto
3
4//! Protocol implementations for Echo Audio Audiofire series.
5//!
6//! The module includes protocol about port configuration defined by Echo Audio Digital Corporation
7//! for Audiofire.
8
9use super::{phys_input::*, phys_output::*, port_conf::*, *};
10
11/// Protocol implementation for former model of AudioFire 12. The higher sampling rates are
12/// available only with firmware version 4 and former.
13///
14/// Diagram of internal signal flow
15///
16/// ```text
17/// analog-input-1/2 ---------+----------------> stream-output-1/2
18/// analog-input-3/4 ---------|-+--------------> stream-output-3/4
19/// analog-input-5/6 ---------|-|-+------------> stream-output-5/6
20/// analog-input-7/8 ---------|-|-|-+----------> stream-output-7/8
21/// analog-input-9/10 --------|-|-|-|----------> stream-output-9/10
22/// analog-input-11/12 -------|-|-|-|-+--------> stream-output-11/12
23/// | | | | |
24/// v v v v v
25/// ++===========++
26/// stream-input-1/2 ----> || || ----> analog-output-1/2
27/// stream-input-3/4 ----> || mixer || ----> analog-output-3/4
28/// stream-input-5/6 ----> || || ----> analog-output-5/6
29/// stream-input-7/8 ----> || 24 x 12 || ----> analog-output-7/8
30/// stream-input-9/10 ---> || || ----> analog-output-9/10
31/// stream-input-11/12 --> || || ----> analog-output-11/12
32/// ++===========++
33/// ```
34#[derive(Default, Debug)]
35pub struct Audiofire12FormerProtocol;
36
37impl EfwHardwareSpecification for Audiofire12FormerProtocol {
38 const SUPPORTED_SAMPLING_RATES: &'static [u32] =
39 &[32000, 44100, 48000, 88200, 96000, 176400, 192000];
40 const SUPPORTED_SAMPLING_CLOCKS: &'static [ClkSrc] =
41 &[ClkSrc::Internal, ClkSrc::WordClock, ClkSrc::Spdif];
42 const CAPABILITIES: &'static [HwCap] = &[
43 HwCap::ChangeableRespAddr,
44 HwCap::Dsp,
45 // Fixup.
46 HwCap::NominalInput,
47 HwCap::NominalOutput,
48 ];
49 const TX_CHANNEL_COUNTS: [usize; 3] = [12, 12, 12];
50 const RX_CHANNEL_COUNTS: [usize; 3] = [12, 12, 12];
51 const MONITOR_SOURCE_COUNT: usize = 12;
52 const MONITOR_DESTINATION_COUNT: usize = 12;
53 const MIDI_INPUT_COUNT: usize = 1;
54 const MIDI_OUTPUT_COUNT: usize = 1;
55
56 const PHYS_INPUT_GROUPS: &'static [(PhysGroupType, usize)] = &[(PhysGroupType::Analog, 12)];
57
58 const PHYS_OUTPUT_GROUPS: &'static [(PhysGroupType, usize)] = &[(PhysGroupType::Analog, 12)];
59}
60
61impl EfwPhysInputSpecification for Audiofire12FormerProtocol {}
62
63impl EfwPhysOutputSpecification for Audiofire12FormerProtocol {}
64
65impl EfwPlaybackSoloSpecification for Audiofire12FormerProtocol {}
66
67/// Protocol implementation for later model of AudioFire 12. The higher sampling rates are
68/// available only with firmware version 4 and former.
69///
70/// Diagram of internal signal flow
71///
72/// ```text
73/// analog-input-1/2 ---------+----------------> stream-output-1/2
74/// analog-input-3/4 ---------|-+--------------> stream-output-3/4
75/// analog-input-5/6 ---------|-|-+------------> stream-output-5/6
76/// analog-input-7/8 ---------|-|-|-+----------> stream-output-7/8
77/// analog-input-9/10 --------|-|-|-|----------> stream-output-9/10
78/// analog-input-11/12 -------|-|-|-|-+--------> stream-output-11/12
79/// | | | | |
80/// v v v v v
81/// ++===========++
82/// stream-input-1/2 ----> || || ----> analog-output-1/2
83/// stream-input-3/4 ----> || mixer || ----> analog-output-3/4
84/// stream-input-5/6 ----> || || ----> analog-output-5/6
85/// stream-input-7/8 ----> || 24 x 12 || ----> analog-output-7/8
86/// stream-input-9/10 ---> || || ----> analog-output-9/10
87/// stream-input-11/12 --> || || ----> analog-output-11/12
88/// ++===========++
89/// ```
90#[derive(Default, Debug)]
91pub struct Audiofire12LaterProtocol;
92
93impl EfwHardwareSpecification for Audiofire12LaterProtocol {
94 const SUPPORTED_SAMPLING_RATES: &'static [u32] =
95 &[32000, 44100, 48000, 88200, 96000, 176400, 192000];
96 const SUPPORTED_SAMPLING_CLOCKS: &'static [ClkSrc] =
97 &[ClkSrc::Internal, ClkSrc::WordClock, ClkSrc::Spdif];
98 const CAPABILITIES: &'static [HwCap] = &[
99 HwCap::ChangeableRespAddr,
100 HwCap::Dsp,
101 HwCap::InputGain,
102 // Fixup.
103 HwCap::NominalInput,
104 HwCap::NominalOutput,
105 ];
106 const TX_CHANNEL_COUNTS: [usize; 3] = [12, 12, 12];
107 const RX_CHANNEL_COUNTS: [usize; 3] = [12, 12, 12];
108 const MONITOR_SOURCE_COUNT: usize = 12;
109 const MONITOR_DESTINATION_COUNT: usize = 12;
110 const MIDI_INPUT_COUNT: usize = 1;
111 const MIDI_OUTPUT_COUNT: usize = 1;
112
113 const PHYS_INPUT_GROUPS: &'static [(PhysGroupType, usize)] = &[(PhysGroupType::Analog, 12)];
114
115 const PHYS_OUTPUT_GROUPS: &'static [(PhysGroupType, usize)] = &[(PhysGroupType::Analog, 12)];
116}
117
118impl EfwPhysInputSpecification for Audiofire12LaterProtocol {}
119
120impl EfwPhysOutputSpecification for Audiofire12LaterProtocol {}
121
122impl EfwPlaybackSoloSpecification for Audiofire12LaterProtocol {}
123
124/// Protocol implementation for former model of AudioFire 8.
125///
126/// Diagram of internal signal flow
127///
128/// ```text
129/// analog-input-1/2 ---------+----------------> stream-output-1/2
130/// analog-input-3/4 ---------|-+--------------> stream-output-3/4
131/// analog-input-5/6 ---------|-|-+------------> stream-output-5/6
132/// analog-input-7/8 ---------|-|-|-+----------> stream-output-7/8
133/// | | | |
134/// coaxial-input-1/2 --------|-|-|-|-+--------> stream-output-9/10
135/// | | | | |
136/// v v v v v
137/// ++===========++
138/// stream-input-1/2 ----> || || ----> analog-output-1/2
139/// stream-input-3/4 ----> || mixer || ----> analog-output-3/4
140/// stream-input-5/6 ----> || || ----> analog-output-5/6
141/// stream-input-7/8 ----> || 20 x 10 || ----> analog-output-7/8
142/// stream-input-9/10 ---> || || ----> coaxial-output-1/2
143/// ++===========++
144/// ```
145#[derive(Default, Debug)]
146pub struct Audiofire8Protocol;
147
148impl EfwHardwareSpecification for Audiofire8Protocol {
149 const SUPPORTED_SAMPLING_RATES: &'static [u32] = &[32000, 44100, 48000, 88200, 96000];
150 const SUPPORTED_SAMPLING_CLOCKS: &'static [ClkSrc] =
151 &[ClkSrc::Internal, ClkSrc::WordClock, ClkSrc::Spdif];
152 const CAPABILITIES: &'static [HwCap] = &[
153 HwCap::ChangeableRespAddr,
154 HwCap::Dsp,
155 // Fixup.
156 HwCap::NominalInput,
157 HwCap::NominalOutput,
158 ];
159 const TX_CHANNEL_COUNTS: [usize; 3] = [10, 10, 10];
160 const RX_CHANNEL_COUNTS: [usize; 3] = [10, 10, 10];
161 const MONITOR_SOURCE_COUNT: usize = 10;
162 const MONITOR_DESTINATION_COUNT: usize = 10;
163 const MIDI_INPUT_COUNT: usize = 1;
164 const MIDI_OUTPUT_COUNT: usize = 1;
165
166 const PHYS_INPUT_GROUPS: &'static [(PhysGroupType, usize)] =
167 &[(PhysGroupType::Analog, 8), (PhysGroupType::Spdif, 2)];
168
169 const PHYS_OUTPUT_GROUPS: &'static [(PhysGroupType, usize)] =
170 &[(PhysGroupType::Analog, 8), (PhysGroupType::Spdif, 2)];
171}
172
173impl EfwPhysInputSpecification for Audiofire8Protocol {}
174
175impl EfwPhysOutputSpecification for Audiofire8Protocol {}
176
177impl EfwPlaybackSoloSpecification for Audiofire8Protocol {}
178
179/// Protocol implementation for latter model of AudioFire 8 and AudioFirePre 8
180///
181/// Diagram of internal signal flow
182///
183/// ```text
184///
185/// analog-input-1/2 ---------+----------------------------------------------> stream-output-1/2
186/// analog-input-3/4 ---------|-+--------------------------------------------> stream-output-3/4
187/// analog-input-5/6 ---------|-|-+------------------------------------------> stream-output-5/6
188/// analog-input-7/8 ---------|-|-|-+----------------------------------------> stream-output-7/8
189/// | | | |
190/// coaxial-input-1/2 --+ | | | |
191/// optical-input-1/2 --or----|-|-|-|-+--------------------------------------> stream-output-9/10
192/// optical-input-3/4 --------|-|-|-|-|-+------------------------------------> stream-output-11/12
193/// optical-input-5/6 --------|-|-|-|-|-|-+----------------------------------> stream-output-13/14
194/// optical-input-7/8 --------|-|-|-|-|-|-|-+--------------------------------> stream-output-15/16
195/// | | | | | | | |
196/// v v v v v v v v
197/// ++=================++
198/// stream-input-1/2 ----> || || ----------------------------> analog-output-1/2
199/// stream-input-3/4 ----> || || ----------------------------> analog-output-3/4
200/// stream-input-5/6 ----> || mixer || ----------------------------> analog-output-5/6
201/// stream-input-7/8 ----> || || ----------------------------> analog-output-7/8
202/// || || +--> coaxial-output-1/2
203/// stream-input-9/10 ---> || || --> digital-output-1/2 --or-> optical-output-1/2
204/// stream-input-11/12 --> || 32 x 16 || --> digital-output-3/4 -----> optical-output-3/4
205/// stream-input-13/14 --> || || --> digital-output-5/6 -----> optical-output-5/6
206/// stream-input-15/16 --> || || --> digital-output-7/8 -----> optical-output-7/8
207/// ++=================++
208/// ```
209#[derive(Default, Debug)]
210pub struct Audiofire9Protocol;
211
212impl EfwHardwareSpecification for Audiofire9Protocol {
213 const SUPPORTED_SAMPLING_RATES: &'static [u32] = &[32000, 44100, 48000, 88200, 96000];
214 const SUPPORTED_SAMPLING_CLOCKS: &'static [ClkSrc] = &[
215 ClkSrc::Internal,
216 ClkSrc::WordClock,
217 ClkSrc::Spdif,
218 ClkSrc::Adat,
219 ];
220 const CAPABILITIES: &'static [HwCap] = &[
221 HwCap::ChangeableRespAddr,
222 HwCap::OptionalSpdifCoax,
223 HwCap::Fpga,
224 HwCap::OptionalSpdifOpt,
225 HwCap::OptionalAdatOpt,
226 // Fixup.
227 HwCap::NominalInput,
228 HwCap::NominalOutput,
229 ];
230 const TX_CHANNEL_COUNTS: [usize; 3] = [16, 12, 10];
231 const RX_CHANNEL_COUNTS: [usize; 3] = [16, 12, 10];
232 const MONITOR_SOURCE_COUNT: usize = 16;
233 const MONITOR_DESTINATION_COUNT: usize = 16;
234 const MIDI_INPUT_COUNT: usize = 1;
235 const MIDI_OUTPUT_COUNT: usize = 1;
236
237 const PHYS_INPUT_GROUPS: &'static [(PhysGroupType, usize)] =
238 &[(PhysGroupType::Analog, 8), (PhysGroupType::SpdifOrAdat, 8)];
239
240 const PHYS_OUTPUT_GROUPS: &'static [(PhysGroupType, usize)] =
241 &[(PhysGroupType::Analog, 8), (PhysGroupType::SpdifOrAdat, 8)];
242}
243
244impl EfwDigitalModeSpecification for Audiofire9Protocol {}
245
246impl EfwPhysInputSpecification for Audiofire9Protocol {}
247
248impl EfwPhysOutputSpecification for Audiofire9Protocol {}
249
250impl EfwPlaybackSoloSpecification for Audiofire9Protocol {}
251
252/// Protocol implementation for Audiofire 4.
253///
254/// Diagram of internal signal flow
255///
256/// ```text
257///
258/// analog-input-1/2 --------+--------------------------------> stream-output-1/2
259/// analog-input-3/4 --------|--+-----------------------------> stream-output-3/4
260/// | |
261/// spdif-input-1/2 ---------|--|--+--------------------------> stream-output-5/6
262/// | | |
263/// v v v
264/// ++==========++ ++========++
265/// stream-input-1/2 ---> || mixer || ---> || router || ---> analog-output-1/2
266/// stream-input-3/4 ---> || || ---> || || ---> analog-output-3/4
267/// stream-input-5/6 ---> || 12 x 6 || ---> || 6 x 6 || ---> spdif-output-1/2
268/// ++==========++ ++========++
269/// ```
270#[derive(Default, Debug)]
271pub struct Audiofire4Protocol;
272
273impl EfwHardwareSpecification for Audiofire4Protocol {
274 const SUPPORTED_SAMPLING_RATES: &'static [u32] = &[32000, 44100, 48000, 88200, 96000];
275 const SUPPORTED_SAMPLING_CLOCKS: &'static [ClkSrc] = &[ClkSrc::Internal, ClkSrc::Spdif];
276 const CAPABILITIES: &'static [HwCap] = &[
277 HwCap::ChangeableRespAddr,
278 HwCap::PhantomPowering,
279 HwCap::OutputMapping,
280 // Fixup.
281 HwCap::NominalInput,
282 HwCap::NominalOutput,
283 ];
284 const TX_CHANNEL_COUNTS: [usize; 3] = [6, 6, 6];
285 const RX_CHANNEL_COUNTS: [usize; 3] = [6, 6, 6];
286 const MONITOR_SOURCE_COUNT: usize = 6;
287 const MONITOR_DESTINATION_COUNT: usize = 6;
288 const MIDI_INPUT_COUNT: usize = 1;
289 const MIDI_OUTPUT_COUNT: usize = 1;
290
291 const PHYS_INPUT_GROUPS: &'static [(PhysGroupType, usize)] =
292 &[(PhysGroupType::Analog, 4), (PhysGroupType::Spdif, 2)];
293
294 const PHYS_OUTPUT_GROUPS: &'static [(PhysGroupType, usize)] =
295 &[(PhysGroupType::Analog, 4), (PhysGroupType::Spdif, 2)];
296}
297
298impl EfwPhantomPoweringSpecification for Audiofire4Protocol {}
299
300impl EfwRxStreamMapsSpecification for Audiofire4Protocol {}
301
302impl EfwPhysInputSpecification for Audiofire4Protocol {}
303
304impl EfwPhysOutputSpecification for Audiofire4Protocol {}
305
306impl EfwPlaybackSoloSpecification for Audiofire4Protocol {}
307
308/// Protocol implementation for Audiofire 2.
309///
310/// Diagram of internal signal flow
311///
312/// ```text
313///
314/// analog-input-1/2 ---------+-------------------------------> stream-output-1/2
315/// |
316/// spdif-input-1/2 ----------|----+--------------------------> stream-output-3/4
317/// | |
318/// v v
319/// ++==========++ ++========++
320/// stream-input-1/2 ---> || mixer || ---> || router || ---> analog-output-1/2
321/// stream-input-3/4 ---> || || ---> || || ---> headphone-output-1/2
322/// stream-input-5/6 ---> || 10 x 6 || ---> || 6 x 6 || ---> spdif-output-1/2
323/// ++==========++ ++========++
324/// ```
325#[derive(Default, Debug)]
326pub struct Audiofire2Protocol;
327
328impl EfwHardwareSpecification for Audiofire2Protocol {
329 const SUPPORTED_SAMPLING_RATES: &'static [u32] = &[32000, 44100, 48000, 88200, 96000];
330 const SUPPORTED_SAMPLING_CLOCKS: &'static [ClkSrc] = &[ClkSrc::Internal, ClkSrc::Spdif];
331 const CAPABILITIES: &'static [HwCap] = &[
332 HwCap::ChangeableRespAddr,
333 HwCap::Fpga,
334 HwCap::PhantomPowering,
335 HwCap::OutputMapping,
336 // Fixup.
337 HwCap::NominalInput,
338 HwCap::NominalOutput,
339 ];
340 const TX_CHANNEL_COUNTS: [usize; 3] = [4, 4, 4];
341 const RX_CHANNEL_COUNTS: [usize; 3] = [6, 6, 6];
342 const MONITOR_SOURCE_COUNT: usize = 4;
343 const MONITOR_DESTINATION_COUNT: usize = 6;
344 const MIDI_INPUT_COUNT: usize = 1;
345 const MIDI_OUTPUT_COUNT: usize = 1;
346
347 const PHYS_INPUT_GROUPS: &'static [(PhysGroupType, usize)] =
348 &[(PhysGroupType::Analog, 2), (PhysGroupType::Spdif, 2)];
349
350 const PHYS_OUTPUT_GROUPS: &'static [(PhysGroupType, usize)] = &[
351 (PhysGroupType::Analog, 2),
352 (PhysGroupType::Headphones, 2),
353 (PhysGroupType::Spdif, 2),
354 ];
355}
356
357impl EfwRxStreamMapsSpecification for Audiofire2Protocol {}
358
359impl EfwPhysInputSpecification for Audiofire2Protocol {}
360
361impl EfwPhysOutputSpecification for Audiofire2Protocol {}
362
363impl EfwPlaybackSoloSpecification for Audiofire2Protocol {}