ControlFunctions

Trait ControlFunctions 

Source
pub trait ControlFunctions: Sealed {
Show 26 methods // Required method unsafe fn ctl( &mut self, request: i32, ptr: *mut c_void, ) -> Result<(), ControlError>; // Provided methods fn check_error( err_code: i32, param: Option<i32>, ) -> Result<(), ControlError> { ... } fn get_frame_size(&mut self) -> i32 { ... } fn set_vbr(&mut self, vbr: bool) { ... } fn get_vbr(&mut self) -> bool { ... } fn set_vbr_quality(&mut self, quality: f32) { ... } fn get_vbr_quality(&mut self) -> f32 { ... } fn set_vad(&mut self, vad: bool) { ... } fn get_vad(&mut self) -> bool { ... } fn set_abr(&mut self, abr: i32) { ... } fn get_abr(&mut self) -> i32 { ... } fn set_quality(&mut self, quality: i32) { ... } fn set_bitrate(&mut self, bitrate: i32) { ... } fn get_bitrate(&mut self) -> i32 { ... } fn set_sampling_rate(&mut self, samplingrate: i32) { ... } fn get_sampling_rate(&mut self) -> i32 { ... } fn reset_state(&mut self) { ... } fn set_submode_encoding(&mut self, submode: bool) { ... } fn get_submode_encoding(&mut self) -> bool { ... } fn get_lookahead(&mut self) -> i32 { ... } fn set_plc_tuning(&mut self, tuning: i32) { ... } fn get_plc_tuning(&mut self) -> i32 { ... } fn set_vbr_max_bitrate(&mut self, max_bitrate: i32) { ... } fn get_vbr_max_bitrate(&mut self) -> i32 { ... } fn set_highpass(&mut self, highpass: bool) { ... } fn get_highpass(&mut self) -> bool { ... }
}
Expand description

Trait for the control functions of the encoder and decoder

This trait is implemented for both the encoder and decoder, and provides a common interface for the control functions of both.

ctl is the only function that needs to be implemented, and is used to call the control functions of the underlying speex library.

This trait is sealed, and cannot be implemented outside of this crate.

Required Methods§

Source

unsafe fn ctl( &mut self, request: i32, ptr: *mut c_void, ) -> Result<(), ControlError>

Calls a control function of the underlying speex library

§Safety

Implementations of this function call the control functions of the underlying speex library, and as such are unsafe. The caller must ensure that the parameters passed to this function are valid.

Provided Methods§

Source

fn check_error(err_code: i32, param: Option<i32>) -> Result<(), ControlError>

Internal function used to convert the error codes returned by the control function into a result type

Source

fn get_frame_size(&mut self) -> i32

Gets the frame size (in samples) of the encoder/decoder

Source

fn set_vbr(&mut self, vbr: bool)

Sets whether Variable BitRate is enabled or not

Source

fn get_vbr(&mut self) -> bool

Gets whether Variable BitRate is enabled or not

Source

fn set_vbr_quality(&mut self, quality: f32)

Sets the VBR quality of the encoder/decoder

The value should be between 0 and 10, with 10 being the highest quality.

Source

fn get_vbr_quality(&mut self) -> f32

Gets the VBR quality of the encoder/decoder

Source

fn set_vad(&mut self, vad: bool)

Sets whether Voice Activity Detection is enabled or not

Source

fn get_vad(&mut self) -> bool

Gets whether Voice Activity Detection is enabled or not

Source

fn set_abr(&mut self, abr: i32)

Sets the Average BitRate of the encoder/decoder

Source

fn get_abr(&mut self) -> i32

Gets the Average BitRate of the encoder/decoder

Source

fn set_quality(&mut self, quality: i32)

Sets the overall quality of the encoder/decoder The value should be between 0 and 10, with 10 being the highest quality. Default is 8.

Source

fn set_bitrate(&mut self, bitrate: i32)

Sets the current bitrate of the encoder/decoder

Source

fn get_bitrate(&mut self) -> i32

Gets the current bitrate of the encoder/decoder

Source

fn set_sampling_rate(&mut self, samplingrate: i32)

Sets the sampling rate used for bitrate computation

Source

fn get_sampling_rate(&mut self) -> i32

Gets the sampling rate used for bitrate computation

Source

fn reset_state(&mut self)

resets the encoder/decoder memories to zero

Source

fn set_submode_encoding(&mut self, submode: bool)

Sets whether submode encoding is done in each frame

Note that false breaks the specification for the format

Source

fn get_submode_encoding(&mut self) -> bool

Gets whether submode encoding is enabled or not

Source

fn get_lookahead(&mut self) -> i32

Gets the lookahead value currently in use by the encoder/decoder

Sum the lookahead of a Speex decoder and the lookahead of a Speex encoder to get the total lookahead.

Source

fn set_plc_tuning(&mut self, tuning: i32)

Sets tuning for Packet-Loss Concealment (expected loss rate)

Source

fn get_plc_tuning(&mut self) -> i32

Gets current Packet-Loss Concealment tuning value

Source

fn set_vbr_max_bitrate(&mut self, max_bitrate: i32)

Sets the max bit-rate allowed in VBR mode

Source

fn get_vbr_max_bitrate(&mut self) -> i32

Gets the max bit-rate allowed in VBR mode

Source

fn set_highpass(&mut self, highpass: bool)

Enables or disables highpass filtering of the input/output

Source

fn get_highpass(&mut self) -> bool

Gets whether highpass filtering of the input/output is enabled

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: CoderMode> ControlFunctions for SpeexDecoder<T>

Source§

impl<T: CoderMode> ControlFunctions for SpeexEncoder<T>