rust-jack icon indicating copy to clipboard operation
rust-jack copied to clipboard

Request capability to specify additional flags for AudioIn, AudioOut, MidiIn and MidiOut types

Open xkr47 opened this issue 10 months ago • 0 comments

Currently I cannot add the IS_TERMINAL flag to AudioIn — and if I create my own variant and unsafe impl PortSpec for it, I lose all the as_slice() etc helper methods provided.

Could e.g. implement like:

pub struct AudioIn(PortFlags);

impl AudioIn {
    /// # Example
    /// ```
    /// let spec = jack::AudioIn::with_extra_port_flags(jack::PortFlags::IS_TERMINAL);
    /// let audio_out_port = client.register_port("out", spec).unwrap();
    /// ```
    pub fn with_extra_port_flags(flags: PortFlags) -> Self {
        Self(flags)
    }
}

unsafe impl PortSpec for AudioIn {
    fn jack_flags(&self) -> PortFlags {
        PortFlags::IS_INPUT.union(self.0)
    }
}

Since it seemed the examples suggest using AudioIn::default() to construct instances I think this would not be considered API breakage.

xkr47 avatar Aug 20 '23 21:08 xkr47