2 Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 /** @file src/lib/audio_content.h
21 * @brief AudioContent and AudioContentProperty classes.
24 #ifndef DCPOMATIC_AUDIO_CONTENT_H
25 #define DCPOMATIC_AUDIO_CONTENT_H
28 #include "audio_mapping.h"
36 /** @class AudioContentProperty
37 * @brief Names for properties of AudioContent.
39 class AudioContentProperty
42 static int const AUDIO_CHANNELS;
43 static int const AUDIO_FRAME_RATE;
44 static int const AUDIO_GAIN;
45 static int const AUDIO_DELAY;
46 static int const AUDIO_MAPPING;
47 static int const AUDIO_PROCESSOR;
50 /** @class AudioContent
51 * @brief Parent class for content which may contain audio data.
53 class AudioContent : public virtual Content
56 AudioContent (boost::shared_ptr<const Film>);
57 AudioContent (boost::shared_ptr<const Film>, DCPTime);
58 AudioContent (boost::shared_ptr<const Film>, boost::filesystem::path);
59 AudioContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr);
60 AudioContent (boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
62 void as_xml (xmlpp::Node *) const;
63 std::string technical_summary () const;
65 /** @return number of audio channels in the content */
66 virtual int audio_channels () const = 0;
67 /** @return the frame rate of the content */
68 virtual int audio_frame_rate () const = 0;
69 virtual AudioMapping audio_mapping () const = 0;
70 virtual void set_audio_mapping (AudioMapping);
71 virtual boost::filesystem::path audio_analysis_path () const;
73 int resampled_audio_frame_rate () const;
74 int processed_audio_channels () const;
76 boost::signals2::connection analyse_audio (boost::function<void()>);
78 void set_audio_gain (double);
79 void set_audio_delay (int);
80 void set_audio_processor (AudioProcessor const *);
82 double audio_gain () const {
83 boost::mutex::scoped_lock lm (_mutex);
87 int audio_delay () const {
88 boost::mutex::scoped_lock lm (_mutex);
92 AudioProcessor const * audio_processor () const {
93 boost::mutex::scoped_lock lm (_mutex);
94 return _audio_processor;
97 std::string processing_description () const;
100 /** Gain to apply to audio in dB */
102 /** Delay to apply to audio (positive moves audio later) in milliseconds */
104 AudioProcessor const * _audio_processor;