mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
wip: unify apps
This commit is contained in:
parent
a9cad18891
commit
cff87657b9
12 changed files with 291 additions and 247 deletions
|
|
@ -21,8 +21,10 @@ pub type DynamicAsyncClient = AsyncClient<DynamicNotifications, DynamicAudioH
|
|||
/// This is a connection which may be `Inactive`, `Activating`, or `Active`.
|
||||
/// In the `Active` and `Inactive` states, its `client` method returns a
|
||||
/// [Client] which you can use to talk to the JACK API.
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Default)]
|
||||
pub enum JackConnection {
|
||||
#[default]
|
||||
Inert,
|
||||
/// Before activation.
|
||||
Inactive(Client),
|
||||
/// During activation.
|
||||
|
|
@ -35,6 +37,7 @@ impl From<JackConnection> for Client {
|
|||
fn from (jack: JackConnection) -> Self {
|
||||
match jack {
|
||||
JackConnection::Inactive(client) => client,
|
||||
JackConnection::Inert => panic!("jack client not activated"),
|
||||
JackConnection::Activating => panic!("jack client still activating"),
|
||||
JackConnection::Active(_) => panic!("jack client already activated"),
|
||||
}
|
||||
|
|
@ -49,6 +52,7 @@ impl JackConnection {
|
|||
/// Return the internal [Client] handle that lets you call the JACK API.
|
||||
pub fn client (&self) -> &Client {
|
||||
match self {
|
||||
Self::Inert => panic!("jack client not activated"),
|
||||
Self::Inactive(ref client) => client,
|
||||
Self::Activating => panic!("jack client has not finished activation"),
|
||||
Self::Active(ref client) => client.as_client(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue