pub struct FileNode { /* private fields */ }Expand description
A node that reads and decodes audio from a file.
It uses the symphonia library to support various audio formats.
Like MicrophoneNode, it handles
sample rate conversion automatically.
§Example
use rust_audio_api::nodes::{FileNode, NodeType};
use rust_audio_api::AudioContext;
let mut ctx = AudioContext::new().unwrap();
let sample_rate = ctx.sample_rate();
let dest_id = ctx.build_graph(|builder| {
let file = FileNode::new("music.mp3", sample_rate).unwrap();
builder.add_node(NodeType::File(file))
});Implementations§
Source§impl FileNode
impl FileNode
Sourcepub fn new(file_path: &str, target_sample_rate: u32) -> Result<Self, Error>
pub fn new(file_path: &str, target_sample_rate: u32) -> Result<Self, Error>
Creates a new FileNode for the specified file path.
§Parameters
file_path: Path to the audio file.target_sample_rate: Processing sample rate.
pub fn process(&mut self, _input: Option<&AudioUnit>, output: &mut AudioUnit)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for FileNode
impl !RefUnwindSafe for FileNode
impl Send for FileNode
impl !Sync for FileNode
impl Unpin for FileNode
impl UnsafeUnpin for FileNode
impl !UnwindSafe for FileNode
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