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/>.
22 #include "content_timeline_audio_view.h"
24 #include "lib/audio_content.h"
28 using std::dynamic_pointer_cast;
30 using std::shared_ptr;
33 /** @class ContentTimelineAudioView
34 * @brief Content timeline view for AudioContent.
38 ContentTimelineAudioView::ContentTimelineAudioView(ContentTimeline& tl, shared_ptr<Content> c)
39 : TimelineContentView (tl, c)
45 ContentTimelineAudioView::background_colour () const
47 return wxColour (149, 121, 232, 255);
51 ContentTimelineAudioView::foreground_colour () const
53 return wxColour (0, 0, 0, 255);
57 ContentTimelineAudioView::label () const
59 wxString s = TimelineContentView::label ();
60 shared_ptr<AudioContent> ac = content()->audio;
61 DCPOMATIC_ASSERT (ac);
63 if (ac->gain() > 0.01) {
64 s += wxString::Format (" +%.1fdB", ac->gain());
65 } else if (ac->gain() < -0.01) {
66 s += wxString::Format (" %.1fdB", ac->gain());
69 if (ac->delay() > 0) {
70 s += wxString::Format (_(" delayed by %dms"), ac->delay());
71 } else if (ac->delay() < 0) {
72 s += wxString::Format (_(" advanced by %dms"), -ac->delay());
75 list<int> mapped = ac->mapping().mapped_output_channels();
76 if (!mapped.empty ()) {
77 s += wxString::FromUTF8(" → ");
78 for (auto i: mapped) {
79 s += std_to_wx(short_audio_channel_name(i)) + ", ";
81 s = s.Left(s.Length() - 2);