pattr storage issue

    Jan 26 2013 | 3:55 am
    HI there. I have succesfully created a pattr storage object, and with the help of someone on this forum, I have been able to make two switches that cycle through the presets continually. As a bonus feature, I added a live. menu so users could choose the preset from a drop down menu , not just the circles in the preset GUI. After hours of fiddling around I have found several problems which I need some help with.
    One problem is that the preset menu wont will skip the first value at the start. It will only start at the first preset if I add an extra step in the range/enum. If after adding the extra preset it will cycle through normally only after I have run through all the presets from start to end. I have attached some code for anyone who might see where the bug is.
    The second problem I am experiencing is that if I choose one of the presets from the drop down, but then use the UP or DOWN buttons assigned to navigate the presets, the doesnt update and sends the preset back from where it was last selected with the buttons. The same problem happens visa versa with the preset interface not updating when the preset is chosen from the I would both of these objects to update whichever method is used to navigate the presets.
    Attached is the code for the preset menu
    thanks in advance!

    • Jan 26 2013 | 10:08 am
      Like this?
    • Jan 26 2013 | 11:01 pm
      thanks this is a start. Now the will display the updated preset, however this code did not address all the issues described above as some are still present. This code also takes away the feature of being able to cycle through the presets in reverse, going back from A1 which I found handy.
      There is also a considerable bug. If that a blank preset is navigated to by mouse (simply jumping to any blank preset) and new data is saved to that preset, the will label that as the last preset that was navigated to by buttons. So this is really buggy, because it is mislabeling the presets.
      Is there any one else that could have a look at the code I first posted and help with this??
    • Jan 27 2013 | 9:20 pm
      Is there any one else that could have a look at the code I first posted and help with this?? im really trying to read everything I can, but i cant seem to figure this out.
    • Feb 10 2013 | 4:46 am
      take5: the whole patch is just too complex, considering what it does. The accum object is not really needed. You can do this using just one [+] object and one [select]....but anyway, the main incorrect thing in your patch is the [%] object, because it will not work for going from 0 down to 63. The % object is a "programming" kind of modulo function (where -1 mod 5 = -1), not the floored/euclidean modulo which is usually used @ math lessons where -1 mod 5 = 4. (for more info about this read this )
      My solution is to use [select -1 64] object, which sends bang to 1st outlet when it receives -1, bangs the 2nd outlet when it receives 64 and let any other numbers pass through going out the last, 3rd outlet.
      I connected the first outlet to "63" messagebox, because we want to get to 63 instead of -1 when going down from zero
      and connected the 2nd outlet to "0" messagebox, because we want to get 0 instead of 64 when going up from 63 (our upper limit)
      Everything else just passes out of 3rd outlet. So when we put the 3rd outlet and the 2 messageboxes together, we get what we want, without the modulo.
      (other option would be use the correct modulo function, but i'm unable to find it in max. in pure data there is a [mod] or [modulo] which is exactly the one you need unlike the [%] one (which is also in PD / there are both). i'm not sure but may be possible to import the pd object to max?)
      + if you want the button to be momentary and not a toggle, then inspect the button and there is an MODE attribude which you can change from toggle to button, instead of using toggle and turning it off using the pipe object.
      here is my simple version.