diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-09-16 16:11:26 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-09-16 16:11:26 +0000 |
commit | 8e00b86ebb0b6e3fd489b4cac58863d7c16465db (patch) | |
tree | 27e602cbd16a9c948728b578df112b78f0d62c12 /libs/ardour/ardour | |
parent | 084dda86a7c4391aba4e9f37f752af4846ded15d (diff) |
make resampled sources (during import) report their "natural position" (i.e. BWF timecode) using the samplerate of the session, not the original source, for correct positioning; minor frame{pos,cnt}_t cleanup
git-svn-id: svn://localhost/ardour2/branches/3.0@7785 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/importable_source.h | 14 | ||||
-rw-r--r-- | libs/ardour/ardour/resampled_source.h | 14 | ||||
-rw-r--r-- | libs/ardour/ardour/sndfileimportable.h | 21 |
3 files changed, 27 insertions, 22 deletions
diff --git a/libs/ardour/ardour/importable_source.h b/libs/ardour/ardour/importable_source.h index 7df346a782..c610d546f2 100644 --- a/libs/ardour/ardour/importable_source.h +++ b/libs/ardour/ardour/importable_source.h @@ -30,13 +30,13 @@ public: ImportableSource () {} virtual ~ImportableSource() {} - virtual nframes_t read (Sample* buffer, nframes_t nframes) = 0; - virtual float ratio() const { return 1.0f; } - virtual uint32_t channels() const = 0; - virtual nframes_t length() const = 0; - virtual nframes_t samplerate() const = 0; - virtual void seek (nframes_t pos) = 0; - virtual nframes64_t natural_position() const = 0; + virtual nframes_t read (Sample* buffer, nframes_t nframes) = 0; + virtual float ratio() const { return 1.0f; } + virtual uint32_t channels() const = 0; + virtual framecnt_t length() const = 0; + virtual nframes_t samplerate() const = 0; + virtual void seek (nframes_t pos) = 0; + virtual framepos_t natural_position() const = 0; virtual bool clamped_at_unity () const = 0; }; diff --git a/libs/ardour/ardour/resampled_source.h b/libs/ardour/ardour/resampled_source.h index b61303b65c..6d630bc44b 100644 --- a/libs/ardour/ardour/resampled_source.h +++ b/libs/ardour/ardour/resampled_source.h @@ -34,13 +34,13 @@ class ResampledImportableSource : public ImportableSource ~ResampledImportableSource (); - nframes_t read (Sample* buffer, nframes_t nframes); - float ratio() const { return src_data.src_ratio; } - uint32_t channels() const { return source->channels(); } - nframes_t length() const { return source->length(); } - nframes_t samplerate() const { return source->samplerate(); } - void seek (nframes_t); - nframes64_t natural_position() const { return source->natural_position(); } + nframes_t read (Sample* buffer, nframes_t nframes); + float ratio() const { return src_data.src_ratio; } + uint32_t channels() const { return source->channels(); } + framecnt_t length() const { return source->length(); } + nframes_t samplerate() const { return source->samplerate(); } + void seek (nframes_t); + framepos_t natural_position() const; bool clamped_at_unity () const { /* resampling may generate inter-sample peaks with magnitude > 1 */ diff --git a/libs/ardour/ardour/sndfileimportable.h b/libs/ardour/ardour/sndfileimportable.h index 6e308415c9..aab8b6ac59 100644 --- a/libs/ardour/ardour/sndfileimportable.h +++ b/libs/ardour/ardour/sndfileimportable.h @@ -33,18 +33,23 @@ class SndFileImportableSource : public ImportableSource { SndFileImportableSource (const std::string& path); virtual ~SndFileImportableSource(); - nframes_t read (Sample* buffer, nframes_t nframes); - uint32_t channels() const; - nframes_t length() const; - nframes_t samplerate() const; - void seek (nframes_t pos); - nframes64_t natural_position() const; - bool clamped_at_unity () const; + nframes_t read (Sample* buffer, nframes_t nframes); + uint32_t channels() const; + framecnt_t length() const; + nframes_t samplerate() const; + void seek (nframes_t pos); + framepos_t natural_position() const; + bool clamped_at_unity () const; protected: SF_INFO sf_info; boost::shared_ptr<SNDFILE> in; - nframes_t timecode; + + /* these are int64_t so as to be independent of whatever + types Ardour may use for framepos_t, framecnt_t etc. + */ + + int64_t timecode; int64_t get_timecode_info (SNDFILE*, SF_BROADCAST_INFO*, bool&); }; |