-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved metronome (on/off during song, pattern and bb playback) #2278
Improved metronome (on/off during song, pattern and bb playback) #2278
Conversation
I saw in the forum that there seems to be a need for an improved metronome functionality so I thought to give it a first shot. :) Also related to #475. |
Well need addition! Also related: #869 (@musikBear), #1357 (@Reaper10) |
if( ( currentPlayMode == Song::Mode_PlayPattern || currentPlayMode == Song::Mode_PlaySong | ||
|| currentPlayMode == Song::Mode_PlayBB ) && | ||
m_metronomeActive && | ||
!Engine::getSong()->isExporting() && | ||
p != last_metro_pos ) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of decomposing the conditional a bit? Maybe something like:
bool isPlaying = currentPlayMode == Song::Mode_PlayPattern || currentPlayMode == Song::Mode_PlaySong
|| currentPlayMode == Song::Mode_PlayBB;
if (isPlaying && m_metronomeActive && !Engine::getSong()->isExporting() &&
p != last_metro_pos) ...
Hope I'm not being too pedantic. Everything else looks good.
Tested & works as described (via I've left one code comment for @michaelgregorius to address. Pending further feedback, this should be good to merge. |
@michaelgregorius Big 👍 The metronome has been one of the most criticized features, and a toggle options is brilliant. The Master's two different sounds, and yours toggle-option, makes metronome a really good feature in lmms! |
There is a new tool button that can be used to turn the metronome on and off. Per default the metronome is turned off. When enabled the metronome will during on song playback, pattern playback and BB playback. During export it is ignored. A new icon was added as well. The state is currently stored in the Mixer. It might make sense to put the metronome configuration in its own class in the future. The state is currently not stored in the file but this might be a good choice for now until a better place is found for the metronome data. Also removed some repeated calls to Engine::getSong() and Engine::fxMixer().
a4ae549
to
5b2e77b
Compare
@Wallacoloo I have incorporated your proposal for a decomposition of the conditional. I have also rebased against master and squashed the commit. |
@musikBear Thanks for the kind words! Knowing that a feature is wanted by users and therefore is also used is always a great motivation. 😃 |
👍 |
Improved metronome (on/off during song, pattern and bb playback)
There is a new tool button that can be used to turn the metronome on and
off. Per default the metronome is turned off. When enabled the metronome
will play during on song playback, pattern playback and BB playback. During
export it is ignored.
A new icon was added as well.
The state is currently stored in the
Mixer
. It might make sense to putthe metronome configuration in its own class in the future. The state is
currently not stored in the file but this might be a good choice for now
until a better place is found for the metronome data.