From: Alexander Liebendorfer <alex.liebendorf@gm...> - 2012-04-04 20:08:29
I've been fumbling around in the LMMS source, trying to understand
stuff, and I have several questions:
Code from gui/piano_roll.cpp:
void pianoRoll::autoScroll( const midiTime & _t )
const int w = width() - WHITE_KEY_WIDTH;
if( _t > m_currentPosition)
m_leftRightScroll->setValue( _t );
I changed it from the original code so that the whole screen would
smoothly scroll with the song.
It works, and always follows the current song position.
Now, first question: If I wanted to make it stop scrolling once the
end of the loop is visible (including loop end points), how would I go
around doing that? Is there a variable that holds the position "AT
THIS POINT, GO BACK!" or is it tested every frame?
Or two variables, one holding the end of the song and one the position
of the loop end (those little green triangles that can make a song
loop between them, no idea how to call them)?
Second question is about going back. With this system, when the whole
thing loops, the screen immediately gets scrolled over to the point
where it's playing. To make it a little smoother I tried using this
code (also in pianoRoll::autoScroll):
else if( _t < m_currentPosition )
midiTime t = qMax( _t - w * midiTime::ticksPerTact() *
midiTime::ticksPerTact() / m_ppt, 0 );
m_leftRightScroll->setValue( m_currentPosition-15 ); // TODO: See if
I can use max( _t, m_currentPosition-15)
It didn't work. I tried replacing the 15 with 3, but the window still
scrolled immediately to _t. I assumed it was because m_currentPosition
gets reset when the song hits a looppoint. Is this true? If yes, where
and how can I go around that?
If no, what is actually going wrong?
Thank you for your help.
PS: If there are any things you find worth mentioning about the LMMS
source code, like stuff to do, stable and unstable parts, or non-used
parts, or anything not mentioned in the wiki, I'd be glad to hear