#include "player.h"
#include "futatabi_midi_mapping.pb.h"
#include "midi_mapping_dialog.h"
+#include "pbo_pool.h"
#include "shared/aboutdialog.h"
#include "shared/disk_space_estimator.h"
#include "shared/post_to_main_thread.h"
if (!load_midi_mapping_from_file(global_flags.midi_mapping_filename, &midi_mapping)) {
fprintf(stderr, "Couldn't load MIDI mapping '%s'; exiting.\n",
global_flags.midi_mapping_filename.c_str());
- exit(1);
+ abort();
}
midi_mapper.set_midi_mapping(midi_mapping);
}
display->setAutoFillBackground(true);
layout->addWidget(display);
- display->set_overlay(to_string(i + 1));
+ if (global_flags.source_labels.count(i + 1)) {
+ display->set_overlay(global_flags.source_labels[i + 1]);
+ } else {
+ display->set_overlay(to_string(i + 1));
+ }
QPushButton *preview_btn = new QPushButton(this);
preview_btn->setMaximumSize(20, 17);
playlist_selection_changed();
}
+ // Show the clip in the preview.
+ unsigned stream_idx = ui->preview_display->get_stream_idx();
+ preview_single_frame(cliplist_clips->mutable_back()->pts_in, stream_idx, FIRST_AT_OR_AFTER);
+
// Select the item so that we can jog it.
ui->clip_list->setFocus();
QModelIndex index = cliplist_clips->index(cliplist_clips->size() - 1, int(ClipList::Column::IN));
cliplist_clips->mutable_back()->pts_out = current_pts + lrint(global_flags.cue_out_point_padding_seconds * TIMEBASE);
+ // Show the clip in the preview. (TODO: This won't take padding into account.)
+ unsigned stream_idx = ui->preview_display->get_stream_idx();
+ preview_single_frame(cliplist_clips->mutable_back()->pts_out, stream_idx, LAST_BEFORE);
+
// Select the item so that we can jog it.
ui->clip_list->setFocus();
QModelIndex index = cliplist_clips->index(cliplist_clips->size() - 1, int(ClipList::Column::OUT));
void MainWindow::content_changed()
{
// If we are playing, update the part of the playlist that's not playing yet.
- vector<ClipWithID> clips;
- for (unsigned row = 0; row < playlist_clips->size(); ++row) {
- clips.emplace_back(*playlist_clips->clip_with_id(row));
- }
+ vector<ClipWithID> clips = get_playlist(0, playlist_clips->size());
live_player->splice_play(clips);
// Serialize the state.
}
unsigned start_row = selected->selectedRows(0)[0].row();
- vector<ClipWithID> clips;
- for (unsigned row = start_row; row < playlist_clips->size(); ++row) {
- ClipWithID clip = *playlist_clips->clip_with_id(row);
- if (clip.clip.pts_out == -1) {
- clip.clip.pts_out = clip.clip.pts_in + int64_t(TIMEBASE) * 86400 * 7; // One week; effectively infinite, but without overflow issues.
- }
- clips.emplace_back(clip);
- }
+ vector<ClipWithID> clips = get_playlist(start_row, playlist_clips->size());
live_player->play(clips);
playlist_clips->set_progress({ { start_row, 0.0f } });
ui->playlist->selectionModel()->clear();
} else if (watched == ui->playlist->viewport()) {
destination = ui->playlist;
jog_destination = JOG_PLAYLIST;
- if (destination->columnAt(wheel->x()) != int(PlayList::Column::CAMERA)) {
+ if (destination->columnAt(wheel->position().x()) != int(PlayList::Column::CAMERA)) {
last_mousewheel_camera_row = -1;
}
} else {
return false;
}
- int column = destination->columnAt(wheel->x());
- int row = destination->rowAt(wheel->y());
+ int column = destination->columnAt(wheel->position().x());
+ int row = destination->rowAt(wheel->position().y());
if (column == -1 || row == -1)
return false;
enable_or_disable_queue_button();
}
+vector<ClipWithID> MainWindow::get_playlist(size_t start_row, size_t end_row)
+{
+ vector<ClipWithID> clips;
+ for (unsigned row = start_row; row < end_row; ++row) {
+ ClipWithID clip = *playlist_clips->clip_with_id(row);
+ if (clip.clip.pts_out == -1) {
+ clip.clip.pts_out = clip.clip.pts_in + int64_t(TIMEBASE) * 86400 * 7; // One week; effectively infinite, but without overflow issues.
+ }
+ clips.emplace_back(clip);
+ }
+ return clips;
+}
+
void MainWindow::report_disk_space(off_t free_bytes, double estimated_seconds_left)
{
char time_str[256];