JuliaAudio / SampledSignals.jl

Core types for regularly-sampled multichannel signals like Audio, RADAR and Software-Defined Radio
Other
75 stars 25 forks source link

Displaying SampleBuf breaks if vector has NaN in it #45

Open ssfrr opened 5 years ago

ssfrr commented 5 years ago

MWE:

julia> SampleBuf([1.0, 1.0, NaN, 2.1], 44100)
4-frame, 1-channel SampleBuf{Float64, 1}
9.070294784580499e-5s sampled at 44100.0HzError showing value of type SampleBuf{Float64,1}:
ERROR: InexactError: trunc(Int64, NaN)
Stacktrace:
 [1] trunc at ./float.jl:693 [inlined]
 [2] _broadcast_getindex_evalf at ./broadcast.jl:574 [inlined]
 [3] _broadcast_getindex at ./broadcast.jl:557 [inlined]
 [4] _getindex at ./broadcast.jl:570 [inlined]
 [5] _broadcast_getindex at ./broadcast.jl:546 [inlined]
 [6] getindex at ./broadcast.jl:507 [inlined]
 [7] macro expansion at ./broadcast.jl:838 [inlined]
 [8] macro expansion at ./simdloop.jl:73 [inlined]
 [9] copyto! at ./broadcast.jl:837 [inlined]
 [10] copyto! at ./broadcast.jl:792 [inlined]
 [11] copy at ./broadcast.jl:768 [inlined]
 [12] materialize at ./broadcast.jl:748 [inlined]
 [13] showchannels(::IOContext{REPL.Terminals.TTYTerminal}, ::SampleBuf{Float64,1}, ::Int64) at /home/sfr/.julia/packages/SampledSignals/g9SOH/src/SampleBuf.jl:191
 [14] showchannels at /home/sfr/.julia/packages/SampledSignals/g9SOH/src/SampleBuf.jl:182 [inlined]
 [15] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::SampleBuf{Float64,1}) at /home/sfr/.julia/packages/SampledSignals/g9SOH/src/SampleBuf.jl:177
...
haberdashPI commented 5 years ago

I ran into this error when testing my pull request branch. I added a very minimal fix for it.

lazarusA commented 5 months ago

@haberdashPI do you still have the minimal fix to this?

haberdashPI commented 5 months ago

You can find it burried in here: https://github.com/JuliaAudio/SampledSignals.jl/pull/44

It's been a while since I've interacted with this repo, so I don't remember exactly where.