[PD] unpack type mismatch?

Hans-Christoph Steiner hans at at.or.at
Thu Feb 16 19:49:40 CET 2012


On Thu, 2012-02-16 at 18:37 +0100, Roman Haefeli wrote:
> On Thu, 2012-02-16 at 10:23 +0100, Christoph Kuhr wrote:
> > Hi,
> > 
> > i route OSC messages an then unpack it.
> > 
> > [unpack 0 0 0 0]
> > 
> > with one OSC controller i get the error:
> > 
> > error: unpack: type mismatch
> > unpacked: 3 14.8743 14.0385 20
> > 
> > 
> > with another OSC Controller nothing:
> > 
> > unpacked: 3 85.539 85.3286 20
> > unpacked: 3 15.0827 85.9539 20
> > 
> > 
> > why does unpack behave like that?
> 
> It might be that the controller is sending the numbers as strings
> instead of floats or ints. [unpackOSC] will then just output them as
> symbol elements. 
> 
> If that really is the case, you might be able to convert those
> symbol-numbers to floats with zexy's [atof] which was added just a few
> minutes ago. Check zexy from svn.

What if this was handled in [float]?  Something like this:

- add a symbol method to [float]

- convert the symbol to a float, then back and compare

- if it matches, output the float out of the left inlet

- if it does not match, output the original symbol out of a new right
outlet, which would be an "everything else" outlet like [select]
[route], etc.

.hc




More information about the Pd-list mailing list