How to change the function of a button, with a press of another button?

Sure.
Say you had an array that you read, which stored a value that was read out and sent over MIDI for every message.
You could have a duplicate array other values that was read instead if button2 was pressed.
if (digitalRead(button2) == 0){
// read from array 1
}
else {
// read from array 2
}

or read button 2 and save the value, then:

if (button2State == 0){
// read from array 1
}
else {
// read from array 2
}

Lot of ways to accomplish this.