I need some programming advice for my VController project. The current code can be found here: https://github.com/sixeight7/VController_v2
The VController is a midi controller that can control three other devices at the moment, but as more people are showing interest I would like to add more devices.
I would like to make it easier to add code for a new device.
At the moment I find I have to update my code on almost all pages to achieve this. This is because a new device will need to "connect" with all parts of my code, like buttons, displays, midi messages, etc.
Right now I have in many places code that looks like this:
To add a new device I will have to add a line to this part of the code, but also in 20 other places. Is there a smarter way to do this?
I have looked at object-oriented programming, but I cannot create one type of object that can serve for all the devices, because these devices are totally different and need big portions of unique code.
But maybe there is a smart way to organize and build my code. I welcome your ideas.
The VController is a midi controller that can control three other devices at the moment, but as more people are showing interest I would like to add more devices.
I would like to make it easier to add code for a new device.
At the moment I find I have to update my code on almost all pages to achieve this. This is because a new device will need to "connect" with all parts of my code, like buttons, displays, midi messages, etc.
Right now I have in many places code that looks like this:
Code:
void OnProgramChange(byte channel, byte program)
{
check_PC_in_GP10(channel, program);
check_PC_in_GR55(channel, program);
check_PC_in_VG99(channel, program);
}
To add a new device I will have to add a line to this part of the code, but also in 20 other places. Is there a smarter way to do this?
I have looked at object-oriented programming, but I cannot create one type of object that can serve for all the devices, because these devices are totally different and need big portions of unique code.
But maybe there is a smart way to organize and build my code. I welcome your ideas.
Last edited: