diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-02-05 22:57:38 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-02-05 22:57:38 +0000 |
commit | 672a31a552ae0bd67d40a0c078306d3a63a44746 (patch) | |
tree | 25260fcee20b92a67a1eed34f7d00f55d6b4c56c /libs/ardour/ardour/silentfilesource.h | |
parent | 87ee8fd71fccd28632d7201a6778803015110d6a (diff) |
use SilentFileSource when sources cannot be found
git-svn-id: svn://localhost/ardour2/trunk@1424 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour/silentfilesource.h')
-rw-r--r-- | libs/ardour/ardour/silentfilesource.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/libs/ardour/ardour/silentfilesource.h b/libs/ardour/ardour/silentfilesource.h new file mode 100644 index 0000000000..92ef076a9b --- /dev/null +++ b/libs/ardour/ardour/silentfilesource.h @@ -0,0 +1,66 @@ +/* + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __ardour_silentfilesource_h__ +#define __ardour_silentfilesource_h__ + +#include <ardour/audiofilesource.h> + +namespace ARDOUR { + +class SilentFileSource : public AudioFileSource { + public: + virtual ~SilentFileSource (); + + int update_header (nframes_t when, struct tm&, time_t) { return 0; } + int flush_header () { return 0; } + float sample_rate () const { return _sample_rate; } + + void set_length (nframes_t len); + + int read_peaks (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt, double samples_per_unit) const { + memset (peaks, 0, sizeof (PeakData) * npeaks); + return 0; + } + + bool destructive() const { return false; } + + protected: + + float _sample_rate; + + SilentFileSource (Session&, const XMLNode&, nframes_t nframes, float sample_rate); + + friend class SourceFactory; + + nframes_t read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const { + memset (dst, 0, sizeof (Sample) * cnt); + return cnt; + } + + nframes_t write_unlocked (Sample *dst, nframes_t cnt) { return 0; } + + void set_header_timeline_position () {} + +}; + +} // namespace ARDOUR + +#endif /* __ardour_audiofilesource_h__ */ + |