don't always rebuild peakfiles for compound regions

git-svn-id: svn://localhost/ardour2/branches/3.0@9627 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-05-29 14:38:25 +00:00
parent c3821a7816
commit 489d2ba1a7
6 changed files with 18 additions and 20 deletions

View file

@ -32,7 +32,7 @@ namespace ARDOUR {
class AudioPlaylist;
class AudioPlaylistSource : public AudioSource, public PlaylistSource {
class AudioPlaylistSource : public PlaylistSource, public AudioSource {
public:
virtual ~AudioPlaylistSource ();
@ -59,6 +59,7 @@ class AudioPlaylistSource : public AudioSource, public PlaylistSource {
AudioPlaylistSource (Session&, const PBD::ID& orig, const std::string& name, boost::shared_ptr<AudioPlaylist>, uint32_t chn,
frameoffset_t begin, framecnt_t len, Source::Flag flags);
AudioPlaylistSource (Session&, const XMLNode&);
private:
uint32_t _playlist_channel;

View file

@ -50,8 +50,6 @@ class MidiPlaylistSource : public MidiSource, public PlaylistSource {
void load_model(bool lock=true, bool force_reload=false);
void destroy_model();
static void ensure_buffers_for_level (uint32_t);
protected:
friend class SourceFactory;
@ -70,6 +68,7 @@ class MidiPlaylistSource : public MidiSource, public PlaylistSource {
framepos_t write_unlocked (MidiRingBuffer<framepos_t>& dst,
framepos_t position,
framecnt_t cnt);
private:
int set_state (const XMLNode&, int version, bool with_descendants);
framecnt_t _length;

View file

@ -50,7 +50,6 @@ class PlaylistSource : virtual public Source {
PlaylistSource (Session&, const XMLNode&);
void add_state (XMLNode&);
};
} /* namespace */

View file

@ -49,8 +49,8 @@ using namespace PBD;
AudioPlaylistSource::AudioPlaylistSource (Session& s, const ID& orig, const std::string& name, boost::shared_ptr<AudioPlaylist> p,
uint32_t chn, frameoffset_t begin, framecnt_t len, Source::Flag flags)
: Source (s, DataType::AUDIO, name)
, AudioSource (s, name)
, PlaylistSource (s, orig, name, p, DataType::AUDIO, begin, len, flags)
, AudioSource (s, name)
, _playlist_channel (chn)
{
AudioSource::_length = len;
@ -59,8 +59,8 @@ AudioPlaylistSource::AudioPlaylistSource (Session& s, const ID& orig, const std:
AudioPlaylistSource::AudioPlaylistSource (Session& s, const XMLNode& node)
: Source (s, node)
, AudioSource (s, node)
, PlaylistSource (s, node)
, AudioSource (s, node)
{
/* PlaylistSources are never writable, renameable, removable or destructive */
_flags = Flag (_flags & ~(Writable|CanRename|Removable|RemovableIfEmpty|RemoveAtDestroy|Destructive));
@ -93,7 +93,6 @@ AudioPlaylistSource::get_state ()
return node;
}
int
AudioPlaylistSource::set_state (const XMLNode& node, int version)
@ -106,8 +105,8 @@ AudioPlaylistSource::set_state (const XMLNode& node, int version, bool with_desc
{
if (with_descendants) {
if (Source::set_state (node, version) ||
AudioSource::set_state (node, version) ||
PlaylistSource::set_state (node, version)) {
PlaylistSource::set_state (node, version) ||
AudioSource::set_state (node, version)) {
return -1;
}
}
@ -226,3 +225,4 @@ AudioPlaylistSource::peak_path (string /*audio_path_IGNORED*/)
return _peak_path;
}

View file

@ -252,8 +252,14 @@ AudioSource::initialize_peakfile (bool newfile, string audio_path)
int err = stat (audio_path.c_str(), &stat_file);
if (err) {
_peaks_built = false;
_peak_byte_max = 0;
/* no audio path - nested source or we can't
read it or ... whatever, use the peakfile as-is.
*/
_peaks_built = true;
_peak_byte_max = statbuf.st_size;
} else {
/* allow 6 seconds slop on checking peak vs. file times because of various
@ -996,6 +1002,8 @@ AudioSource::ensure_buffers_for_level_locked (uint32_t level, framecnt_t frame_r
_mixdown_buffers.clear ();
_gain_buffers.clear ();
cerr << "Allocating nested buffers for level " << level << endl;
while (_mixdown_buffers.size() < level) {
_mixdown_buffers.push_back (boost::shared_ptr<Sample> (new Sample[nframes]));
_gain_buffers.push_back (boost::shared_ptr<gain_t> (new gain_t[nframes]));

View file

@ -52,7 +52,6 @@ MidiPlaylistSource::MidiPlaylistSource (Session& s, const ID& orig, const std::s
, MidiSource (s, name, flags)
, PlaylistSource (s, orig, name, p, DataType::AUDIO, begin, len, flags)
{
ensure_buffers_for_level (_level);
}
MidiPlaylistSource::MidiPlaylistSource (Session& s, const XMLNode& node)
@ -106,8 +105,6 @@ MidiPlaylistSource::set_state (const XMLNode& node, int version, bool with_desce
}
}
ensure_buffers_for_level (_level);
return 0;
}
@ -183,9 +180,3 @@ MidiPlaylistSource::empty () const
return !_playlist || _playlist->empty();
}
void
MidiPlaylistSource::ensure_buffers_for_level (uint32_t level)
{
}