2 Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #include "timeline_audio_content_view.h"
23 #include "lib/audio_content.h"
27 using std::shared_ptr;
28 using std::dynamic_pointer_cast;
30 /** @class TimelineAudioContentView
31 * @brief Timeline view for AudioContent.
34 TimelineAudioContentView::TimelineAudioContentView (Timeline& tl, shared_ptr<Content> c)
35 : TimelineContentView (tl, c)
41 TimelineAudioContentView::background_colour () const
43 return wxColour (149, 121, 232, 255);
47 TimelineAudioContentView::foreground_colour () const
49 return wxColour (0, 0, 0, 255);
53 TimelineAudioContentView::label () const
55 wxString s = TimelineContentView::label ();
56 shared_ptr<AudioContent> ac = content()->audio;
57 DCPOMATIC_ASSERT (ac);
59 if (ac->gain() > 0.01) {
60 s += wxString::Format (" +%.1fdB", ac->gain());
61 } else if (ac->gain() < -0.01) {
62 s += wxString::Format (" %.1fdB", ac->gain());
65 if (ac->delay() > 0) {
66 s += wxString::Format (_(" delayed by %dms"), ac->delay());
67 } else if (ac->delay() < 0) {
68 s += wxString::Format (_(" advanced by %dms"), -ac->delay());
71 list<int> mapped = ac->mapping().mapped_output_channels();
72 if (!mapped.empty ()) {
73 s += wxString::FromUTF8(" → ");
74 for (auto i: mapped) {
75 s += std_to_wx(short_audio_channel_name(i)) + ", ";
77 s = s.Left(s.Length() - 2);