summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-02-27 12:31:23 +0000
committerCarl Hetherington <cth@carlh.net>2014-02-27 12:31:23 +0000
commit298395454530a7bbcd2ea333d57dff8be8468bba (patch)
treed95d2208d2b77683d7e9d3a4ae7441ef871e3c90
parente8c1880a2b9a40eb11ee259feee3edd799139a43 (diff)
parentcc3900735839ff4b0da0c046b5c606c440ba917a (diff)
Merge branch '2.0' of ssh://carlh.dyndns.org/home/carl/git/dcpomatic into 2.0
-rw-r--r--ChangeLog11
-rw-r--r--debian/changelog5
-rw-r--r--src/lib/sndfile_decoder.cc11
-rw-r--r--src/tools/dcpomatic.cc4
-rw-r--r--src/wx/about_dialog.cc1
-rw-r--r--src/wx/audio_plot.cc66
-rw-r--r--src/wx/audio_plot.h15
7 files changed, 74 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index e9607abbf..1b7fd5ac4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-02-26 Carl Hetherington <cth@carlh.net>
+
+ * Version 1.64.17 released.
+
+2014-02-26 Carl Hetherington <cth@carlh.net>
+
+ * Fix missing RMS audio analysis plots in some cases.
+
+ * Fix failure to load sound files with
+ non-ASCII paths.
+
2014-02-23 Carl Hetherington <cth@carlh.net>
* Version 1.64.16 released.
diff --git a/debian/changelog b/debian/changelog
index 15517b1a9..de5db1e33 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-dcpomatic (1.64.16-1) UNRELEASED; urgency=low
+dcpomatic (1.64.17-1) UNRELEASED; urgency=low
* New upstream release.
* New upstream release.
@@ -97,8 +97,9 @@ dcpomatic (1.64.16-1) UNRELEASED; urgency=low
* New upstream release.
* New upstream release.
* New upstream release.
+ * New upstream release.
- -- Carl Hetherington <carl@d1stkfactory> Sun, 23 Feb 2014 22:38:19 +0000
+ -- Carl Hetherington <carl@d1stkfactory> Wed, 26 Feb 2014 22:34:16 +0000
dcpomatic (0.87-1) UNRELEASED; urgency=low
diff --git a/src/lib/sndfile_decoder.cc b/src/lib/sndfile_decoder.cc
index d6537843e..f98d4d8be 100644
--- a/src/lib/sndfile_decoder.cc
+++ b/src/lib/sndfile_decoder.cc
@@ -18,6 +18,10 @@
*/
#include <iostream>
+#ifdef DCPOMATIC_WINDOWS
+#include <windows.h>
+#define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1
+#endif
#include <sndfile.h>
#include "sndfile_content.h"
#include "sndfile_decoder.h"
@@ -40,7 +44,14 @@ SndfileDecoder::SndfileDecoder (shared_ptr<const Film> f, shared_ptr<const Sndfi
, _deinterleave_buffer (0)
{
_info.format = 0;
+
+ /* Here be monsters. See fopen_boost for similar shenanigans */
+#ifdef DCPOMATIC_WINDOWS
+ _sndfile = sf_wchar_open (_sndfile_content->path(0).c_str(), SFM_READ, &_info);
+#else
_sndfile = sf_open (_sndfile_content->path(0).string().c_str(), SFM_READ, &_info);
+#endif
+
if (!_sndfile) {
throw DecodeError (_("could not open audio file for reading"));
}
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index 715d42087..6b534f4de 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -81,6 +81,8 @@ static wxMenu* jobs_menu = 0;
static void set_menu_sensitivity ();
+// #define DCPOMATIC_WINDOWS_CONSOLE 1
+
class FilmChangedDialog
{
public:
@@ -255,7 +257,7 @@ public:
, _hints_dialog (0)
, _servers_list_dialog (0)
{
-#ifdef DCPOMATIC_WINDOWS_CONSOLE
+#if defined(DCPOMATIC_WINDOWS) && defined(DCPOMATIC_WINDOWS_CONSOLE)
AllocConsole();
HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE);
diff --git a/src/wx/about_dialog.cc b/src/wx/about_dialog.cc
index d24032849..ca217a227 100644
--- a/src/wx/about_dialog.cc
+++ b/src/wx/about_dialog.cc
@@ -134,6 +134,7 @@ AboutDialog::AboutDialog (wxWindow* parent)
supported_by.Add (wxT ("Jeff Boot"));
supported_by.Add (wxT ("Filip Kovcin"));
supported_by.Add (wxT ("Adam Colt"));
+ supported_by.Add (wxT ("Lindsay Morris"));
add_section (_("Supported by"), supported_by);
wxArrayString testers;
diff --git a/src/wx/audio_plot.cc b/src/wx/audio_plot.cc
index f1d91b030..2e8b24e36 100644
--- a/src/wx/audio_plot.cc
+++ b/src/wx/audio_plot.cc
@@ -109,6 +109,15 @@ AudioPlot::set_message (wxString s)
Refresh ();
}
+struct Metrics
+{
+ double db_label_width;
+ int height;
+ int y_origin;
+ float x_scale;
+ float y_scale;
+};
+
void
AudioPlot::paint ()
{
@@ -130,34 +139,35 @@ AudioPlot::paint ()
wxDouble db_label_height;
wxDouble db_label_descent;
wxDouble db_label_leading;
- gc->GetTextExtent (wxT ("-80dB"), &_db_label_width, &db_label_height, &db_label_descent, &db_label_leading);
+ Metrics metrics;
+ gc->GetTextExtent (wxT ("-80dB"), &metrics.db_label_width, &db_label_height, &db_label_descent, &db_label_leading);
- _db_label_width += 8;
+ metrics.db_label_width += 8;
- int const data_width = GetSize().GetWidth() - _db_label_width;
+ int const data_width = GetSize().GetWidth() - metrics.db_label_width;
/* Assume all channels have the same number of points */
- _x_scale = data_width / float (_analysis->points (0));
- _height = GetSize().GetHeight ();
- _y_origin = 32;
- _y_scale = (_height - _y_origin) / -_minimum;
+ metrics.x_scale = data_width / float (_analysis->points (0));
+ metrics.height = GetSize().GetHeight ();
+ metrics.y_origin = 32;
+ metrics.y_scale = (metrics.height - metrics.y_origin) / -_minimum;
for (int i = _minimum; i <= 0; i += 10) {
- int const y = (_height - (i - _minimum) * _y_scale) - _y_origin;
- grid.MoveToPoint (_db_label_width - 4, y);
- grid.AddLineToPoint (_db_label_width + data_width, y);
+ int const y = (metrics.height - (i - _minimum) * metrics.y_scale) - metrics.y_origin;
+ grid.MoveToPoint (metrics.db_label_width - 4, y);
+ grid.AddLineToPoint (metrics.db_label_width + data_width, y);
gc->DrawText (std_to_wx (String::compose ("%1dB", i)), 0, y - (db_label_height / 2));
}
gc->SetPen (*wxLIGHT_GREY_PEN);
gc->StrokePath (grid);
- gc->DrawText (_("DCPTime"), data_width, _height - _y_origin + db_label_height / 2);
+ gc->DrawText (_("Time"), data_width, metrics.height - metrics.y_origin + db_label_height / 2);
if (_type_visible[AudioPoint::PEAK]) {
for (int c = 0; c < MAX_AUDIO_CHANNELS; ++c) {
wxGraphicsPath p = gc->CreatePath ();
if (_channel_visible[c] && c < _analysis->channels()) {
- plot_peak (p, c);
+ plot_peak (p, c, metrics);
}
wxColour const col = _colours[c];
gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (col.Red(), col.Green(), col.Blue(), col.Alpha() / 2), 1, wxPENSTYLE_SOLID));
@@ -169,7 +179,7 @@ AudioPlot::paint ()
for (int c = 0; c < MAX_AUDIO_CHANNELS; ++c) {
wxGraphicsPath p = gc->CreatePath ();
if (_channel_visible[c] && c < _analysis->channels()) {
- plot_rms (p, c);
+ plot_rms (p, c, metrics);
}
wxColour const col = _colours[c];
gc->SetPen (*wxThePenList->FindOrCreatePen (col, 1, wxPENSTYLE_SOLID));
@@ -178,9 +188,9 @@ AudioPlot::paint ()
}
wxGraphicsPath axes = gc->CreatePath ();
- axes.MoveToPoint (_db_label_width, 0);
- axes.AddLineToPoint (_db_label_width, _height - _y_origin);
- axes.AddLineToPoint (_db_label_width + data_width, _height - _y_origin);
+ axes.MoveToPoint (metrics.db_label_width, 0);
+ axes.AddLineToPoint (metrics.db_label_width, metrics.height - metrics.y_origin);
+ axes.AddLineToPoint (metrics.db_label_width + data_width, metrics.height - metrics.y_origin);
gc->SetPen (*wxBLACK_PEN);
gc->StrokePath (axes);
@@ -188,19 +198,23 @@ AudioPlot::paint ()
}
float
-AudioPlot::y_for_linear (float p) const
+AudioPlot::y_for_linear (float p, Metrics const & metrics) const
{
- return _height - (20 * log10(p) - _minimum + _gain) * _y_scale - _y_origin;
+ if (p < 1e-4) {
+ p = 1e-4;
+ }
+
+ return metrics.height - (20 * log10(p) - _minimum + _gain) * metrics.y_scale - metrics.y_origin;
}
void
-AudioPlot::plot_peak (wxGraphicsPath& path, int channel) const
+AudioPlot::plot_peak (wxGraphicsPath& path, int channel, Metrics const & metrics) const
{
if (_analysis->points (channel) == 0) {
return;
}
- path.MoveToPoint (_db_label_width, y_for_linear (_analysis->get_point(channel, 0)[AudioPoint::PEAK]));
+ path.MoveToPoint (metrics.db_label_width, y_for_linear (_analysis->get_point(channel, 0)[AudioPoint::PEAK], metrics));
float peak = 0;
int const N = _analysis->points(channel);
@@ -212,19 +226,19 @@ AudioPlot::plot_peak (wxGraphicsPath& path, int channel) const
} else if (peak < 0) {
peak = 0;
}
-
- path.AddLineToPoint (_db_label_width + i * _x_scale, y_for_linear (peak));
+
+ path.AddLineToPoint (metrics.db_label_width + i * metrics.x_scale, y_for_linear (peak, metrics));
}
}
void
-AudioPlot::plot_rms (wxGraphicsPath& path, int channel) const
+AudioPlot::plot_rms (wxGraphicsPath& path, int channel, Metrics const & metrics) const
{
if (_analysis->points (channel) == 0) {
return;
}
- path.MoveToPoint (_db_label_width, y_for_linear (_analysis->get_point(channel, 0)[AudioPoint::RMS]));
+ path.MoveToPoint (metrics.db_label_width, y_for_linear (_analysis->get_point(channel, 0)[AudioPoint::RMS], metrics));
list<float> smoothing;
@@ -247,7 +261,7 @@ AudioPlot::plot_rms (wxGraphicsPath& path, int channel) const
smoothing.push_back (last);
}
}
-
+
for (int i = 0; i < N; ++i) {
int const next_for_window = i + after;
@@ -269,7 +283,7 @@ AudioPlot::plot_rms (wxGraphicsPath& path, int channel) const
p = sqrt (p / smoothing.size ());
}
- path.AddLineToPoint (_db_label_width + i * _x_scale, y_for_linear (p));
+ path.AddLineToPoint (metrics.db_label_width + i * metrics.x_scale, y_for_linear (p, metrics));
}
}
diff --git a/src/wx/audio_plot.h b/src/wx/audio_plot.h
index 094f8e1b0..7eedd8ffe 100644
--- a/src/wx/audio_plot.h
+++ b/src/wx/audio_plot.h
@@ -23,6 +23,8 @@
#include "lib/util.h"
#include "lib/audio_analysis.h"
+class Metrics;
+
class AudioPlot : public wxPanel
{
public:
@@ -39,6 +41,9 @@ public:
private:
void paint ();
+ void plot_peak (wxGraphicsPath &, int, Metrics const &) const;
+ void plot_rms (wxGraphicsPath &, int, Metrics const &) const;
+ float y_for_linear (float, Metrics const &) const;
boost::shared_ptr<AudioAnalysis> _analysis;
bool _channel_visible[MAX_AUDIO_CHANNELS];
@@ -48,16 +53,6 @@ private:
int _smoothing;
std::vector<wxColour> _colours;
- void plot_peak (wxGraphicsPath &, int) const;
- void plot_rms (wxGraphicsPath &, int) const;
- float y_for_linear (float) const;
-
- double _db_label_width;
- int _height;
- int _y_origin;
- float _x_scale;
- float _y_scale;
-
wxString _message;
static const int _minimum;