mirror of
https://github.com/SleepingInsomniac/pixelfaucet
synced 2025-01-23 07:27:17 +01:00
Add volume
This commit is contained in:
parent
ab9176c00d
commit
55f9ce35f4
1 changed files with 4 additions and 2 deletions
|
@ -60,13 +60,15 @@ module PF
|
|||
property started_at : Float64
|
||||
property wave : Wave
|
||||
property released_at : Float64? = nil
|
||||
property volume : Float64 = 1.0
|
||||
|
||||
def initialize(@hertz, @envelope, @started_at, @wave = Sound.sin_wave)
|
||||
def initialize(@hertz, @envelope, @started_at, @volume = 1.0, @wave = Sound.sin_wave)
|
||||
end
|
||||
|
||||
def sample(time : Float64)
|
||||
@wave.call(time - @started_at, @hertz) *
|
||||
@envelope.amplitude(time, @started_at, @released_at)
|
||||
@envelope.amplitude(time, @started_at, @released_at) *
|
||||
@volume
|
||||
end
|
||||
|
||||
def release!(time : Float64)
|
||||
|
|
Loading…
Add table
Reference in a new issue