wave effect axis, fixed folder bugs, timecode to frame number, drag from footage viewer, track resizing bug

This commit is contained in:
itsmattkc
2018-10-20 13:57:37 +11:00
parent ca3f5aa0ba
commit c9b8775a81
13 changed files with 324 additions and 147 deletions
+43
View File
@@ -24,6 +24,7 @@ extern "C" {
#include <QtMath>
#include <QAudioOutput>
#include <QPainter>
#include <QStringList>
Viewer::Viewer(QWidget *parent) :
QDockWidget(parent),
@@ -87,6 +88,48 @@ void Viewer::reset_all_audio() {
clear_audio_ibuffer();
}
long timecode_to_frame(const QString& s, int view, double frame_rate) {
QList<QString> list = s.split(QRegExp("[:;]"));
for (int i=0;i<list.size();i++) {
qDebug() << "list" << i << list.at(i);
}
if (view == TIMECODE_FRAMES || list.size() == 1) {
return s.toLong();
}
int frRound = qRound(frame_rate);
int hours = ((list.size() > 0) ? list.at(0).toInt() : 0) * frRound * 3600;
int minutes = ((list.size() > 1) ? list.at(1).toInt() : 0) * frRound * 60;
int seconds = ((list.size() > 2) ? list.at(2).toInt() : 0) * frRound;
int frames = (list.size() > 3) ? list.at(3).toInt() : 0;
int f = (frames + seconds + minutes + hours);
if (view == TIMECODE_DROP && frame_rate_is_droppable(frame_rate)) {
// return drop
int d;
int m;
int dropFrames = round(frame_rate * .066666); //Number of frames to drop on the minute marks is the nearest integer to 6% of the framerate
int framesPer10Minutes = round(frame_rate * 60 * 10); //Number of frames per ten minutes
int framesPerMinute = (round(frame_rate)*60)- dropFrames; //Number of frames per minute is the round of the framerate * 60 minus the number of dropped frames
d = f / framesPer10Minutes;
f -= dropFrames*9*d;
m = f % framesPer10Minutes;
if (m > dropFrames) {
f -= (dropFrames * ((m - dropFrames) / framesPerMinute));
}
}
// return non-drop
return f;
}
QString frame_to_timecode(long f, int view, double frame_rate) {
if (view == TIMECODE_FRAMES) {
return QString::number(f);