From 55845defac7071b894aa34bec0ffe3ae3ec1ad7d Mon Sep 17 00:00:00 2001 From: Spencer Russell Date: Mon, 18 Nov 2019 22:25:29 -0500 Subject: [PATCH] Some Project.toml tweaks and fixes #52 --- Project.toml | 21 +++++++++++---------- src/SampleBuf.jl | 4 ++-- src/SampleStream.jl | 2 +- src/units.jl | 4 ++-- test/Project.toml | 7 ------- test/REQUIRE | 7 ------- 6 files changed, 16 insertions(+), 29 deletions(-) delete mode 100644 test/Project.toml delete mode 100644 test/REQUIRE diff --git a/Project.toml b/Project.toml index 70bff8e..ffbf4cf 100644 --- a/Project.toml +++ b/Project.toml @@ -12,22 +12,23 @@ TreeViews = "a2a6695c-b41b-5b7d-aed9-dbfdeacea5d7" Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [compat] -Compat = "≥ 0.59.0" -DSP = "≥ 0.4.0" -FFTW = "≥ 0.0.4" -FixedPointNumbers = "≥ 0.4.6" -IntervalSets = "≥ 0.2.0" -Unitful = "≥ 0.8.0" -julia = "≥ 0.6.0" +Compat = "2" +DSP = "0.6.1" +FFTW = "1.1.0" +FixedPointNumbers = "0.6.1" +IntervalSets = "0.3.2" +Unitful = "0.17.0" +julia = "1" [extras] DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2" -FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" FixedPointNumbers = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" -Gumbo = "708ec375-b3d6-5a57-a7ce-8257bf98657a" LibSndFile = "b13ce0c6-77b0-50c6-a2db-140568b8d1a5" Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" +Compat = "34da2185-b29b-5c13-b0c7-acf172513d20" +SampledSignals = "bd7594eb-a658-542f-9e75-4c4d8908c167" +TreeViews = "a2a6695c-b41b-5b7d-aed9-dbfdeacea5d7" [targets] -test = ["LibSndFile", "FileIO", "Unitful", "DSP", "Gumbo", "FixedPointNumbers", "FFTW"] +test = ["DSP", "FileIO", "FixedPointNumbers", "LibSndFile", "Unitful", "Compat", "SampledSignals", "TreeViews"] diff --git a/src/SampleBuf.jl b/src/SampleBuf.jl index 6e499c7..85f22a3 100644 --- a/src/SampleBuf.jl +++ b/src/SampleBuf.jl @@ -278,11 +278,11 @@ function toindex end toindex(buf::SampleBuf, t::Number) = t toindex(buf::SampleBuf, t::FrameQuant) = inframes(Int, t) + 1 toindex(buf::SampleBuf, t::Unitful.Time) = inframes(Int, t, samplerate(buf)) + 1 -toindex(buf::SampleBuf, t::Quantity) = throw(Unitful.DimensionError(t, s)) +toindex(buf::SampleBuf, t::Unitful.AbstractQuantity) = throw(Unitful.DimensionError(t, s)) toindex(buf::SpectrumBuf, f::Number) = f toindex(buf::SpectrumBuf, f::FrameQuant) = inframes(Int, f) + 1 toindex(buf::SpectrumBuf, f::Unitful.Frequency) = inframes(Int, f, samplerate(buf)) + 1 -toindex(buf::SpectrumBuf, f::Quantity) = throw(Unitful.DimensionError(f, Hz)) +toindex(buf::SpectrumBuf, f::Unitful.AbstractQuantity) = throw(Unitful.DimensionError(f, Hz)) # indexing by vectors of Quantities not yet supported toindex(buf::AbstractSampleBuf, I::ClosedInterval{Int}) = diff --git a/src/SampleStream.jl b/src/SampleStream.jl index 6fed407..db6a838 100644 --- a/src/SampleStream.jl +++ b/src/SampleStream.jl @@ -71,7 +71,7 @@ const DEFAULT_BLOCKSIZE=4096 function Base.write(sink::SampleSink, source::SampleSource, duration::Quantity; blocksize=-1) sr = samplerate(sink) - frames = trunc(Int, inseconds(duration) * sr) + frames = trunc(Int, inseconds(duration, sr) * sr) n = write(sink, source, frames; blocksize=blocksize) # if we completed the operation return back the original duration so the diff --git a/src/units.jl b/src/units.jl index 0e7e954..d265c9b 100644 --- a/src/units.jl +++ b/src/units.jl @@ -29,8 +29,8 @@ inframes(time::Unitful.Time, rate) = inseconds(time)*inHz(rate) inframes(::Type{T}, freq::Unitful.Frequency, rate) where T <: Integer = round(T, inHz(freq)*inseconds(rate)) inframes(freq::Unitful.Frequency, rate) = inHz(freq)*inseconds(rate) -inframes(::Type, frame::Quantity) = error("Unknown sample rate") -inframes(frame::Quantity) = error("Unknown sample rate") +inframes(::Type, frame::Unitful.AbstractQuantity) = error("Unknown sample rate") +inframes(frame::Unitful.AbstractQuantity) = error("Unknown sample rate") inframes(::Type{T}, frame::Real) where T = T(frame) inframes(frame::Real) = frame diff --git a/test/Project.toml b/test/Project.toml deleted file mode 100644 index 4b9aeb4..0000000 --- a/test/Project.toml +++ /dev/null @@ -1,7 +0,0 @@ -[deps] -DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2" -FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" -FixedPointNumbers = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" -LibSndFile = "b13ce0c6-77b0-50c6-a2db-140568b8d1a5" -SampledSignals = "bd7594eb-a658-542f-9e75-4c4d8908c167" -TreeViews = "a2a6695c-b41b-5b7d-aed9-dbfdeacea5d7" diff --git a/test/REQUIRE b/test/REQUIRE deleted file mode 100644 index 95b73da..0000000 --- a/test/REQUIRE +++ /dev/null @@ -1,7 +0,0 @@ -FixedPointNumbers -LibSndFile -DSP -FileIO -Gumbo -Unitful -FFTW