2 Copyright (C) 2014-2021 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 /** @file src/lib/audio_processor.h
23 * @brief AudioProcessor class.
27 #ifndef DCPOMATIC_AUDIO_PROCESSOR_H
28 #define DCPOMATIC_AUDIO_PROCESSOR_H
41 /** @class AudioProcessor
42 * @brief A parent class for processors of audio data.
44 * These are used to process data before it goes into the DCP, for things like
45 * stereo -> 5.1 upmixing.
50 virtual ~AudioProcessor () {}
52 /** @return User-visible (translated) name */
53 virtual std::string name () const = 0;
54 /** @return An internal identifier */
55 virtual std::string id () const = 0;
56 /** @return Number of output channels */
57 virtual int out_channels () const = 0;
58 /** @return A clone of this AudioProcessor for operation at the specified sampling rate */
59 virtual std::shared_ptr<AudioProcessor> clone (int sampling_rate) const = 0;
60 /** Process some data, returning the processed result truncated or padded to `channels' */
61 virtual std::shared_ptr<AudioBuffers> run (std::shared_ptr<const AudioBuffers>, int channels) = 0;
62 virtual void flush () {}
63 /** Make the supplied audio mapping into a sensible default for this processor */
64 virtual void make_audio_mapping_default (AudioMapping& mapping) const = 0;
65 /** @return the user-visible (translated) names of each of our inputs, in order */
66 virtual std::vector<NamedChannel> input_names () const = 0;
68 static std::list<AudioProcessor const *> all ();
69 static std::list<AudioProcessor const *> visible ();
70 static void setup_audio_processors ();
71 static AudioProcessor const * from_id (std::string);
74 static std::list<AudioProcessor const *> _all;
75 static std::list<AudioProcessor const *> _non_experimental;