cargo fmt fix
This commit is contained in:
parent
7c1adce330
commit
9c85eecb59
|
@ -386,11 +386,11 @@ impl Driver {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the min and max supported buffersize of the driver.
|
/// Get the min and max supported buffersize of the driver.
|
||||||
pub fn buffersize_range(&self) -> Result<(c_long, c_long), AsioError> {
|
pub fn buffersize_range(&self) -> Result<(c_long, c_long), AsioError> {
|
||||||
let buffer_sizes = asio_get_buffer_sizes()?;
|
let buffer_sizes = asio_get_buffer_sizes()?;
|
||||||
let min = buffer_sizes.min;
|
let min = buffer_sizes.min;
|
||||||
let max = buffer_sizes.max;
|
let max = buffer_sizes.max;
|
||||||
Ok((min, max))
|
Ok((min, max))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get current sample rate of the driver.
|
/// Get current sample rate of the driver.
|
||||||
|
@ -442,7 +442,11 @@ impl Driver {
|
||||||
/// If buffersize is None then the preferred buffer size from ASIO is used,
|
/// If buffersize is None then the preferred buffer size from ASIO is used,
|
||||||
/// otherwise the desired buffersize is used if the requeted size is within
|
/// otherwise the desired buffersize is used if the requeted size is within
|
||||||
/// the range of accepted buffersizes for the device.
|
/// the range of accepted buffersizes for the device.
|
||||||
fn create_buffers(&self, buffer_infos: &mut [AsioBufferInfo], buffer_size: Option<i32>) -> Result<c_long, AsioError> {
|
fn create_buffers(
|
||||||
|
&self,
|
||||||
|
buffer_infos: &mut [AsioBufferInfo],
|
||||||
|
buffer_size: Option<i32>,
|
||||||
|
) -> Result<c_long, AsioError> {
|
||||||
let num_channels = buffer_infos.len();
|
let num_channels = buffer_infos.len();
|
||||||
|
|
||||||
// To pass as ai::ASIOCallbacks
|
// To pass as ai::ASIOCallbacks
|
||||||
|
@ -464,9 +468,9 @@ impl Driver {
|
||||||
if v <= buffer_sizes.max {
|
if v <= buffer_sizes.max {
|
||||||
v
|
v
|
||||||
} else {
|
} else {
|
||||||
return Err(AsioError::InvalidBufferSize)
|
return Err(AsioError::InvalidBufferSize);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
None => buffer_sizes.pref,
|
None => buffer_sizes.pref,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -492,9 +496,9 @@ impl Driver {
|
||||||
|
|
||||||
/// Creates the streams.
|
/// Creates the streams.
|
||||||
///
|
///
|
||||||
/// `buffer_size` sets the desired buffer_size. If None is passed in, then the
|
/// `buffer_size` sets the desired buffer_size. If None is passed in, then the
|
||||||
/// default buffersize for the device is used.
|
/// default buffersize for the device is used.
|
||||||
///
|
///
|
||||||
/// Both input and output streams need to be created together as a single slice of
|
/// Both input and output streams need to be created together as a single slice of
|
||||||
/// `ASIOBufferInfo`.
|
/// `ASIOBufferInfo`.
|
||||||
fn create_streams(
|
fn create_streams(
|
||||||
|
@ -561,8 +565,8 @@ impl Driver {
|
||||||
/// For this reason we take the output stream if it exists.
|
/// For this reason we take the output stream if it exists.
|
||||||
///
|
///
|
||||||
/// `num_channels` is the desired number of input channels.
|
/// `num_channels` is the desired number of input channels.
|
||||||
///
|
///
|
||||||
/// `buffer_size` sets the desired buffer_size. If None is passed in, then the
|
/// `buffer_size` sets the desired buffer_size. If None is passed in, then the
|
||||||
/// default buffersize for the device is used.
|
/// default buffersize for the device is used.
|
||||||
///
|
///
|
||||||
/// This returns a full AsioStreams with both input and output if output was active.
|
/// This returns a full AsioStreams with both input and output if output was active.
|
||||||
|
@ -588,9 +592,9 @@ impl Driver {
|
||||||
///
|
///
|
||||||
/// `num_channels` is the desired number of output channels.
|
/// `num_channels` is the desired number of output channels.
|
||||||
///
|
///
|
||||||
/// `buffer_size` sets the desired buffer_size. If None is passed in, then the
|
/// `buffer_size` sets the desired buffer_size. If None is passed in, then the
|
||||||
/// default buffersize for the device is used.
|
/// default buffersize for the device is used.
|
||||||
///
|
///
|
||||||
/// This returns a full AsioStreams with both input and output if input was active.
|
/// This returns a full AsioStreams with both input and output if input was active.
|
||||||
pub fn prepare_output_stream(
|
pub fn prepare_output_stream(
|
||||||
&self,
|
&self,
|
||||||
|
|
|
@ -59,4 +59,4 @@ where
|
||||||
*sample = value;
|
*sample = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,4 +105,4 @@ fn main() -> Result<(), anyhow::Error> {
|
||||||
|
|
||||||
fn err_fn(err: cpal::StreamError) {
|
fn err_fn(err: cpal::StreamError) {
|
||||||
eprintln!("an error occurred on stream: {}", err);
|
eprintln!("an error occurred on stream: {}", err);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue