pub struct Wav { /* private fields */ }Implementations§
Source§impl Wav
impl Wav
Sourcepub fn new(path: &str) -> WavResult<Self>
pub fn new(path: &str) -> WavResult<Self>
Creates a wav decoder from a local path or an HTTP(S) URL.
§Example
use std::time::Instant;
use wav2json::Wav;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Support for local and network files.
// let mut wav = Wav::new("http://[host]/sample-15s.wav")?.set_json_width(1920);
let start = Instant::now();
let mut wav = Wav::new("examples/sample-15s.wav")?.set_json_width(1920);
let result_data = wav.decode()?;
println!("duration: {}", start.elapsed().as_millis());
println!("points: {}", result_data.len());
Ok(())
}Sourcepub fn set_json_width(self, width: u32) -> Self
pub fn set_json_width(self, width: u32) -> Self
Sets the number of json points generated by decoding.
The recommendation is determined by the horizontal pixels of the screen or browser.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Wav
impl !UnwindSafe for Wav
impl Freeze for Wav
impl Send for Wav
impl Sync for Wav
impl Unpin for Wav
impl UnsafeUnpin for Wav
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