> The pointer seems like a good idea (After all you asked for ptr's ;-)
> or you could change your prefs structure
> (don't know what structure midi was defined as so let's call it MY_MIDI)
> FROM
> MY_MIDI midi1;
> MY_MIDI midi2;
> MY_MIDI midi3;
>
I don'w know why my message got clipped. Here it is again
----------------------------------------------------------------------
The pointer seems like a good idea (After all you asked for ptr's ;-)
or you could change your prefs structure
(don't know what structure midi was defined as so let's call it MY_MIDI)
FROM
MY_MIDI midi1;
MY_MIDI midi2;
MY_MIDI midi3;
thru
MY_MIDI midi16;
TO
#define MIDI_SIZE 16
MY_MIDI midi[MIDI_SIZE];
This should make all of your code smaller since you now only need
to reference the array using an index.
You will have no need for a case statement.
if (save)
{
prefs.mid[midi_selected].chan=prefs.chan;
prefs.mid[midi_selected].instrument=prefs.instrument;
prefs.mid[midi_selected].vel=prefs.vel;
prefs.mid[midi_selected].pitch=prefs.pitch;
prefs.mid[midi_selected].range=prefs.range;
save = false;
}
else
{
SetFieldInt(instrumentlbl, prefs.mid[midi_selected].instrument+1);
SetFieldInt(pitchlbl, prefs.mid[midi_selected].pitch+1);
SetFieldInt(vellbl, prefs.mid[midi_selected].vel+1);
SetFieldInt(rangelbl, prefs.mid[midi_selected].range+1);
SetFieldInt(chanlbl, prefs.mid[midi_selected].chan+1);
}
Ron Gouldner
RGPS
Development