Skip to main content

HcaDecoder

Struct HcaDecoder 

Source
pub struct HcaDecoder<R: Read + Seek> { /* private fields */ }
Expand description

High-level HCA decoder wrapping the low-level ClHCA decoder with streaming capabilities

Implementations§

Source§

impl HcaDecoder<File>

Source

pub fn from_file(filename: &str) -> Result<Self, HcaDecoderError>

Create a new HCA decoder from a file path

Source§

impl<R: Read + Seek> HcaDecoder<R>

Source

pub fn from_reader(reader: R) -> Result<Self, HcaDecoderError>

Create a new HCA decoder from a reader

Source

pub fn reset(&mut self)

Reset the decoder to the beginning

Source

pub fn info(&self) -> &HcaInfo

Get the HCA file information

Source

pub fn set_encryption_key(&mut self, keycode: u64, subkey: u64)

Set the decryption key

Source

pub fn decode_frame(&mut self) -> Result<(&[f32], usize), HcaDecoderError>

Decode a single frame and return the samples Returns (samples slice, num samples) or error

Source

pub fn decode_all(&mut self) -> Result<Vec<f32>, HcaDecoderError>

Decode the entire HCA file and return all samples

Source

pub fn seek(&mut self, sample_num: u32)

Seek to a specific sample position

Source

pub fn test_key(&mut self, kt: &mut KeyTest)

Test if a key correctly decrypts the HCA file

Source

pub fn decode_to_wav<W: Write>( &mut self, w: &mut W, ) -> Result<(), HcaDecoderError>

Decode the entire file to 16-bit WAV stream

Auto Trait Implementations§

§

impl<R> Freeze for HcaDecoder<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for HcaDecoder<R>
where R: RefUnwindSafe,

§

impl<R> Send for HcaDecoder<R>
where R: Send,

§

impl<R> Sync for HcaDecoder<R>
where R: Sync,

§

impl<R> Unpin for HcaDecoder<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for HcaDecoder<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for HcaDecoder<R>
where R: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.