/src/adhd/audio_processor/src/shape.rs
Line | Count | Source |
1 | | // Copyright 2023 The ChromiumOS Authors |
2 | | // Use of this source code is governed by a BSD-style license that can be |
3 | | // found in the LICENSE file. |
4 | | |
5 | | use serde::Deserialize; |
6 | | use serde::Serialize; |
7 | | |
8 | | /// Shape of a audio buffer. |
9 | | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
10 | | pub struct Shape { |
11 | | /// Number of channels. |
12 | | pub channels: usize, |
13 | | /// Number of frames. |
14 | | pub frames: usize, |
15 | | } |
16 | | |
17 | | /// Format of an audio processor. |
18 | | #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] |
19 | | pub struct Format { |
20 | | /// Number of channels. |
21 | | pub channels: usize, |
22 | | /// Number of frames per processing. |
23 | | pub block_size: usize, |
24 | | /// Number of frames per second. |
25 | | pub frame_rate: usize, |
26 | | } |
27 | | |
28 | | impl Into<Shape> for Format { |
29 | 0 | fn into(self) -> Shape { |
30 | 0 | Shape { |
31 | 0 | channels: self.channels, |
32 | 0 | frames: self.block_size, |
33 | 0 | } |
34 | 0 | } |
35 | | } |