From df83c0381e126f17d59039ab8b61789bfe27a79f Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 2 Oct 2017 20:40:44 +0200 Subject: Prepare support for compression levels (archive + flac) --- libs/ardour/sndfilesource.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libs/ardour/sndfilesource.cc') diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index 9c49e1e1fb..c69325741e 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -276,6 +276,21 @@ SndFileSource::SndFileSource (Session& s, const AudioFileSource& other, const st throw failed_constructor(); } +#if 0 + /* setting flac compression quality above the default does not produce a significant size + * improvement (not for large raw recordings anyway, the_CLA tests 2017-10-02, >> 250MB files, + * ~1% smaller), but does have a significant encoding speed penalty. + * + * We still may expose this as option someday though, perhaps for opposite reason: "fast encoding" + */ + double flac_quality = 1; // libsndfile uses range 0..1 (mapped to flac 0..8), default is (5/8) + if (sf_command (_sndfile, SFC_SET_COMPRESSION_LEVEL, &flac_quality, sizeof (double)) != SF_TRUE) { + char errbuf[256]; + sf_error_str (_sndfile, errbuf, sizeof (errbuf) - 1); + error << string_compose (_("Cannot set flac compression level: %1"), errbuf) << endmsg; + } +#endif + Sample buf[8192]; samplecnt_t off = 0; float peak = 0; -- cgit v1.2.3