Skip to content

Commit

Permalink
fixed inadvertant bug in show for ramp functions
Browse files Browse the repository at this point in the history
  • Loading branch information
haberdashPI committed Oct 31, 2019
1 parent 72c3962 commit a0b8ba1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/ramps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Base.string(x::RampOnFn) = string("rampon_fn(",x.time,",",x.ramp,")")
rampon(x,[len=10ms],[fn=x -> sinpi(0.5x)])
Ramp the onset of a signal, smoothly transitioning from 0 to full amplitude
over the course of `len` seconds.
over the course of `len` seconds.
The function determines the shape of the ramp and should be non-decreasing
with a range of [0,1] over the domain [0,1]. It should map over the entire
Expand Down Expand Up @@ -53,9 +53,9 @@ struct RampOffFn{Fn,S,T} <: Functor
ramp_start::S
time::T
end
(fn::RampOffFn)(t) =
t < fn.ramp_start ? 1.0 : fn.ramp(1.0 - (t-fn.ramp_start)/fn.time)
Base.string(x::RampOffFn{<:typeof(sinramp)}) = string("rampoff_fn(",x.time,")")
(fn::RampOffFn{El})(t) where El =
t < fn.ramp_start ? one(El) : El(fn.ramp(1.0 - (t-fn.ramp_start)/fn.time))
Base.string(x::RampOffFn{<:Any,<:typeof(sinramp)}) = string("rampoff_fn(",x.time,")")
Base.string(x::RampOffFn) = string("rampoff_fn(",x.time,",",x.ramp,")")

"""
Expand Down Expand Up @@ -112,7 +112,7 @@ Append x to y, with a smooth transition lasting `len` seconds fading from
This fade is accomplished with a [`rampoff`](@ref) of `x` and a
[`rampon`](@ref) for `y`. `fn` should be non-decreasing with a range of [0,1]
over the domain [0,1]. It should map over the entire range: that is
over the domain [0,1]. It should map over the entire range: that is
`fn(0) == 0` and `fn(1) == 1`.
Both `len` and `fn` are optional arguments: either one or both can be
Expand Down
3 changes: 1 addition & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ example_wav = "example.wav"
examples_wav = "examples.wav"
test_files = [test_wav,example_wav,examples_wav]

const total_test_groups = 29
const total_test_groups = 28
progress = Progress(total_test_groups,desc="Running tests")

@testset "SignalOperators.jl" begin
Expand Down Expand Up @@ -534,7 +534,6 @@ progress = Progress(total_test_groups,desc="Running tests")
show(io,MIME("text/plain"),x)
String(take!(io))
end
next!(progress)

@testset "Handle printing" begin
x = signal(rand(100,2),10Hz)
Expand Down

0 comments on commit a0b8ba1

Please sign in to comment.