Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- `DeviceBusy` error variant to `SupportedStreamConfigsError`, `DefaultStreamConfigError`, and
`BuildStreamError` for retryable device access errors (EBUSY, EAGAIN).
- `StreamConfig` now implements `Copy`.
- **PulseAudio**: New host for Linux and some BSDs using the PulseAudio API.

### Changed
Expand Down
2 changes: 1 addition & 1 deletion src/host/alsa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ impl Device {
channel: handle,
sample_format,
num_descriptors,
conf: conf.clone(),
conf: *conf,
period_samples,
period_frames,
silence_template,
Expand Down
4 changes: 2 additions & 2 deletions src/host/asio/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl Device {

// Set the input callback.
// This is most performance critical part of the ASIO bindings.
let config = config.clone();
let config = *config;
let callback_id = driver.add_callback(move |callback_info| unsafe {
// If not playing return early.
if !playing.load(Ordering::SeqCst) {
Expand Down Expand Up @@ -323,7 +323,7 @@ impl Device {
let playing = Arc::clone(&stream_playing);
let asio_streams = self.asio_streams.clone();

let config = config.clone();
let config = *config;
let callback_id = driver.add_callback(move |callback_info| unsafe {
// If not playing, return early.
if !playing.load(Ordering::SeqCst) {
Expand Down
2 changes: 0 additions & 2 deletions src/host/audioworklet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ impl DeviceTrait for Device {
return Err(BuildStreamError::StreamConfigNotSupported);
}

let config = config.clone();

let stream_opts = web_sys::AudioContextOptions::new();
stream_opts.set_sample_rate(config.sample_rate as f32);

Expand Down
2 changes: 1 addition & 1 deletion src/host/emscripten/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ fn set_timeout<D>(
.expect("The function was somehow not a function"),
time,
&stream.into(),
&((*config).clone()).into(),
&(*config).into(),
&Closure::once_into_js(move || sample_format),
&buffer_size_frames.into(),
)
Expand Down
4 changes: 2 additions & 2 deletions src/host/wasapi/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ impl Device {
playing: false,
max_frames_in_buffer,
bytes_per_frame: waveformatex.nBlockAlign,
config: config.clone(),
config: *config,
sample_format,
})
}
Expand Down Expand Up @@ -877,7 +877,7 @@ impl Device {
playing: false,
max_frames_in_buffer,
bytes_per_frame: waveformatex.nBlockAlign,
config: config.clone(),
config: *config,
sample_format,
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/host/webaudio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ impl DeviceTrait for Device {
Ok(Stream {
ctx,
on_ended_closures,
config: config.clone(),
config: *config,
buffer_size_frames,
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ impl wasm_bindgen::convert::FromWasmAbi for BufferSize {
),
wasm_bindgen
)]
#[derive(Clone, Debug, Eq, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq, Copy)]
pub struct StreamConfig {
pub channels: ChannelCount,
pub sample_rate: SampleRate,
Expand Down