Modifying USB interface number

I have a MIDI device made with an Atmega 32u4. I've removed the CDC class in a crude way by modifying the USBCore.cpp file (attached). This works to remove the CDC and have only the MIDI class, but the USB interface numbers now start at 2 instead of 0. This causes problems with some MIDI host hardware.

I'm having trouble finding where the interface numbers are defined. Presumably there's something after line 488 of the attached file (where it says: // Count and measure interfaces) that calculates the interface number, but with my basic understanding I don't follow what it does.

My question: Is there somewhere I could hard-code the interface numbers to start with 0 instead if 2? I could change it back if/when I need to turn the CDC class back on for debugging.

Thanks for your help!

USBCore.cpp (20.6 KB)

Never mind, I was able to resolve this. I was using the modification of USBCore.cpp taken from this project:

I had only used the modified USBCore.cpp file, but it turned out that I also had to use the rest of the modified core file to correctly change the interface numbers.