summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-02-27 22:47:27 +0100
committerCarl Hetherington <cth@carlh.net>2020-02-27 22:47:27 +0100
commit03b9ef36942b2d3e0b2054f465bcbe8e029069b2 (patch)
treeb913ee8f277723186802b128b03b05dd31881221 /src
parent1c4d14337cd061c0ef72f1fcde66be28235830ca (diff)
Allow > 0dB gain per channel in the audio matrix (#1720).v2.15.44
Diffstat (limited to 'src')
-rw-r--r--src/wx/audio_gain_dialog.cc2
-rw-r--r--src/wx/audio_mapping_view.cc18
2 files changed, 12 insertions, 8 deletions
diff --git a/src/wx/audio_gain_dialog.cc b/src/wx/audio_gain_dialog.cc
index 5cd936d24..118112365 100644
--- a/src/wx/audio_gain_dialog.cc
+++ b/src/wx/audio_gain_dialog.cc
@@ -31,7 +31,7 @@ AudioGainDialog::AudioGainDialog (wxWindow* parent, int c, int d, float v)
_gain = add (new wxSpinCtrlDouble (this));
add (_("dB"), false);
- _gain->SetRange (-144, 0);
+ _gain->SetRange (-144, 18);
_gain->SetDigits (1);
_gain->SetIncrement (0.1);
diff --git a/src/wx/audio_mapping_view.cc b/src/wx/audio_mapping_view.cc
index df2759ef6..1d9c08535 100644
--- a/src/wx/audio_mapping_view.cc
+++ b/src/wx/audio_mapping_view.cc
@@ -55,9 +55,10 @@ using dcp::locale_convert;
enum {
ID_off = 1,
- ID_full = 2,
- ID_minus6dB = 3,
- ID_edit = 4
+ ID_minus6dB = 2,
+ ID_0dB = 3,
+ ID_plus3dB = 4,
+ ID_edit = 5
};
AudioMappingView::AudioMappingView (wxWindow* parent, wxString left_label, wxString from, wxString top_label, wxString to)
@@ -71,8 +72,9 @@ AudioMappingView::AudioMappingView (wxWindow* parent, wxString left_label, wxStr
{
_menu = new wxMenu;
_menu->Append (ID_off, _("Off"));
- _menu->Append (ID_full, _("Full"));
_menu->Append (ID_minus6dB, _("-6dB"));
+ _menu->Append (ID_0dB, _("0dB (unchanged)"));
+ _menu->Append (ID_plus3dB, _("+3dB"));
_menu->Append (ID_edit, _("Edit..."));
_body = new wxPanel (this, wxID_ANY);
@@ -85,8 +87,9 @@ AudioMappingView::AudioMappingView (wxWindow* parent, wxString left_label, wxStr
Bind (wxEVT_SIZE, boost::bind(&AudioMappingView::size, this, _1));
Bind (wxEVT_MENU, boost::bind(&AudioMappingView::set_gain_from_menu, this, 0), ID_off);
- Bind (wxEVT_MENU, boost::bind(&AudioMappingView::set_gain_from_menu, this, 1), ID_full);
Bind (wxEVT_MENU, boost::bind(&AudioMappingView::set_gain_from_menu, this, db_to_linear(-6)), ID_minus6dB);
+ Bind (wxEVT_MENU, boost::bind(&AudioMappingView::set_gain_from_menu, this, 1), ID_0dB);
+ Bind (wxEVT_MENU, boost::bind(&AudioMappingView::set_gain_from_menu, this, db_to_linear(3)), ID_plus3dB);
Bind (wxEVT_MENU, boost::bind(&AudioMappingView::edit, this), ID_edit);
Bind (wxEVT_MOUSEWHEEL, boost::bind(&AudioMappingView::mouse_wheel, this, _1));
_body->Bind (wxEVT_PAINT, boost::bind(&AudioMappingView::paint, this));
@@ -309,13 +312,14 @@ AudioMappingView::paint_indicators (wxDC& dc)
);
float const value_dB = linear_to_db(_map.get(y, x));
+ wxColour const colour = value_dB <= 0 ? wxColour(0, 255, 0) : wxColour(255, 150, 0);
int const range = 18;
int height = 0;
if (value_dB > -range) {
- height = INDICATOR_SIZE * (1 + value_dB / range);
+ height = min(INDICATOR_SIZE, static_cast<int>(INDICATOR_SIZE * (1 + value_dB / range)));
}
- dc.SetBrush (*wxTheBrushList->FindOrCreateBrush(wxColour (0, 255, 0), wxBRUSHSTYLE_SOLID));
+ dc.SetBrush (*wxTheBrushList->FindOrCreateBrush(colour, wxBRUSHSTYLE_SOLID));
dc.DrawRectangle (
wxRect(
LEFT_WIDTH + x * GRID_SPACING + (GRID_SPACING - INDICATOR_SIZE) / 2,