LMMS / lmms

Cross-platform music production software
https://lmms.io
GNU General Public License v2.0
8.04k stars 1k forks source link

Adding Shift Hotkeys To Virtual Instruments To Extend Note Range Of Keyboard #3302

Open miketurn opened 7 years ago

miketurn commented 7 years ago

Each virtual instrument provides a virtual keyboard at the bottom of its window. (If no conflicts) may be a nice idea to add hotkeys where if you hold down the LEFT shift button and play notes (on your computer keyboard) you are playing in octaves BELOW current position, and if you do the same with the RIGHT shift you can play in octaves ABOVE. (I did not make this up, got the idea from another program, and it may be useful in LMMS) Just gives you more range on a computer keyboard without having to move the green square.

On a side note: Might be confusing to implement, but at times it may be nice for some way of viewing a FULL vertical virtual keyboard graphic on your screen to show you where you are playing.

Thank You

tresf commented 7 years ago

I like this idea. It's probably only a few lines of code to capture the shift modifier and go up and down an octave. Perhaps something like this?

src/gui/PianoView.cpp#L612


void PianoView::keyPressEvent( QKeyEvent * _ke )
{
    const int key_num = getKeyFromKeyEvent( _ke ) +
-               ( DefaultOctave - 1 ) * KeysPerOctave;
+               ( DefaultOctave + (_ke->modifiers() & Qt::ShiftModifier ? 0 : -1 ) ) * KeysPerOctave;

    if( _ke->isAutoRepeat() == false && key_num > -1 )
    {
        if( m_piano != NULL )
        {
            m_piano->handleKeyPress( key_num );
            _ke->accept();
            update();
        }
    }
    else
    {
        _ke->ignore();
    }
}
}
BaraMGB commented 7 years ago

I guess we can not distinguish between left and right shift.

musikBear commented 7 years ago

@BaraMGB 'Ctrl' can in win, but i dont know about x10 or linux

mikobuntu commented 7 years ago

I like the Bitwig method, 'CAPS-LOCK' put keyboard focus on for selected instrument/track and 'Z' & 'X' keys shift up and down the octaves. This allows for single key modifiers when not in CAPS mode , which we may want to think about for future versions.

corvin78 commented 7 years ago

Hi, I am new here, but I was just searching for similar functionality within LMMS ( https://lmms.io/forum/viewtopic.php?f=7&t=8383&p=26985#p26985 ) and I spotted that there was already a patch long time ago for exactly what I was looking for! ( https://sourceforge.net/p/lmms/patches/7/ ) This is somehow similar to the one here and it is a pity it did not get through!

miketurn commented 7 years ago

That is a shame that the left and right shift keys can not be distinguished between each other. I am not greatly familiar with all the LMMS hotkeys to suggest other keys. Any other ideas for some keys that can be used to achieve this, if this is still a desired feature to be added by others. Personally I still think this feature would be helpful to quickly play / test instruments when you only have your computer keyboard to work with.

Gary-Ice commented 6 years ago

@BaraMGB This is awesome idea too. Basically the same. I'd just like to have it as a "permanent" effect at least.