Changes in firmware produce issue with old object


#1

Hi - unfortunately I can't wrap my brain around this one since my C skills are non-existant.

I had a previously modified math/wrap object that replaced the drop down with inputs. While trying to compile a patch with this object on the new firmware and app, I ran into some errors that made me check out the current version of the math/wrap object and it looks very different. What was a simple edit to the code before is now a puzzle to me.

The old math/wrap object had this section in the code:

      <inlets>
         <frac32buffer name="a" description="a"/>
      </inlets>
      <outlets>
         <frac32buffer.positive name="b" description="quant(a)" SumBuffer="false"/>
      </outlets>
      <displays/>
      <params/>
      <attribs>
         <spinner name="bits" MinValue="0" MaxValue="27" DefaultValue="7"/>
      </attribs>
      <code.srate><![CDATA[   %b%= (%a%<<%bits%) & ((1<<27)-1);
]]></code.srate>

I modified it to be:

      <inlets>
         <frac32buffer name="a" description="a"/>
	 <int32 name="bits" description="bits"/>
      </inlets>
      <outlets>
         <frac32buffer.positive name="b" description="quant(a)" SumBuffer="false"/>
      </outlets>
      <displays/>
      <params/>
      <attribs/>
      <code.srate><![CDATA[   %b%= (%a%<<%bits%) & ((1<<27)-1);
]]></code.srate>

the current version is like this:

      <inlets>
         <frac32buffer name="a" description="a"/>
      </inlets>
      <outlets>
         <frac32buffer.positive name="b" description="quant(a)"/>
      </outlets>
      <displays/>
      <params/>
      <attribs>
         <spinner name="bits" MinValue="0" MaxValue="27" DefaultValue="7"/>
      </attribs>
      <code.srate><![CDATA[   outlet_b= (inlet_a<<attr_bits) & ((1<<27)-1);
]]></code.srate>

I adjusted the way the inlets are called but had issues anyway.

 <inlets>
         <frac32buffer name="a" description="a"/>
		 <int32 name="bits" description="bits"/>
      </inlets>
      <outlets>
         <frac32buffer.positive name="b" description="quant(a)"/>
      </outlets>
      <displays/>
      <params/>
      <attribs/>
      <code.srate><![CDATA[   outlet_b= (inlet_a<<%bits%) & ((1<<27)-1);
]]></code.srate>

The errors I get are "expected primary-expression before '%' token" and " 'bits' was not declared in this scope" .

can you give me some clues that could help formulate the expressions correctly?


#2

just change %bits% to inlet_bits

we are removing the %var% format, since this stop inlets/attributes/parameters/outlets having the same name...
which often was pretty confusing (its why the oscillators inlets used to be called pitchm rather than just pitch... which we couldn't used, because there was a parameter named pitch.

so now always use inlet_x, outlet_x, attrib_x, param_x

p.s. its not a firmware change, its a change to how the code generator works


#3

oh that is awesome. thanks