1#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2pub struct VirtualPortId(pub(crate) u64);
3
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
5pub struct PortId(pub(crate) PortIdInner);
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
8pub(crate) enum PortIdInner {
9 #[cfg(any(target_os = "macos", target_os = "ios"))]
10 CoreMidi(i32),
11 #[cfg(target_os = "linux")]
12 Alsa { client_id: i32, port_id: i32 },
13}
14
15#[derive(Debug, Clone, PartialEq, Eq, Hash)]
17pub struct Source {
18 pub(crate) id: PortId,
19 pub(crate) name: String,
20 pub(crate) is_virtual: bool,
21}
22
23impl Source {
24 pub fn id(&self) -> PortId {
25 self.id
26 }
27
28 pub fn name(&self) -> &str {
29 &self.name
30 }
31
32 pub fn is_virtual(&self) -> bool {
33 self.is_virtual
34 }
35}
36
37#[derive(Debug, Clone, PartialEq, Eq, Hash)]
39pub enum SourceChange {
40 Added(Source),
41 Removed(Source),
42}
43
44#[derive(Debug, Clone, PartialEq, Eq, Hash)]
46pub struct Destination {
47 pub(crate) id: PortId,
48 pub(crate) name: String,
49 pub(crate) is_virtual: bool,
50}
51
52impl Destination {
53 pub fn id(&self) -> PortId {
54 self.id
55 }
56
57 pub fn name(&self) -> &str {
58 &self.name
59 }
60
61 pub fn is_virtual(&self) -> bool {
62 self.is_virtual
63 }
64}
65
66#[derive(Debug, Clone, PartialEq, Eq, Hash)]
68pub enum DestinationChange {
69 Added(Destination),
70 Removed(Destination),
71}