/*
- Copyright (C) 2007 Paul Davis
+ Copyright (C) 2007 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <samplerate.h>
-#include <ardour/types.h>
-#include <ardour/importable_source.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>, samplecnt_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); }
-
+
+ samplecnt_t read (Sample* buffer, samplecnt_t nframes);
+ float ratio() const { return _src_data.src_ratio; }
+ uint32_t channels() const { return source->channels(); }
+ samplecnt_t length() const { return source->length(); }
+ samplecnt_t samplerate() const { return source->samplerate(); }
+ void seek (samplepos_t);
+ samplepos_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;
};
}