-
-
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
Add record count down #3467
base: master
Are you sure you want to change the base?
Add record count down #3467
Conversation
src/gui/MainWindow.cpp
Outdated
@@ -552,13 +555,20 @@ void MainWindow::finalize() | |||
m_toolBar ); | |||
controllers_window->setShortcut( Qt::Key_F11 ); | |||
|
|||
m_countDownClock = new LcdSpinBox(2, this, tr("Count Down Clock")); | |||
|
|||
m_countDownClock->setLabel( tr("SEC") ); |
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.
The countdown should really be in bars/beats, not seconds. When you record you always want to be relative to the beat, because the countdown actually gives musicians time to align themselves with the beat. An arbitrary second value can't do that.
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.
Well, in this case, we may want to implement a conversion algorithm and makes it public in Engine
or somewhere, this problem was also a headache in my previous PR (Go to feature), it will introduce offsets when doing the conversions.
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.
And maybe here we can toggle on the metronome automatically to assist the recording preparation even better?
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.
Yes, absolutely. The metronome ought to be more intuitive, that's a step in the right direction.
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.
Because I think we are going to use QTimer
to do the delay process, and QTimer
only accepts milliseconds, so we need to first convert ticks into milliseconds.
I came up with such conversion method:
The equation (1) is our original algorithm found in TimeDisplayWidget.cpp:112
The equation (2) is to solve the equation (1) given Tick
value to express Msec
as a function of Tick
tempo
and TicksPerTack
The equation (4) is to ease manual verification of whether the equation (2) works correctly.
As far as I could tell, given the precise value of ticks
(preserving at least 1 decimal point) can give the very close output (around +- 3 msec at 999 BPM)
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.
In the final version don't use 1250 like a magic number, cause the TicksPerTact can change in the future. It's better to have a constant that's 24000/TicksPerTact
|
||
|
||
void MainWindow::toggleControllerRack() | ||
{ | ||
toggleWindow( gui->getControllerRackView() ); | ||
toggleWindow( gui->getControllerRackView() ); |
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.
missed one spot with spaces here
m_toolBarLayout->addWidget( song_editor_window, 1, 1 ); | ||
m_toolBarLayout->addWidget( bb_editor_window, 1, 2 ); | ||
m_toolBarLayout->addWidget( piano_roll_window, 1, 3 ); | ||
m_toolBarLayout->addWidget( automation_editor_window, 1, 4 ); | ||
m_toolBarLayout->addWidget( fx_mixer_window, 1, 5 ); | ||
m_toolBarLayout->addWidget( project_notes_window, 1, 6 ); | ||
m_toolBarLayout->addWidget( controllers_window, 1, 7 ); | ||
m_toolBarLayout->addWidget( m_countDownClock, 1, 8 ); |
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.
spaces
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.
Countdown should be based on the rendering process, without timers.
connect( &m_recordCountDownTimer, SIGNAL( timeout()), this, SLOT(decrementRecordCountDown()) ); | ||
connect( Engine::getSong(), SIGNAL( recordCoundDown()), this, SLOT(startRecordCountDown()) ); | ||
m_countDownValue = new LcdSpinBoxModel(); | ||
m_countDownValue->setRange( 0, 99 ); |
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.
Please add
// TODO: Support -1 for automatic
@@ -232,6 +235,10 @@ public slots: | |||
|
|||
ToolButton * m_metronomeToggle; | |||
|
|||
LcdSpinBox * m_countDownClock; | |||
|
|||
LcdSpinBoxModel * m_countDownValue; |
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.
You would probably like to have this model in Song
because the feature should work with any interface.
|
||
m_countDownClock->setLabel( tr("SEC") ); | ||
m_countDownClock->setModel( m_countDownValue ); | ||
connect( m_countDownValue, SIGNAL(dataChanged()), this, SLOT( updateCountDownDuration() ) ); |
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.
You should only connect the manualChange
signal.
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.
Ahh, there's a small problem, I don't know why the manualChange
wasn't fired during my testing.
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.
manualChange
works. What object were you connecting?
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.
manualChange
works. What object were you connecting?
I was connectingm_countDownClock
, and I found the slot is never got called.
@@ -224,6 +226,7 @@ public slots: | |||
|
|||
QBasicTimer m_updateTimer; | |||
QTimer m_autoSaveTimer; | |||
QTimer m_recordCountDownTimer; |
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.
These timer facilities are not needed in the GUI, the model should handle the countdown.
@@ -243,6 +250,8 @@ private slots: | |||
void updateViewMenu( void ); | |||
void updateConfig( QAction * _who ); | |||
void onToggleMetronome(); | |||
void startRecordCountDown(); | |||
void decrementRecordCountDown(); |
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.
These are not needed.
@@ -254,6 +254,10 @@ class EXPORT Song : public TrackContainer | |||
return m_timeSigModel; | |||
} | |||
|
|||
void setRecordDelay( int time ); | |||
int getRecordDelay(); | |||
void startRecordCountDown(); |
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.
startRecordCountDown
would be private because the countdown should be integrated with record
.
@@ -4357,15 +4357,17 @@ void PianoRollWindow::stop() | |||
|
|||
void PianoRollWindow::record() | |||
{ | |||
m_editor->record(); | |||
Engine::getSong()->startRecordCountDown(); | |||
QTimer::singleShot( Engine::getSong()->getRecordDelay() * 1000 , m_editor, SLOT( record() ) ); |
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.
Since the countdown will be based on bars and the metronome is going to play, you should rely on the rendering process and tick count instead of timers.
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.
This is because I haven't familiar with the rendering process of LMMS, I will try to understand it before doing this.
@jasp00 Thanks for your feedback! I will fix the code accordingly. |
Well, I am writing to let you guys know I am still alive and I just have been fully occupied, hopefully I will have some time this weekend. |
Okay, I feel like to ditch all the work here, because I think I need a clear mind to implement a better approach.
|
Any updates? |
Looks like this PR is dead |
Do not merge this until it is told to do so
Tagging my "mentor" @jasp00
In respond to #3394
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)