Make CaptureAppView capture functions same as AnalogAudioView.

This commit is contained in:
Jared Boone 2016-04-30 11:09:39 -07:00
parent 18e40562b5
commit a6d41547a0
2 changed files with 29 additions and 13 deletions

View File

@ -110,23 +110,35 @@ void CaptureAppView::focus() {
button_record.focus();
}
void CaptureAppView::on_record() {
if( capture_thread ) {
capture_thread.reset();
button_record.set_bitmap(&bitmap_record);
} else {
const auto filename_stem = next_filename_stem_matching_pattern("BBD_????");
text_record_filename.set(filename_stem);
text_record_dropped.set("");
if( filename_stem.empty() ) {
return;
}
bool CaptureAppView::is_recording() const {
return (bool)capture_thread;
}
capture_thread = std::make_unique<CaptureThread>(filename_stem + ".C16", 14, 1);
button_record.set_bitmap(&bitmap_stop);
void CaptureAppView::on_record() {
if( is_recording() ) {
record_stop();
} else {
record_start();
}
}
void CaptureAppView::record_start() {
const auto filename_stem = next_filename_stem_matching_pattern("BBD_????");
text_record_filename.set(filename_stem);
text_record_dropped.set("");
if( filename_stem.empty() ) {
return;
}
capture_thread = std::make_unique<CaptureThread>(filename_stem + ".C16", 14, 1);
button_record.set_bitmap(&bitmap_stop);
}
void CaptureAppView::record_stop() {
capture_thread.reset();
button_record.set_bitmap(&bitmap_record);
}
void CaptureAppView::on_tick_second() {
if( capture_thread ) {
const auto dropped_percent = std::min(99U, capture_thread->state().dropped_percent());

View File

@ -61,6 +61,10 @@ private:
SignalToken signal_token_tick_second;
void on_record();
bool is_recording() const;
void record_start();
void record_stop();
void on_tick_second();
void on_tuning_frequency_changed(rf::Frequency f);