From 7ed37d67ff7aa83b5f12dc6fcef73b28a97de1b3 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 22 Nov 2018 20:36:41 +0100 Subject: [PATCH] Backwards compatible sndfile support SFC_SET_COMPRESSION_LEVEL was only added in 2012 and only available in libsndfile 1.0.26 or later. --- libs/ardour/export_graph_builder.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/ardour/export_graph_builder.cc b/libs/ardour/export_graph_builder.cc index f9b9ad1b56..dad0f47219 100644 --- a/libs/ardour/export_graph_builder.cc +++ b/libs/ardour/export_graph_builder.cc @@ -307,10 +307,13 @@ ExportGraphBuilder::Encoder::init_writer (boost::shared_ptr (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) */ + /* libsndfile uses range 0..1 (worst.. best) for + * SFC_SET_VBR_ENCODING_QUALITY and maps + * SFC_SET_COMPRESSION_LEVEL = 1.0 - VBR_ENCODING_QUALITY + */ 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)); + writer->command (SFC_SET_VBR_ENCODING_QUALITY, &vorbis_quality, sizeof (double)); } } }