pub struct Graph { /* private fields */ }Expand description
Owned audio graph session.
Wraps the C ove_audio_graph in a safe API. All unsafe FFI calls
are encapsulated — application code uses only safe methods.
§Example
ⓘ
let mut g = Graph::new(512)?;
let dev = device_cfg_i2s(16000, 1, 1);
let src = g.device_source(&dev, b"mic\0")?;
let proc = g.add_processor(PROC.get_mut(), b"dsp\0")?;
let sink = g.device_sink(&dev, b"spk\0")?;
g.connect(src, proc)?;
g.connect(proc, sink)?;
g.build()?;
g.start()?;Implementations§
Source§impl Graph
impl Graph
Sourcepub fn device_source(
&mut self,
cfg: &ove_audio_device_cfg,
name: &[u8],
) -> Result<u32, Error>
pub fn device_source( &mut self, cfg: &ove_audio_device_cfg, name: &[u8], ) -> Result<u32, Error>
Add a hardware audio source node. Returns the node index.
Sourcepub fn device_sink(
&mut self,
cfg: &ove_audio_device_cfg,
name: &[u8],
) -> Result<u32, Error>
pub fn device_sink( &mut self, cfg: &ove_audio_device_cfg, name: &[u8], ) -> Result<u32, Error>
Add a hardware audio sink node. Returns the node index.
Sourcepub fn add_processor<T: AudioProcessor>(
&mut self,
processor: &'static mut T,
name: &[u8],
) -> Result<u32, Error>
pub fn add_processor<T: AudioProcessor>( &mut self, processor: &'static mut T, name: &[u8], ) -> Result<u32, Error>
Register a custom processor node. Returns the node index.
Sourcepub fn connect(&mut self, from: u32, to: u32) -> Result<()>
pub fn connect(&mut self, from: u32, to: u32) -> Result<()>
Connect two nodes. from feeds into to.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Graph
impl RefUnwindSafe for Graph
impl !Send for Graph
impl !Sync for Graph
impl Unpin for Graph
impl UnwindSafe for Graph
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