Ardour  9.0-pre0-582-g084a23a80d
export_format_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2013 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2009 David Robillard <d@drobilla.net>
4  * Copyright (C) 2011-2012 Sakari Bergen <sakari.bergen@beatwaves.net>
5  * Copyright (C) 2013-2014 Colin Fletcher <colin.m.fletcher@googlemail.com>
6  * Copyright (C) 2016-2018 Robin Gareus <robin@gareus.org>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 
23 #pragma once
24 
25 #include <list>
26 #include <memory>
27 #include <string>
28 
29 #include "pbd/signals.h"
30 
31 #include "ardour/export_formats.h"
32 #include "ardour/export_pointers.h"
33 
34 namespace ARDOUR
35 {
36 
37 class ExportFormat;
38 class ExportFormatCompatibility;
39 class ExportFormatSpecification;
40 class AnyTime;
41 
43 {
44  public:
45 
46  typedef std::list<ExportFormatCompatibilityPtr> CompatList;
47  typedef std::list<ExportFormatPtr> FormatList;
48 
52 
55 
56  /* Quality states */
57 
59  public:
60  QualityState (ExportFormatBase::Quality quality, std::string name) :
61  quality (quality) { set_name (name); }
63  };
64  typedef std::shared_ptr<QualityState> QualityPtr;
65  typedef std::weak_ptr<QualityState> WeakQualityPtr;
66  typedef std::list<QualityPtr> QualityList;
67 
68  /* Sample rate states */
69 
71  public:
73  : rate (rate) { set_name (name); }
75  };
76  typedef std::shared_ptr<SampleRateState> SampleRatePtr;
77  typedef std::weak_ptr<SampleRateState> WeakSampleRatePtr;
78  typedef std::list<SampleRatePtr> SampleRateList;
79 
80  public:
81 
82  explicit ExportFormatManager (ExportFormatSpecPtr specification);
84 
85  /* Signals */
86 
89 
90  /* Access to lists */
91 
92  CompatList const & get_compatibilities () { return compatibilities; }
93  QualityList const & get_qualities () { return qualities; }
94  FormatList const & get_formats () { return formats; }
95  SampleRateList const & get_sample_rates () { return sample_rates; }
96 
97  /* Non interactive selections */
98 
99  void set_name (std::string name);
100 
101  void select_with_cue (bool);
102  void select_with_toc (bool);
103  void select_with_mp4chaps (bool);
104  void select_upload (bool);
105  void set_command (std::string);
108  void select_trim_beginning (bool value);
109  void select_silence_beginning (AnyTime const & time);
110  void select_trim_end (bool value);
111  void select_silence_end (AnyTime const & time);
112  void select_normalize (bool value);
113  void select_normalize_loudness (bool value);
114  void select_tp_limiter (bool value);
115  void select_normalize_dbfs (float value);
116  void select_normalize_lufs (float value);
117  void select_normalize_dbtp (float value);
118  void select_tagging (bool tag);
119  void select_demo_noise_level (float value);
120  void select_demo_noise_duration (int value);
121  void select_demo_noise_interval (int value);
122 
123  private:
124 
126  void init_qualities ();
127  void init_formats ();
129 
134 
135  /* Connected to signals */
136 
138  void change_quality_selection (bool select, WeakQualityPtr const & quality);
139  void change_format_selection (bool select, WeakExportFormatPtr const & format);
140  void change_sample_rate_selection (bool select, WeakSampleRatePtr const & rate);
141 
142  void change_sample_format_selection (bool select, WeakSampleFormatPtr const & format);
143  void change_dither_type_selection (bool select, WeakDitherTypePtr const & type);
144 
145  /* Do actual selection */
146 
148  void select_quality (QualityPtr const & quality);
149  void select_format (ExportFormatPtr const & format);
150  void select_sample_rate (SampleRatePtr const & rate);
151 
152  void select_sample_format (SampleFormatPtr const & format);
153  void select_dither_type (DitherTypePtr const & type);
154 
158 
159  /* Formats and compatibilities */
160 
164 
166 
168 
171 
176 
177  std::string prev_description;
178 
179 };
180 
181 } // namespace ARDOUR
182 
Class for managing selection and compatibility states.
QualityState(ExportFormatBase::Quality quality, std::string name)
SampleRateState(ExportFormatBase::SampleRate rate, std::string name)
void select_dither_type(DitherTypePtr const &type)
QualityPtr get_selected_quality()
void select_normalize_dbtp(float value)
void select_silence_end(AnyTime const &time)
void select_tp_limiter(bool value)
PBD::Signal< void(bool)> CompleteChanged
CompatList const & get_compatibilities()
void select_normalize_loudness(bool value)
std::weak_ptr< SampleRateState > WeakSampleRatePtr
void add_format(ExportFormatPtr ptr)
void add_sample_rate(SampleRatePtr ptr)
std::shared_ptr< SampleRateState > SampleRatePtr
std::list< QualityPtr > QualityList
void change_dither_type_selection(bool select, WeakDitherTypePtr const &type)
HasSampleFormat::WeakSampleFormatPtr WeakSampleFormatPtr
void select_normalize_dbfs(float value)
std::weak_ptr< QualityState > WeakQualityPtr
void select_quality(QualityPtr const &quality)
void select_tagging(bool tag)
void select_format(ExportFormatPtr const &format)
HasSampleFormat::SampleFormatList SampleFormatList
void select_demo_noise_interval(int value)
SampleFormatPtr get_selected_sample_format()
void select_sample_rate(SampleRatePtr const &rate)
void change_compatibility_selection(bool select, WeakExportFormatCompatibilityPtr const &compat)
void change_sample_format_selection(bool select, WeakSampleFormatPtr const &format)
std::shared_ptr< QualityState > QualityPtr
void select_src_quality(ExportFormatBase::SRCQuality value)
ExportFormatSpecPtr current_selection
void set_command(std::string)
void set_name(std::string name)
HasSampleFormat::WeakDitherTypePtr WeakDitherTypePtr
ExportFormatPtr get_selected_format()
ExportFormatManager(ExportFormatSpecPtr specification)
std::list< ExportFormatPtr > FormatList
void change_sample_rate_selection(bool select, WeakSampleRatePtr const &rate)
void select_trim_beginning(bool value)
HasSampleFormat::SampleFormatPtr SampleFormatPtr
void select_demo_noise_level(float value)
void select_normalize_lufs(float value)
void select_trim_end(bool value)
std::list< SampleRatePtr > SampleRateList
SampleRatePtr get_selected_sample_rate()
PBD::Signal< void()> DescriptionChanged
void select_silence_beginning(AnyTime const &time)
QualityList const & get_qualities()
ExportFormatBasePtr get_compatibility_intersection()
FormatList const & get_formats()
void add_quality(QualityPtr ptr)
void change_format_selection(bool select, WeakExportFormatPtr const &format)
void change_quality_selection(bool select, WeakQualityPtr const &quality)
void select_sample_format(SampleFormatPtr const &format)
SampleRateList const & get_sample_rates()
HasSampleFormat::DitherTypePtr DitherTypePtr
std::list< ExportFormatCompatibilityPtr > CompatList
void select_compatibility(WeakExportFormatCompatibilityPtr const &compat)
void select_demo_noise_duration(int value)
void add_compatibility(ExportFormatCompatibilityPtr ptr)
void select_normalize(bool value)
std::weak_ptr< DitherTypeState > WeakDitherTypePtr
std::shared_ptr< DitherTypeState > DitherTypePtr
std::weak_ptr< SampleFormatState > WeakSampleFormatPtr
std::list< SampleFormatPtr > SampleFormatList
std::shared_ptr< SampleFormatState > SampleFormatPtr
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBARDOUR_API
std::weak_ptr< ExportFormatCompatibility > WeakExportFormatCompatibilityPtr
std::shared_ptr< ExportFormat > ExportFormatPtr
std::shared_ptr< ExportFormatCompatibility > ExportFormatCompatibilityPtr
std::weak_ptr< ExportFormat > WeakExportFormatPtr
std::shared_ptr< ExportFormatBase > ExportFormatBasePtr
std::shared_ptr< ExportFormatSpecification > ExportFormatSpecPtr