mirror of
https://github.com/ivabus/rinth
synced 2024-11-22 00:15:08 +03:00
FM: fix "clicks"
Signed-off-by: Ivan Bushchik <ivabus@ivabus.dev>
This commit is contained in:
parent
1aff34a06a
commit
26fcf5741b
1 changed files with 3 additions and 4 deletions
|
@ -16,7 +16,7 @@ pub struct ModulationFreq(f32);
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct FrequencyDeviation(f32);
|
pub struct FrequencyDeviation(f32);
|
||||||
|
|
||||||
const FIGHT_CLICKS: usize = 128;
|
const FIGHT_CLICKS: usize = 256;
|
||||||
|
|
||||||
impl Synth for FM {
|
impl Synth for FM {
|
||||||
fn from_channel(channel: Channel, bpm: u16) -> Self
|
fn from_channel(channel: Channel, bpm: u16) -> Self
|
||||||
|
@ -84,9 +84,8 @@ impl Synth for FM {
|
||||||
// This makes a little linear fade-in-out so we don't get "clicks"
|
// This makes a little linear fade-in-out so we don't get "clicks"
|
||||||
* if k <= FIGHT_CLICKS {
|
* if k <= FIGHT_CLICKS {
|
||||||
k as f32 / FIGHT_CLICKS as f32
|
k as f32 / FIGHT_CLICKS as f32
|
||||||
} else if k
|
} else if samples - k
|
||||||
>= samples
|
<= FIGHT_CLICKS
|
||||||
- FIGHT_CLICKS
|
|
||||||
{
|
{
|
||||||
(samples
|
(samples
|
||||||
- k) as f32 / FIGHT_CLICKS as f32
|
- k) as f32 / FIGHT_CLICKS as f32
|
||||||
|
|
Loading…
Reference in a new issue