Add support for recording to .flac

This commit is contained in:
Robin Gareus 2018-11-07 19:21:39 +01:00
parent 1ca76c4e18
commit 2991afaf0d
5 changed files with 16 additions and 2 deletions

View File

@ -543,6 +543,7 @@ enum HeaderFormat {
RF64,
RF64_WAV,
MBWF,
FLAC,
};
struct PeakData {

View File

@ -380,6 +380,7 @@ setup_enum_writer ()
REGISTER_ENUM (RF64);
REGISTER_ENUM (RF64_WAV);
REGISTER_ENUM (MBWF);
REGISTER_ENUM (FLAC);
REGISTER (_HeaderFormat);
REGISTER_ENUM (AudioUnit);

View File

@ -1947,6 +1947,7 @@ LuaBindings::common (lua_State* L)
.addConst ("RF64", ARDOUR::HeaderFormat(RF64))
.addConst ("RF64_WAV", ARDOUR::HeaderFormat(RF64_WAV))
.addConst ("MBWF", ARDOUR::HeaderFormat(MBWF))
.addConst ("FLAC", ARDOUR::HeaderFormat(FLAC))
.endNamespace ()
.beginNamespace ("InsertMergePolicy")

View File

@ -133,6 +133,15 @@ SndFileSource::SndFileSource (Session& s, const string& path, const string& orig
_flags = Flag (_flags & ~Broadcast);
break;
case FLAC:
fmt = SF_FORMAT_FLAC;
if (sfmt == FormatFloat) {
sfmt = FormatInt24;
}
_flags = Flag (_flags & ~Broadcast);
_flags = Flag (_flags & ~Destructive); // XXX or force WAV if destructive?
break;
case AIFF:
fmt = SF_FORMAT_AIFF;
_flags = Flag (_flags & ~Broadcast);
@ -384,8 +393,8 @@ SndFileSource::open ()
}
if ((_info.format & SF_FORMAT_TYPEMASK ) == SF_FORMAT_FLAC) {
assert (!writable());
_sndfile = sf_open_fd (fd, SFM_READ, &_info, true);
assert (!destructive());
_sndfile = sf_open_fd (fd, writable () ? SFM_WRITE : SFM_READ, &_info, true);
} else {
_sndfile = sf_open_fd (fd, writable() ? SFM_RDWR : SFM_READ, &_info, true);
}

View File

@ -568,6 +568,8 @@ ARDOUR::native_header_format_extension (HeaderFormat hf, const DataType& type)
return ".aif";
case iXML:
return ".ixml";
case FLAC:
return ".flac";
case RF64:
case RF64_WAV:
case MBWF: