if (as->natural_position() != 0) {
pos = as->natural_position();
- cerr << "\tgot " << pos << " from source TC info\n";
} else if (target_tracks == 1) {
/* hmm, no timestamp available, put it after the previous region
*/
if (n == 0) {
pos = get_preferred_edit_position ();
- cerr << "\tno timestamp, first file, use edit pos = " << pos << endl;
} else {
pos += rlen;
- cerr << "\tpacked-sequence-shuffle to " << pos << endl;
}
} else {
pos = get_preferred_edit_position ();
- cerr << "\tmultitracks, using edit position = " << pos << endl;
}
}
}
if (dy && !_selection.empty() && !no_sound_notes && trackview.editor().sound_notes()) {
-
+
if (to_play.size() > 1) {
PossibleChord shifted;
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;
};
~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 */
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&);
};
{
const DataType type = SMFSource::safe_midi_file_extension (*i) ? DataType::MIDI : DataType::AUDIO;
-
source = SourceFactory::createWritable (type, sess,
i->c_str(),
false, // destructive
src_data.end_of_input = 0;
}
+framepos_t
+ResampledImportableSource::natural_position () const
+{
+ return source->natural_position() * ratio ();
+}
return sf_info.channels;
}
-nframes_t
+framecnt_t
SndFileImportableSource::length () const
{
- return sf_info.frames;
+ return (framecnt_t) sf_info.frames;
}
nframes_t
sf_seek (in.get(), 0, SEEK_SET);
}
-nframes64_t
+framepos_t
SndFileImportableSource::natural_position () const
{
- return timecode;
+ return (framepos_t) timecode;
}
bool