. using OSC in modules (error? )

Modules and scripting

Moderator: Garagecube

. using OSC in modules (error? )

Postby anomad » Tue Apr 07, 2015 9:08 pm

. i've just downloaded Modul8 v2.9 and have been playing around with the built in OSC support. however, i'm getting some unexpected results and i'm not sure if i'm doing something wrong…

. i've modified the OSC native (global) module and added some new code into DirectEvent

. i then created a basic template in Touch OSC to send a button, fader, and toggle

Code: Select all
if oscReceive and type == 'OSC':
   
   addr = param['address']
   args   = param['args']
   
   if log : print "RECEIVE : ", param
   try:
       oscToModul8(param['address'], param['args'])
   except:
      pass
   
   if addr == '/1/push1' :
      modul8.setValue('ctrl_master_invColor', args ,10)
   if addr == '/1/fader1' :
      modul8.setValue('ctrl_layer_scale_uniform', args, 1)
   if addr == '/1/toggle1' :
      modul8.setValue('ctrl_layer_pixelFX_blurOn', args, 1)


. the '/1/push1' works as expected, when i press the button the output is inverted and when i let it go, it goes back to normal - however, it leaves the 'INVERT' button on the GUI highlighted - (probably b/c it's just running invert_output_colorR/G/B ??)

. however, '/1/fader1' causes the scale on layer 1 to jump to full and not move at all. when i run the log, the incoming data looks correct :

Code: Select all
RECEIVE :  {'timestamp': 978979.76699999999, 'args': [0.87362635135650635], 'address': '/1/fader1'}
RECEIVE :  {'timestamp': 978979.78799999994, 'args': [0.86538463830947876], 'address': '/1/fader1'}
RECEIVE :  {'timestamp': 978979.80099999998, 'args': [0.85439562797546387], 'address': '/1/fader1'}
RECEIVE :  {'timestamp': 978979.81700000004, 'args': [0.84340661764144897], 'address': '/1/fader1'}
RECEIVE :  {'timestamp': 978979.83400000003, 'args': [0.83241760730743408], 'address': '/1/fader1'}
RECEIVE :  {'timestamp': 978979.85100000002, 'args': [0.82417583465576172], 'address': '/1/fader1'}
RECEIVE :  {'timestamp': 978979.86699999997, 'args': [0.81868129968643188], 'address': '/1/fader1'}
RECEIVE :  {'timestamp': 978979.88399999996, 'args': [0.81318682432174683], 'address': '/1/fader1'}


. and toggle only turns something on, but never off even though it's sending 'address' as 0.0

. am i missing something basic here ?


-james
(a nomad. )
anomad
master
 
Posts: 411
Joined: Sun Oct 21, 2007 10:07 pm
Location: north cakalacky, usa

Re: . using OSC in modules (error? )

Postby anomad » Wed Apr 08, 2015 3:16 am

. d'oh ! it didn't occur to me that 'args' would be an array… :oops: it should be

Code: Select all
args   = param['args'][0]


. and everything works as expected


-james
(a nomad. )
anomad
master
 
Posts: 411
Joined: Sun Oct 21, 2007 10:07 pm
Location: north cakalacky, usa


Return to Modules

Who is online

Users browsing this forum: No registered users and 1 guest

cron