osc.js icon indicating copy to clipboard operation
osc.js copied to clipboard

How to send boolean?

Open dewiweb opened this issue 2 years ago • 1 comments

Hello, I want to know how to send boolean value? 'i' = integer 'f' = float 's' = string but 'b' = blob and nothing for boolean

dewiweb avatar Mar 28 '23 20:03 dewiweb

In the Open Sound Control spec, boolean values are defined by two different type tags, "T" (for true) and "F" (for false). You can specify these strings in the type field in your osc.js message argument object. If you're using osc.js' type inference feature with metadata: false (not recommended) you can get away with just supply a boolean directly.

For example:

{
    address: "/foo",
    args: [
        {
            type: "T",
            value: true
        }
    ]
}

colinbdclark avatar Mar 28 '23 20:03 colinbdclark