Missed update to private test repo version.
[dcpomatic.git] / src / lib / audio_processor.h
1 /*
2     Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
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.
10
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.
15
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/>.
18
19 */
20
21
22 /** @file  src/lib/audio_processor.h
23  *  @brief AudioProcessor class.
24  */
25
26
27 #ifndef DCPOMATIC_AUDIO_PROCESSOR_H
28 #define DCPOMATIC_AUDIO_PROCESSOR_H
29
30
31 #include "types.h"
32 #include <memory>
33 #include <string>
34 #include <vector>
35
36
37 class AudioBuffers;
38 class AudioMapping;
39
40
41 /** @class AudioProcessor
42  *  @brief A parent class for processors of audio data.
43  *
44  *  These are used to process data before it goes into the DCP, for things like
45  *  stereo -> 5.1 upmixing.
46  */
47 class AudioProcessor
48 {
49 public:
50         virtual ~AudioProcessor () {}
51
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;
67
68         static std::vector<AudioProcessor const *> all ();
69         static std::vector<AudioProcessor const *> visible ();
70         static void setup_audio_processors ();
71         static AudioProcessor const * from_id (std::string);
72
73 private:
74         static std::vector<std::unique_ptr<const AudioProcessor>> _experimental;
75         static std::vector<std::unique_ptr<const AudioProcessor>> _non_experimental;
76 };
77
78
79 #endif