From f4ac9430f3fc2c405334f3f02fe08a5782454396 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 9 Apr 2010 14:11:47 +0000 Subject: Prevent clipping during the import of files from sources that have amplitudes greater than 1 when data is being stored in files that are clamped. e.g. when importing hot sources and resampling them when the session file format is integer. git-svn-id: svn://localhost/ardour2/branches/3.0@6879 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/sndfileimportable.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libs/ardour/sndfileimportable.cc') diff --git a/libs/ardour/sndfileimportable.cc b/libs/ardour/sndfileimportable.cc index cc68f3ea01..758e8955c2 100644 --- a/libs/ardour/sndfileimportable.cc +++ b/libs/ardour/sndfileimportable.cc @@ -80,3 +80,11 @@ SndFileImportableSource::natural_position () const { return timecode; } + +bool +SndFileImportableSource::clamped_at_unity () const +{ + int const sub = sf_info.format & SF_FORMAT_SUBMASK; + /* XXX: this may not be the full list of formats that are unclamped */ + return (sub != SF_FORMAT_FLOAT && sub != SF_FORMAT_DOUBLE); +} -- cgit v1.2.3