Skip to main content

UsbTransport

Struct UsbTransport 

Source
pub struct UsbTransport { /* private fields */ }
Expand description

Bidirectional FM-1 MIDI connection using the system MIDI driver.

Only WaveGraph remote replies enter the bounded receive queue. Other musical MIDI and USB log traffic remain independent. Callback overflow fails a query explicitly instead of silently accepting an incomplete snapshot.

Implementations§

Source§

impl UsbTransport

Source

pub fn connect(port: Option<&str>, timeout: Duration) -> Result<Self>

Open a named MIDI pair, or use fm1-usb automatic device/log discovery.

A name bypasses the log probe and can select firmware without logging. Discovery is performed on the control thread, never the audio callback. timeout bounds each log-discovery request, not the entire connection attempt: automatic discovery can probe multiple ports and make multiple requests per port. A named port skips those requests.

§Errors

Returns an error for a missing/ambiguous device or unavailable MIDI ports.

Source

pub fn open(ports: &MidiPorts) -> Result<Self>

Open a previously selected pair of FM-1 MIDI ports.

§Errors

Returns an error if either MIDI port cannot be opened.

Trait Implementations§

Source§

impl Debug for UsbTransport

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Transport for UsbTransport

Source§

fn send(&mut self, message: &[u8]) -> Result<()>

Submit one complete MIDI message. Read more
Source§

fn receive(&mut self, timeout: Duration) -> Result<Vec<u8>>

Receive one complete message, waiting at most timeout. Read more

Auto Trait Implementations§

§

impl !Freeze for UsbTransport

§

impl !RefUnwindSafe for UsbTransport

§

impl !Sync for UsbTransport

§

impl !UnwindSafe for UsbTransport

§

impl Forget for UsbTransport

§

impl Move for UsbTransport

§

impl Send for UsbTransport
where PortSubscribe: Send, JoinHandle<(HandlerData<()>, ())>: Send, Seq: Send, EventEncoder: Send, Receiver<String>: Send, Receiver<Vec<u8>>: Send, Arc<Atomic<bool>>: Send,

§

impl Unpin for UsbTransport
where *mut _snd_seq_port_subscribe: Unpin, Arc<Inner, System>: Unpin, Arc<Packet<'static, (HandlerData<()>, ())>>: Unpin, *mut _snd_seq: Unpin, *mut snd_midi_event: Unpin, *mut Counter<Channel<String>>: Unpin, *mut Counter<Channel<String>>: Unpin, *mut Counter<Channel<String>>: Unpin, *mut Counter<Channel<Vec<u8>>>: Unpin, *mut Counter<Channel<Vec<u8>>>: Unpin, *mut Counter<Channel<Vec<u8>>>: Unpin, Arc<Atomic<bool>>: Unpin,

§

impl UnsafeUnpin for UsbTransport
where *mut _snd_seq_port_subscribe: UnsafeUnpin, *const ArcInner<Inner> is !null: UnsafeUnpin, PhantomData<ArcInner<Inner>>: UnsafeUnpin, *const ArcInner<Packet<'static, (HandlerData<()>, ())>> is !null: UnsafeUnpin, PhantomData<ArcInner<Packet<'static, (HandlerData<()>, ())>>>: UnsafeUnpin, *mut _snd_seq: UnsafeUnpin, *mut snd_midi_event: UnsafeUnpin, *mut Counter<Channel<String>>: UnsafeUnpin, *mut Counter<Channel<String>>: UnsafeUnpin, *mut Counter<Channel<String>>: UnsafeUnpin, *mut Counter<Channel<Vec<u8>>>: UnsafeUnpin, *mut Counter<Channel<Vec<u8>>>: UnsafeUnpin, *mut Counter<Channel<Vec<u8>>>: UnsafeUnpin, *const ArcInner<Atomic<bool>> is !null: UnsafeUnpin, PhantomData<ArcInner<Atomic<bool>>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.