diff --git a/src/OSC.jl b/src/OSC.jl index f7e6970..4044744 100644 --- a/src/OSC.jl +++ b/src/OSC.jl @@ -25,7 +25,7 @@ macro incfp(x) quote begin gensym_ end end end -type OscMsg +struct OscMsg data::Array{UInt8} end @@ -263,7 +263,7 @@ function rtosc_argument(msg::OscMsg, idx::Int) return t end elseif typeChar in "f" - return reinterpret(Float32,msg.data[arg_pos+(3:-1:0)])[1] + return read(IOBuffer(msg.data[arg_pos+(3:-1:0)]), Float32) elseif typeChar in "rci" i::UInt32 = 0 i |= (UInt32(msg.data[@incfp(arg_pos)]) << 24) @@ -323,12 +323,12 @@ function showField(io::IO, msg::OscMsg, arg_id) 'm' :Midi; 'T' true; 'F' false; + 'I' Inf; 'N' Void] dict = Dict{Char, Any}(zip(Vector{Char}(map[:,1][:]),map[:,2][:])) - dict['I'] = Inf typeChar::Char = argType(msg, arg_id) value = msg[arg_id] - if issubtype(typeof(value), Array) + if typeof(value) <: Array value = value' end @printf(io, " #%2d %c:", arg_id, typeChar) diff --git a/test/runtests.jl b/test/runtests.jl index e6fb14f..392fca1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -23,11 +23,11 @@ test_type = length(ARGS) == 1 ? ARGS[1] : "ALL" #buffer = Array(UInt8,1024) #buf_size = rtosc_amessage(buffer, 1024, "/random/address", "sif", -# "string", 0xdeadbeef, float32(12.0)) +# "string", 0xdeadbeef, Float32(12.0)) #println() ##println(buffer) #println(string(map(x->(hex(x,2)), buffer[1:buf_size])...)) -#println(string(map(x->(isprint(char(x&0x7f)) ? string(char(x&0x7f)," ") : ". "), buffer[1:buf_size])...)) +#println(string(map(x->(isprint(Char(x&0x7f)) ? string(Char(x&0x7f)," ") : ". "), buffer[1:buf_size])...)) #println("argument string is=", rtosc_argument_string(buffer)) # #println("arg 0=", rtosc_argument(buffer, 0)) @@ -57,7 +57,7 @@ function test_it_fat() show(msg) #println(string(map(x->(hex(x,2)), buffer[1:len])...)) - #println(string(map(x->(isprint(char(x&0x7f)) ? string(char(x&0x7f)," ") : ". "), buffer[1:len])...)) + #println(string(map(x->(isprint(Char(x&0x7f)) ? string(Char(x&0x7f)," ") : ". "), buffer[1:len])...)) #println("argument string is=", rtosc_argument_string(buffer)) @test msg[1] == i