Small request : MidiKeyboardComponent::getKeyPos public ?


#1

Everything is in the title … I’d like to reuse the midi keyboard component and draw a piano roll next to it. I already did it successfully but I had to create a copy of MidiKeyboardComponent only to move getKeyPos to the public interface of the class.

Because this method is const, there’s no risk of messing up the internals of the class, so would it be possible to have it moved to the public part please ?


#2

getKeyPosition is public, can’t you use that?


#3

In my version, it’s protected, and to achieve getKeyPos behaviour, I need to use a private member of MidiKeyboardComponent (xOffset)


#4

Sorry, I meant getKeyStartPosition(), which is what you need, isn’t it?


#5

Nope, I really mean getKeyPos, which I use to draw a piano roll like the one bellow :

It’s quite handy because I don’t need to keep track of the MidiKeyboardComponent changes, as there’s a listener for that. It’s not urgent, but it’s kind of annoying to have to duplicate a whole class, just to change the access of 1 method.


#6

I fail to see why you can’t do that with getKeyStartPosition()… The only other thing that getKeyPos would return is the key depth, which you don’t need.


#7

My turn to mix up. Obivously you’re right. Thank you.