diff --git a/io/config.cpp b/io/config.cpp
index 8dcac0e3c..8163d43fe 100644
--- a/io/config.cpp
+++ b/io/config.cpp
@@ -15,7 +15,8 @@ Config::Config()
edit_tool_selects_links(false),
edit_tool_also_seeks(false),
select_also_seeks(false),
- paste_seeks(true)
+ paste_seeks(true),
+ rectified_waveforms(false)
{
}
@@ -52,7 +53,9 @@ void Config::load(QString path) {
} else if (stream.name() == "ImageSequenceFormats") {
stream.readNext();
img_seq_formats = stream.text().toString();
- }
+ } else if (stream.name() == "RectifiedWaveforms") {
+ rectified_waveforms = (stream.text() == "1");
+ }
}
}
if (stream.hasError()) {
@@ -106,6 +109,7 @@ void Config::save(QString path) {
stream.writeTextElement("SelectAlsoSeeks", QString::number(select_also_seeks));
stream.writeTextElement("PasteSeeks", QString::number(paste_seeks));
stream.writeTextElement("ImageSequenceFormats", img_seq_formats);
+ stream.writeTextElement("RectifiedWaveforms", QString::number(rectified_waveforms));
stream.writeEndElement();
stream.writeEndDocument(); // doc
diff --git a/io/config.h b/io/config.h
index c2b6efcf5..9742d4f64 100644
--- a/io/config.h
+++ b/io/config.h
@@ -15,6 +15,7 @@ struct Config {
bool select_also_seeks;
bool paste_seeks;
QString img_seq_formats;
+ bool rectified_waveforms;
void load(QString path);
void save(QString path);
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 1a50c7aec..ee2c011e6 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -558,6 +558,7 @@ void MainWindow::toolMenu_About_To_Be_Shown() {
ui->actionSeek_to_the_End_of_Pastes->setChecked(config.paste_seeks);
ui->actionToggle_Snapping->setChecked(panel_timeline->snapping);
ui->actionScroll_Wheel_Zooms->setChecked(config.scroll_zooms);
+ ui->actionRectified_Waveforms->setChecked(config.rectified_waveforms);
}
void MainWindow::on_actionEdit_Tool_Selects_Links_triggered() {
@@ -688,3 +689,9 @@ void MainWindow::on_actionTimeline_Track_Lines_triggered()
config.show_track_lines = !config.show_track_lines;
panel_timeline->redraw_all_clips(false);
}
+
+void MainWindow::on_actionRectified_Waveforms_triggered()
+{
+ config.rectified_waveforms = !config.rectified_waveforms;
+ panel_timeline->redraw_all_clips(false);
+}
diff --git a/mainwindow.h b/mainwindow.h
index 2df090ffa..bd1b48422 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -168,6 +168,8 @@ private slots:
void on_actionTimeline_Track_Lines_triggered();
+ void on_actionRectified_Waveforms_triggered();
+
private:
Ui::MainWindow *ui;
void setup_layout();
diff --git a/mainwindow.ui b/mainwindow.ui
index 01eceb3b9..37f108ab9 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -149,6 +149,7 @@
+
@@ -681,6 +682,14 @@
Ripple Delete In/Out
+
+
+ true
+
+
+ Rectified Waveforms
+
+
diff --git a/panels/viewer.cpp b/panels/viewer.cpp
index 10964939f..807138027 100644
--- a/panels/viewer.cpp
+++ b/panels/viewer.cpp
@@ -142,6 +142,8 @@ void Viewer::update_sequence() {
update_end_timecode();
}
+ viewer_widget->repaint();
+
update();
}
diff --git a/ui/timelinewidget.cpp b/ui/timelinewidget.cpp
index b660b47e7..a035f5285 100644
--- a/ui/timelinewidget.cpp
+++ b/ui/timelinewidget.cpp
@@ -807,7 +807,7 @@ void TimelineWidget::update_ghosts(QPoint& mouse_pos) {
if (g.clip != -1) c = sequence->get_clip(g.clip);
MediaStream* ms = NULL;
- if (c->media_type == MEDIA_TYPE_FOOTAGE) {
+ if (g.clip != -1 && c->media_type == MEDIA_TYPE_FOOTAGE) {
ms = static_cast(c->media)->get_stream_from_file_index(c->media_stream);
}
@@ -1575,13 +1575,15 @@ void TimelineWidget::redraw_clips() {
clip_painter.drawImage(thumb_rect, ms->video_preview);
}
} else if (clip_rect.height() > TRACK_MIN_HEIGHT) {
- int divider = ms->audio_channels*2;
+ clip_painter.setPen(QColor(80, 80, 80));
- clip_painter.setPen(QColor(80, 80, 80));
- int channel_height = clip_rect.height()/ms->audio_channels;
+ int divider = ms->audio_channels*2;
+ int channel_height = clip_rect.height()/ms->audio_channels;
for (int i=0;iclip_in + ((double) i/panel_timeline->zoom))/media_length) * ms->audio_preview.size())/divider)*divider;
+ int waveform_index = qFloor((((clip->clip_in + ((double) i/panel_timeline->zoom))/media_length) * ms->audio_preview.size())/divider)*divider;
+
+ int rectified_height = 0;
for (int j=0;jaudio_channels;j++) {
int mid = clip_rect.top()+channel_height*j+(channel_height/2);
@@ -1589,7 +1591,16 @@ void TimelineWidget::redraw_clips() {
qint8 min = (double)ms->audio_preview.at(offset) / 128.0 * (channel_height/2);
qint8 max = (double)ms->audio_preview.at(offset+1) / 128.0 * (channel_height/2);
- clip_painter.drawLine(clip_rect.left()+i, mid+min, clip_rect.left()+i, mid+max);
+
+ if (config.rectified_waveforms) {
+ rectified_height += (max - min);
+ } else {
+ clip_painter.drawLine(clip_rect.left()+i, mid+min, clip_rect.left()+i, mid+max);
+ }
+ }
+
+ if (config.rectified_waveforms) {
+ clip_painter.drawLine(clip_rect.left()+i, clip_rect.height(), clip_rect.left()+i, clip_rect.height() - rectified_height);
}
}
}