Struct cubeb_backend::Context
source · pub struct Context(/* private fields */);
Implementations§
Methods from Deref<Target = ContextRef>§
pub fn as_ptr(&self) -> *mut cubeb
pub fn backend_id(&self) -> &str
pub fn backend_id_bytes(&self) -> &[u8] ⓘ
pub fn max_channel_count(&self) -> Result<u32, Error>
pub fn min_latency(&self, params: &StreamParamsRef) -> Result<u32, Error>
pub fn preferred_sample_rate(&self) -> Result<u32, Error>
sourcepub unsafe fn stream_init(
&self,
stream_name: Option<&CStr>,
input_device: *const c_void,
input_stream_params: Option<&StreamParamsRef>,
output_device: *const c_void,
output_stream_params: Option<&StreamParamsRef>,
latency_frames: u32,
data_callback: Option<unsafe extern "C" fn(_: *mut cubeb_stream, _: *mut c_void, _: *const c_void, _: *mut c_void, _: i64) -> i64>,
state_callback: Option<unsafe extern "C" fn(_: *mut cubeb_stream, _: *mut c_void, _: u32)>,
user_ptr: *mut c_void
) -> Result<Stream, Error>
pub unsafe fn stream_init( &self, stream_name: Option<&CStr>, input_device: *const c_void, input_stream_params: Option<&StreamParamsRef>, output_device: *const c_void, output_stream_params: Option<&StreamParamsRef>, latency_frames: u32, data_callback: Option<unsafe extern "C" fn(_: *mut cubeb_stream, _: *mut c_void, _: *const c_void, _: *mut c_void, _: i64) -> i64>, state_callback: Option<unsafe extern "C" fn(_: *mut cubeb_stream, _: *mut c_void, _: u32)>, user_ptr: *mut c_void ) -> Result<Stream, Error>
Safety
This function is unsafe because it dereferences the given data_callback
, state_callback
, and user_ptr
pointers.
The caller should ensure those pointers are valid.
pub fn enumerate_devices( &self, devtype: DeviceType ) -> Result<DeviceCollection<'_>, Error>
sourcepub unsafe fn register_device_collection_changed(
&self,
devtype: DeviceType,
callback: Option<unsafe extern "C" fn(_: *mut cubeb, _: *mut c_void)>,
user_ptr: *mut c_void
) -> Result<(), Error>
pub unsafe fn register_device_collection_changed( &self, devtype: DeviceType, callback: Option<unsafe extern "C" fn(_: *mut cubeb, _: *mut c_void)>, user_ptr: *mut c_void ) -> Result<(), Error>
Safety
This function is unsafe because it dereferences the given callback
and user_ptr
pointers.
The caller should ensure those pointers are valid.
Trait Implementations§
source§impl AsRef<ContextRef> for Context
impl AsRef<ContextRef> for Context
source§fn as_ref(&self) -> &ContextRef
fn as_ref(&self) -> &ContextRef
Converts this type into a shared reference of the (usually inferred) input type.
source§impl Borrow<ContextRef> for Context
impl Borrow<ContextRef> for Context
source§fn borrow(&self) -> &ContextRef
fn borrow(&self) -> &ContextRef
Immutably borrows from an owned value. Read more
source§impl Deref for Context
impl Deref for Context
§type Target = ContextRef
type Target = ContextRef
The resulting type after dereferencing.
source§fn deref(&self) -> &ContextRef
fn deref(&self) -> &ContextRef
Dereferences the value.
Auto Trait Implementations§
impl RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
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