help me improve my mux function?

thanks for your responses.

my project is an infrared midi controller. here is the proof of concept.