mirror of
https://github.com/RustAudio/rodio
synced 2024-12-13 21:52:38 +00:00
Periodic access on the first sample & accurate for multi-channel sources
This commit is contained in:
parent
8dd11878ff
commit
dba627a1b4
1 changed files with 3 additions and 2 deletions
|
@ -12,13 +12,14 @@ where
|
|||
// TODO: handle the fact that the samples rate can change
|
||||
// TODO: generally, just wrong
|
||||
let update_ms = period.as_secs() as u32 * 1_000 + period.subsec_nanos() / 1_000_000;
|
||||
let update_frequency = (update_ms * source.sample_rate()) / 1000;
|
||||
let sample_rate = source.sample_rate() * source.channels() as u32;
|
||||
let update_frequency = (update_ms * sample_rate) / 1000;
|
||||
|
||||
PeriodicAccess {
|
||||
input: source,
|
||||
modifier: modifier,
|
||||
update_frequency: update_frequency,
|
||||
samples_until_update: update_frequency,
|
||||
samples_until_update: 1,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue