commit before audio rewrite

This commit is contained in:
itsmattkc
2018-06-06 10:54:17 -07:00
parent 0ea7c43e53
commit b2b3f5a14e
9 changed files with 35 additions and 14 deletions
+3 -1
View File
@@ -90,6 +90,7 @@ bool Timeline::toggle_play() {
void Timeline::play() {
playhead_start = playhead;
playback_timer.start();
start_msecs = QDateTime::currentMSecsSinceEpoch();
playback_updater.start();
playing = true;
@@ -143,7 +144,8 @@ bool Timeline::focused() {
void Timeline::repaint_timeline() {
if (playing) {
playhead = playhead_start + (playback_timer.elapsed() * 0.001 * sequence->frame_rate);
// playhead = playhead_start + (playback_timer.elapsed() * 0.001 * sequence->frame_rate);
playhead = round(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * sequence->frame_rate));
}
ui->video_area->update();
ui->audio_area->update();
+1
View File
@@ -77,6 +77,7 @@ public:
void go_to_end();
bool playing;
long playhead_start;
qint64 start_msecs;
QTime playback_timer;
QTimer playback_updater;
+8
View File
@@ -10,6 +10,8 @@ extern "C" {
#include <libavcodec/avcodec.h>
}
#include <QAudioOutput>
Viewer::Viewer(QWidget *parent) :
QDockWidget(parent),
ui(new Ui::Viewer)
@@ -27,6 +29,10 @@ Viewer::~Viewer()
delete ui;
}
void Viewer::receiver() {
qDebug() << "callback?";
}
void Viewer::set_sequence(Sequence* s) {
bool null_sequence = (s == NULL);
sequence = s;
@@ -45,6 +51,8 @@ void Viewer::set_sequence(Sequence* s) {
}
init_audio(s);
connect(audio_output, SIGNAL(notify()), this, SLOT(receiver()));
update();
}
+2
View File
@@ -35,6 +35,8 @@ private slots:
void on_pushButton_3_clicked();
void receiver();
private:
Ui::Viewer *ui;
};