adds path method to OscMsg that return the OSC path
This commit is contained in:
parent
67c26b7742
commit
50027a0dcb
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
module OSC
|
module OSC
|
||||||
import Base.show
|
import Base.show
|
||||||
export OscMsg
|
export OscMsg, path
|
||||||
macro incfp(x) quote begin
|
macro incfp(x) quote begin
|
||||||
local gensym_ = $(esc(x))
|
local gensym_ = $(esc(x))
|
||||||
$(esc(x)) = $(esc(x))+1
|
$(esc(x)) = $(esc(x))+1
|
||||||
|
@ -27,6 +27,8 @@ type OscMsg
|
||||||
data::Array{Uint8}
|
data::Array{Uint8}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
path(msg::OscMsg) = stringify(msg.data)
|
||||||
|
|
||||||
function stringify(data::Array{Uint8})
|
function stringify(data::Array{Uint8})
|
||||||
zeroInd = find(data.== 0)
|
zeroInd = find(data.== 0)
|
||||||
if(length(zeroInd) == 0)
|
if(length(zeroInd) == 0)
|
||||||
|
|
|
@ -124,8 +124,14 @@ function test_it_osc_spec()
|
||||||
show(osc)
|
show(osc)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function test_path()
|
||||||
|
osc = OscMsg("/foo", "f", float32(1.234))
|
||||||
|
@test path(osc) == "/foo"
|
||||||
|
end
|
||||||
|
|
||||||
if test_type in ["ALL", "TEST", "INSTALL"]
|
if test_type in ["ALL", "TEST", "INSTALL"]
|
||||||
test_it_osc_spec()
|
test_it_osc_spec()
|
||||||
test_it_fat()
|
test_it_fat()
|
||||||
|
test_path()
|
||||||
println("Done...")
|
println("Done...")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue