-
-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathjack_enums.rs
More file actions
77 lines (68 loc) · 1.68 KB
/
jack_enums.rs
File metadata and controls
77 lines (68 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
use crate::ClientStatus;
/// An error that can occur in JACK.
#[derive(Clone, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum Error {
CallbackDeregistrationError,
CallbackRegistrationError,
ClientActivationError,
ClientDeactivationError,
ClientError(ClientStatus),
FreewheelError,
InvalidDeactivation,
NotEnoughSpace,
PortAliasError,
PortAlreadyConnected(String, String),
PortConnectionError(String, String),
PortDisconnectionError,
PortMonitorError,
PortNamingError,
PortRegistrationError(String),
SetBufferSizeError,
TimeError,
WeakFunctionNotFound(&'static str),
ClientIsNoLongerAlive,
RingbufferCreateFailed,
SetSyncTimeoutError,
UnknownError,
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}
impl std::error::Error for Error {}
/// Specify an option, either to continue processing, or to stop.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Control {
/// Continue processing.
Continue,
/// Stop processing.
Quit,
}
impl Control {
pub fn to_ffi(self) -> libc::c_int {
match self {
Control::Continue => 0,
Control::Quit => -1,
}
}
}
impl Default for Control {
fn default() -> Self {
Control::Continue
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LatencyType {
Capture,
Playback,
}
impl LatencyType {
pub fn to_ffi(self) -> libc::c_uint {
match self {
LatencyType::Playback => jack_sys::JackPlaybackLatency,
LatencyType::Capture => jack_sys::JackCaptureLatency,
}
}
}