GEN Code Export Bug with : "divide by samplerate"

    May 06 2016 | 8:56 pm
    Hello Cycling 74 team ,
    I would let you know about a bug/issue with GEN and C++ code export.
    Using visual patching objects like "expr" or "/" or "!/" to divide a number by SAMPLERATE (example : "1/samplerate"), everything works fine INSIDE GEN, but if you use the code export function to export c++ code for that patcher, in the generated .cpp file this is what happen :
    (1/samplerate) is exported as : (1 * 2.2675736961451e-005)
    (2/samplerate) is exported as : (2 * 2.2675736961451e-005)
    and so on... (the number : "2.2675736961451e-005" is a fixed RESULT for "1/44100"). This bug is very nasty because it will not allow samplerate changes in the exported cpp code (apps/plugins/etc...)
    In the patcher I attached to this post, you'll find all details and examples.
    Thank you for your attention.

    • May 08 2016 | 2:01 am
      Hi Bruno
      This should be fixed in the next update.
      It was an optimization from another feature request (to convert division by constant into multiplication by its inverse, for efficiency) that had incorrectly treated samplerate as a constant in code export.
    • May 08 2016 | 5:32 pm
      Thank you Graham for your quick support !