From: Jeff W. <jww...@ya...> - 2005-03-06 14:49:36
|
--- federico <xa...@in...> wrote: > how can i make 4 different widgets that manipulate > the same param_number? You can subclass a ParamModel and then make all four widgets use the subclassed ParamModel. Check out the AlesisDM5.BitModel. This is a ParamModel subclass that manipulates the individual bits of a single sysex byte. There is one additional parameter on the constructor, which is a bitmask. There are a bunch of public static final int definitions at the beginning. These are masks provided for the DM5. You specify one of these masks when you create the BitModel on your widget. You can copy this code and modify the masks for your own purposes. > please consider that if go to change octave range, i > should mask other > bits, like this: > new_val = (old_val & 0x28) | (oct_range & 0x03) > to avoid re-setting to zero saw/pulse/chorus This might be a little more complicated to answer. You could just use the BitModel subclass with a mask of 00000111 and then have your widget pass values of 1, 2, or 4. The easy way would be to use a ScrollBarLookupWidget or a KnobLookupWidget but that would limit you to those types of widgets. If you wanted to use a ComboBoxWidget (which I'm guessing would be a more appropriate choice), then you would have to further subclass BitModel to change the value 0 to 1, 1 to 2, and 2 to 4. __________________________________ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ |