pub struct UacOut<'d, A: UsbHostAllocator<'d>> {
pub output_channel: A::Pipe<Isochronous, Out>,
pub feedback_channel: Option<A::Pipe<Isochronous, In>>,
/* private fields */
}Expand description
Represents an output audio stream to a USB Audio Class (UAC) device.
This struct manages the output and feedback pipes for isochronous audio streaming, as well as timing and format information required for correct streaming.
Fields§
§output_channel: A::Pipe<Isochronous, Out>Output pipe for isochronous audio streaming.
feedback_channel: Option<A::Pipe<Isochronous, In>>Feedback pipe for isochronous feedback endpoint.
Implementations§
Source§impl<'d, A: UsbHostAllocator<'d>> UacOut<'d, A>
impl<'d, A: UsbHostAllocator<'d>> UacOut<'d, A>
Sourcepub async fn output_stream(
&mut self,
is_connected: impl Fn() -> bool,
callback: impl FnMut(&mut [u8]),
) -> Result<(), RequestError>
pub async fn output_stream( &mut self, is_connected: impl Fn() -> bool, callback: impl FnMut(&mut [u8]), ) -> Result<(), RequestError>
Starts the output audio stream, invoking the provided callback to fill each packet.
The callback is called repeatedly with a mutable buffer for each packet to be sent. Returns an error if the stream cannot be started or if a USB error occurs.
Sourcepub async fn update_sampling_freq(&mut self) -> Result<(), RequestError>
pub async fn update_sampling_freq(&mut self) -> Result<(), RequestError>
Updates the current sampling frequency by reading from the feedback endpoint.
Returns an error if the feedback cannot be read or parsed.
Auto Trait Implementations§
impl<'d, A> Freeze for UacOut<'d, A>where
<A as UsbHostAllocator<'d>>::Pipe<Isochronous, Out>: Freeze,
<A as UsbHostAllocator<'d>>::Pipe<Isochronous, In>: Freeze,
impl<'d, A> RefUnwindSafe for UacOut<'d, A>where
<A as UsbHostAllocator<'d>>::Pipe<Isochronous, Out>: RefUnwindSafe,
<A as UsbHostAllocator<'d>>::Pipe<Isochronous, In>: RefUnwindSafe,
impl<'d, A> Send for UacOut<'d, A>where
<A as UsbHostAllocator<'d>>::Pipe<Isochronous, Out>: Send,
<A as UsbHostAllocator<'d>>::Pipe<Isochronous, In>: Send,
impl<'d, A> Sync for UacOut<'d, A>where
<A as UsbHostAllocator<'d>>::Pipe<Isochronous, Out>: Sync,
<A as UsbHostAllocator<'d>>::Pipe<Isochronous, In>: Sync,
impl<'d, A> Unpin for UacOut<'d, A>where
<A as UsbHostAllocator<'d>>::Pipe<Isochronous, Out>: Unpin,
<A as UsbHostAllocator<'d>>::Pipe<Isochronous, In>: Unpin,
impl<'d, A> UnwindSafe for UacOut<'d, A>where
<A as UsbHostAllocator<'d>>::Pipe<Isochronous, Out>: UnwindSafe,
<A as UsbHostAllocator<'d>>::Pipe<Isochronous, In>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more