pub struct MockAudioHandlerTrait { /* private fields */ }Expand description
Abstraction over the audio I/O handler used by AudioService.
Using the MockAudioHandlerTrait generated by mockall allows the audio pipeline to be tested without real hardware.
Implementations§
Source§impl MockAudioHandlerTrait
impl MockAudioHandlerTrait
Sourcepub fn checkpoint(&mut self)
pub fn checkpoint(&mut self)
Validate that all current expectations for all methods have been satisfied, and discard them.
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new mock object with no expectations.
This method will not be generated if the real struct
already has a new method. However, it will be
generated if the struct implements a trait with a new
method. The trait’s new method can still be called
like <MockX as TraitY>::new
Source§impl MockAudioHandlerTrait
impl MockAudioHandlerTrait
Sourcepub fn expect_build_input_stream(&mut self) -> &mut Expectation
pub fn expect_build_input_stream(&mut self) -> &mut Expectation
Create an Expectation for mocking the build_input_stream method
Sourcepub fn expect_build_output_stream(&mut self) -> &mut Expectation
pub fn expect_build_output_stream(&mut self) -> &mut Expectation
Create an Expectation for mocking the build_output_stream method
Sourcepub fn expect_input_device(&mut self) -> &mut Expectation
pub fn expect_input_device(&mut self) -> &mut Expectation
Create an Expectation for mocking the input_device method
Sourcepub fn expect_output_device(&mut self) -> &mut Expectation
pub fn expect_output_device(&mut self) -> &mut Expectation
Create an Expectation for mocking the output_device method
Sourcepub fn expect_input_config(&mut self) -> &mut Expectation
pub fn expect_input_config(&mut self) -> &mut Expectation
Create an Expectation for mocking the input_config method
Sourcepub fn expect_output_config(&mut self) -> &mut Expectation
pub fn expect_output_config(&mut self) -> &mut Expectation
Create an Expectation for mocking the output_config method
Sourcepub fn expect_input_sample_rate(&mut self) -> &mut Expectation
pub fn expect_input_sample_rate(&mut self) -> &mut Expectation
Create an Expectation for mocking the input_sample_rate method
Sourcepub fn expect_output_sample_rate(&mut self) -> &mut Expectation
pub fn expect_output_sample_rate(&mut self) -> &mut Expectation
Create an Expectation for mocking the output_sample_rate method
Trait Implementations§
Source§impl AudioHandlerTrait for MockAudioHandlerTrait
Abstraction over the audio I/O handler used by AudioService.
impl AudioHandlerTrait for MockAudioHandlerTrait
Abstraction over the audio I/O handler used by AudioService.
Using the MockAudioHandlerTrait generated by mockall allows the audio pipeline to be tested without real hardware.
Source§fn build_input_stream(&self, prod: HeapProd<f32>) -> Box<dyn PlayableStream>
fn build_input_stream(&self, prod: HeapProd<f32>) -> Box<dyn PlayableStream>
Builds and returns a started-ready input stream that pushes captured
samples into prod (producer).
§Arguments
prod- The ring-buffer producer that receives rawf32audio samples.
Source§fn build_output_stream(&self, cons: HeapCons<f32>) -> Box<dyn PlayableStream>
fn build_output_stream(&self, cons: HeapCons<f32>) -> Box<dyn PlayableStream>
Builds and returns a started-ready output stream that drains samples
from cons (consumer) and sends them to the output device.
Slots in the output buffer that have no corresponding sample are
filled with silence (0.0).
§Arguments
cons- The ring-buffer consumer that supplies processedf32audio samples.
Source§fn input_device(&self) -> &Device
fn input_device(&self) -> &Device
Returns a reference to the CPAL input device used by this handler.
Source§fn output_device(&self) -> &Device
fn output_device(&self) -> &Device
Returns a reference to the CPAL output device used by this handler.
Source§fn input_config(&self) -> &StreamConfig
fn input_config(&self) -> &StreamConfig
Returns the [StreamConfig] used for the input stream.
Source§fn output_config(&self) -> &StreamConfig
fn output_config(&self) -> &StreamConfig
Returns the [StreamConfig] used for the output stream.
Source§fn input_sample_rate(&self) -> u32
fn input_sample_rate(&self) -> u32
Returns the configured input sample rate in Hz.
Source§fn output_sample_rate(&self) -> u32
fn output_sample_rate(&self) -> u32
Returns the configured output sample rate in Hz.