aap98
New Member
Posts: 3
|
Post by aap98 on Mar 3, 2020 10:19:13 GMT -8
Hi, for my code within each of the sub menus (one of which is called fuzz) I want to have 4 dials that are independent of each other but I am not sure how to change the attached code so that each slider remains at its previously selected position rather than all sliders changing at the same time to the same value. I imagine its because each of the value_d(x) variables are all assigned to GD.inputs.track_val, not sure how I can amend this. Cheers.
#define TAG_DIAL1 203
#define TAG_DIAL2 204
#define TAG_DIAL3 205
#define TAG_DIAL4 206
static uint16_t value_d1 = 0;
static uint16_t value_d2 = 0;
static uint16_t value_d3 = 0;
static uint16_t value_d4 = 0;
void Fuzz()
{
while(1){
GD.ClearColorRGB(0x000000);
GD.Clear();
GD.get_inputs();
GD.SaveContext();
//Dials
switch (GD.inputs.track_tag & 0xff) { //' track{
case TAG_DIAL1: value_d1 = GD.inputs.track_val; int dial_val1 = int(value_d1/257);
case TAG_DIAL2: value_d2 = GD.inputs.track_val; int dial_val2 = int(value_d2/257);
case TAG_DIAL3: value_d3 = GD.inputs.track_val; int dial_val3 = int(value_d3/257);
case TAG_DIAL4: value_d4 = GD.inputs.track_val; int dial_val4 = int(value_d4/257); } //' }track
... //Code continues etc
|
|
|
Post by jamesbowman on Mar 6, 2020 22:15:02 GMT -8
This seems fine. Please can you attach the code that draws the four dials?
|
|
aap98
New Member
Posts: 3
|
Post by aap98 on Mar 7, 2020 11:38:30 GMT -8
Hi James, I managed to fix the problem thanks for the help!
|
|