diff options
author | Robin Gareus <robin@gareus.org> | 2018-11-20 03:21:17 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2018-11-20 03:21:17 +0100 |
commit | 7b709b3cea2fd873a5f64be6f598e3741c259ca5 (patch) | |
tree | f89fda4880ad67540935a879d3f250dd958bb32b /libs/ardour/export_graph_builder.cc | |
parent | cdc5b88c91541f70de57c196570e12ee05a14af9 (diff) |
Implement vorbis encoder quality
This also prepares for codec-quality defaults, but
ExportFormatSpecification does not yet set those for previously unset
or new formats/presets.
Diffstat (limited to 'libs/ardour/export_graph_builder.cc')
-rw-r--r-- | libs/ardour/export_graph_builder.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/ardour/export_graph_builder.cc b/libs/ardour/export_graph_builder.cc index e190791291..c09e00219d 100644 --- a/libs/ardour/export_graph_builder.cc +++ b/libs/ardour/export_graph_builder.cc @@ -305,6 +305,13 @@ ExportGraphBuilder::Encoder::init_writer (boost::shared_ptr<AudioGrapher::Sndfil writer.reset (new AudioGrapher::SndfileWriter<T> (writer_filename, format, channels, config.format->sample_rate(), config.broadcast_info)); writer->FileWritten.connect_same_thread (copy_files_connection, boost::bind (&ExportGraphBuilder::Encoder::copy_files, this, _1)); + if (format & ExportFormatBase::SF_Vorbis) { + /* libsndfile uses range 0..1 (best .. worst) */ + double vorbis_quality = 1.0 - config.format->codec_quality () / 100.f; + if (vorbis_quality >= 0 && vorbis_quality <= 1.0) { + writer->command (SFC_SET_COMPRESSION_LEVEL, &vorbis_quality, sizeof (double)); + } + } } template<typename T> |