ardour
export_format_manager.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 Paul Davis
3  Author: Sakari Bergen
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 
19 */
20 
21 #ifndef __ardour_export_format_manager_h__
22 #define __ardour_export_format_manager_h__
23 
24 #include <list>
25 #include <string>
26 
27 #include <boost/shared_ptr.hpp>
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  };
66  typedef std::list<QualityPtr> QualityList;
67 
68  /* Sample rate states */
69 
71  public:
73  : rate (rate) { set_name (name); }
75  };
78  typedef std::list<SampleRatePtr> SampleRateList;
79 
80  public:
81 
82  explicit ExportFormatManager (ExportFormatSpecPtr specification);
84 
85  /* Signals */
86 
87  PBD::Signal1<void,bool> CompleteChanged;
88  PBD::Signal0<void> DescriptionChanged;
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);
106  void select_src_quality (ExportFormatBase::SRCQuality value);
107  void select_trim_beginning (bool value);
108  void select_silence_beginning (AnyTime const & time);
109  void select_trim_end (bool value);
110  void select_silence_end (AnyTime const & time);
111  void select_normalize (bool value);
112  void select_normalize_target (float value);
113  void select_tagging (bool tag);
114 
115  private:
116 
117  void init_compatibilities ();
118  void init_qualities ();
119  void init_formats ();
120  void init_sample_rates ();
121 
122  void add_compatibility (ExportFormatCompatibilityPtr ptr);
123  void add_quality (QualityPtr ptr);
124  void add_format (ExportFormatPtr ptr);
125  void add_sample_rate (SampleRatePtr ptr);
126 
127  /* Connected to signals */
128 
129  void change_compatibility_selection (bool select, WeakExportFormatCompatibilityPtr const & compat);
130  void change_quality_selection (bool select, WeakQualityPtr const & quality);
131  void change_format_selection (bool select, WeakExportFormatPtr const & format);
132  void change_sample_rate_selection (bool select, WeakSampleRatePtr const & rate);
133 
134  void change_sample_format_selection (bool select, WeakSampleFormatPtr const & format);
135  void change_dither_type_selection (bool select, WeakDitherTypePtr const & type);
136 
137  /* Do actual selection */
138 
139  void select_compatibility (WeakExportFormatCompatibilityPtr const & compat);
140  void select_quality (QualityPtr const & quality);
141  void select_format (ExportFormatPtr const & format);
142  void select_sample_rate (SampleRatePtr const & rate);
143 
144  void select_sample_format (SampleFormatPtr const & format);
145  void select_dither_type (DitherTypePtr const & type);
146 
148  void selection_changed ();
149  void check_for_description_change ();
150 
151  /* Formats and compatibilities */
152 
153  QualityPtr get_selected_quality ();
154  ExportFormatPtr get_selected_format ();
155  SampleRatePtr get_selected_sample_rate ();
156 
157  SampleFormatPtr get_selected_sample_format ();
158 
159  ExportFormatBasePtr get_compatibility_intersection ();
160 
163 
164  CompatList compatibilities;
165  QualityList qualities;
166  FormatList formats;
167  SampleRateList sample_rates;
168 
169  std::string prev_description;
170 
171 };
172 
173 } // namespace ARDOUR
174 
175 #endif /* __ardour_export_format_manager_h__ */
HasSampleFormat::SampleFormatPtr SampleFormatPtr
boost::shared_ptr< SampleRateState > SampleRatePtr
SampleRateList const & get_sample_rates()
QualityList const & get_qualities()
std::list< SampleFormatPtr > SampleFormatList
HasSampleFormat::WeakSampleFormatPtr WeakSampleFormatPtr
std::list< ExportFormatCompatibilityPtr > CompatList
HasSampleFormat::DitherTypePtr DitherTypePtr
std::list< ExportFormatPtr > FormatList
std::list< SampleRatePtr > SampleRateList
HasSampleFormat::SampleFormatList SampleFormatList
ExportFormatSpecPtr current_selection
CompatList const & get_compatibilities()
Definition: amp.h:29
HasSampleFormat::WeakDitherTypePtr WeakDitherTypePtr
Class for managing selection and compatibility states.
#define LIBARDOUR_API
FormatList const & get_formats()
const char * name
SampleRateState(ExportFormatBase::SampleRate rate, std::string name)
PBD::Signal1< void, bool > CompleteChanged
LIBARDOUR_API PBD::PropertyDescriptor< bool > select
Definition: route_group.cc:48
std::list< QualityPtr > QualityList
boost::weak_ptr< QualityState > WeakQualityPtr
QualityState(ExportFormatBase::Quality quality, std::string name)
boost::weak_ptr< SampleRateState > WeakSampleRatePtr
boost::shared_ptr< QualityState > QualityPtr
PBD::Signal0< void > DescriptionChanged