rust_jack/
flags.rs

1use jack_sys as j;
2
3/// port type for Jack's built in 32 bit floating audio.
4pub const DEFAULT_AUDIO_TYPE: &'static str = "32 bit float mono audio";
5
6/// port type for Jack's built in 8 bit raw midi
7pub const DEFAULT_MIDI_TYPE: &'static str = "8 bit raw midi";
8
9bitflags! {
10    /// Option flags for opening a Jack client.
11    ///
12    /// * `NULL_OPTION` - Equivalent to `ClientOptions::empty()`
13    ///
14    /// * `NO_START_SERVER`: Do not automatically start the Jack server when it
15    /// is not already running. This option is always selected if
16    /// `$JACK_NO_START_SERVER` is defined in the calling process
17    /// environment.
18    ///
19    /// * `USE_EXACT_NAME`: Use the exact client name requested. Otherwise,
20    /// Jack automatically generates a unique one if needed.
21    ///
22    /// * `SERVER_NAME`: Open with optional `server_name` parameter. TODO:
23    /// implement
24    ///
25    /// * `LOAD_NAME`: Load internal client from optional `load_name`,
26    /// otherwise use the `client_name`. TODO implement
27    ///
28    /// * `LOAD_INIT`: Pass optional `load_init` to `jack_initialize()`
29    /// entry point of an internal client. TODO: implement
30    ///
31    /// * `SESSION_ID`: Pass a SessionID token. This allows the session
32    /// manager to identify the client again.
33    pub flags ClientOptions: u32 {
34        const NULL_OPTION     = j::JackNullOption,
35        const NO_START_SERVER = j::JackNoStartServer,
36        const USE_EXACT_NAME  = j::JackUseExactName,
37        const SERVER_NAME     = j::JackServerName,
38        const LOAD_NAME       = j::JackLoadName,
39        const LOAD_INIT       = j::JackLoadInit,
40        const SESSION_ID      = j::JackSessionID,
41    }
42}
43
44bitflags! {
45    /// Status flags for Jack clients.
46    ///
47    /// * `FAILURE` - Overall operation failed.
48    ///
49    /// * `INVALID_OPTION` - The operation contained an invalid or unsupported
50    /// option.
51    ///
52    /// * `NAME_NOT_UNIQUE` - The desired client name was not unique. With the
53    /// `USE_EXACT_NAME` option this situation is fatal. Otherwise, the name was
54    /// modified by appending a dash and a two-digit number in the range "-01"
55    /// to "-99". `Client::name()` will return the exact string that was
56    /// used. If the specified client_name plus these extra characters would be
57    /// too long, the open fails instead.
58    ///
59    /// * `SERVER_STARTED` - The JACK server was started as a result of this
60    /// operation. Otherwise, it was running already. In either case the caller
61    /// is now connected to jackd, so there is no race condition. When the
62    /// server shuts down, the client will find out.
63    ///
64    /// * `SERVER_FAILED` - Unable to connect to the JACK server.
65    ///
66    /// * `SERVER_ERROR` - Communication error with the JACK server.
67    ///
68    /// * `NO_SUCH_CLIENT` - Requested client does not exist.
69    ///
70    /// * `LOAD_FAILURE` - Unable to load internal client
71    ///
72    /// * `INIT_FAILURE` - Unable to initialize client
73    ///
74    /// * `SHM_FAILURE` - Unable to access shared memory
75    ///
76    /// * `VERSION_ERROR` - Client's protocol version does not match
77    ///
78    /// * `BACKEND_ERROR` - No documentation found. TODO: dig deeper
79    ///
80    /// * `CLIENT_ZOZMBIE` - No documentation found. TODO: dig deeper
81    ///
82    /// * `UNKNOWN_ERROR` - Not part of jack and shouldn't occur ever.
83    /// File an issue if you can get it to appear.
84    pub flags ClientStatus: u32 {
85        const FAILURE         = j::JackFailure,
86        const INVALID_OPTION  = j::JackInvalidOption,
87        const NAME_NOT_UNIQUE = j::JackNameNotUnique,
88        const SERVER_STARTED  = j::JackServerStarted,
89        const SERVER_FAILED   = j::JackServerFailed,
90        const SERVER_ERROR    = j::JackServerError,
91        const NO_SUCH_CLIENT  = j::JackNoSuchClient,
92        const LOAD_FAILURE    = j::JackLoadFailure,
93        const INIT_FAILURE    = j::JackInitFailure,
94        const SHM_FAILURE     = j::JackShmFailure,
95        const VERSION_ERROR   = j::JackVersionError,
96        const BACKEND_ERROR   = j::JackBackendError,
97        const CLIENT_ZOMBIE   = j::JackClientZombie,
98        const UNKNOWN_ERROR   = 0x2000, // TODO: don't use this
99    }
100}
101
102bitflags! {
103    /// Flags for specifying port options.
104    ///
105    /// * `IS_INPUT` - The port can receive data.
106    ///
107    /// * `IS_OUTPUT` - Data can be read from the port.
108    ///
109    /// * `IS_PHYSICAL` - Port corresponds to some kind of physical I/O
110    /// connector.
111    ///
112    /// * `CAN_MONITOR` - A call to `jack_port_request_monitor()` makes
113    /// sense. TODO: implement. Precisely what this means it dependent on the
114    /// client. A typical result of it being called with `true` as the second
115    /// argument is that data that would be available from an output port (with
116    /// `IS_PHYSICAL` set) is sent to a physical output connector as well, so
117    /// that it can be heard/seen/whatever.
118    ///
119    /// * `IS_TERMINAL` - For an input port, the data received by the port will
120    /// not be passed on or made available at any other port. For output, the
121    /// data available at the port does not originate from any other port. Audio
122    /// synthesizers, I/O hardware interface clients, HDR systems are examples
123    /// of clients that would set this flag for their ports.
124    pub flags PortFlags: u32 {
125        const IS_INPUT    = j::JackPortIsInput,
126        const IS_OUTPUT   = j::JackPortIsOutput,
127        const IS_PHYSICAL = j::JackPortIsPhysical,
128        const CAN_MONITOR = j::JackPortCanMonitor,
129        const IS_TERMINAL = j::JackPortIsTerminal,
130    }
131}