#include <samplerate.h>
+#include "ardour/libardour_visibility.h"
#include "ardour/types.h"
#include "ardour/importable_source.h"
namespace ARDOUR {
-class ResampledImportableSource : public ImportableSource
+class LIBARDOUR_API ResampledImportableSource : public ImportableSource
{
public:
- ResampledImportableSource (boost::shared_ptr<ImportableSource>, nframes_t rate, SrcQuality);
+ ResampledImportableSource (boost::shared_ptr<ImportableSource>, framecnt_t rate, SrcQuality);
~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 pos) { source->seek (pos); }
- nframes64_t natural_position() const { return source->natural_position(); }
+ framecnt_t read (Sample* buffer, framecnt_t nframes);
+ float ratio() const { return _src_data.src_ratio; }
+ uint32_t channels() const { return source->channels(); }
+ framecnt_t length() const { return source->length(); }
+ framecnt_t samplerate() const { return source->samplerate(); }
+ void seek (framepos_t);
+ framepos_t natural_position() const;
+
+ bool clamped_at_unity () const {
+ /* resampling may generate inter-sample peaks with magnitude > 1 */
+ return false;
+ }
static const uint32_t blocksize;
private:
boost::shared_ptr<ImportableSource> source;
- float* input;
- SRC_STATE* src_state;
- SRC_DATA src_data;
+ float* _input;
+ int _src_type;
+ SRC_STATE* _src_state;
+ SRC_DATA _src_data;
+ bool _end_of_input;
};
}