X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fsndfilesource.h;h=d146bb57938ed64c9bfd38f610392dea51a518df;hb=b5db1f624d347c8865c27fdae23bf4595be372d2;hp=5d11c9ef095e6be2599dd40abd88cca875205c63;hpb=a8f44b1556e68f4cf28bd52e6de7359581a1ec45;p=ardour.git diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index 5d11c9ef09..d146bb5793 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -23,29 +23,57 @@ #include -#include +#include namespace ARDOUR { -class SndFileSource : public ExternalSource { +class SndFileSource : public AudioFileSource { public: - SndFileSource (const string& path_plus_channel, bool build_peak = true); + /* constructor to be called for existing external-to-session files */ + + SndFileSource (std::string path, Flag flags); + + /* constructor to be called for new in-session files */ + + SndFileSource (std::string path, SampleFormat samp_format, HeaderFormat hdr_format, jack_nframes_t rate, + Flag flags = AudioFileSource::Flag (AudioFileSource::Writable| + AudioFileSource::Removable| + AudioFileSource::RemovableIfEmpty| + AudioFileSource::CanRename| + AudioFileSource::BuildPeaks)); + + /* constructor to be called for existing in-session files */ + SndFileSource (const XMLNode&); + ~SndFileSource (); - jack_nframes_t length() const { return _info.frames; } - jack_nframes_t read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, char * workbuf) const; float sample_rate () const; + int update_header (jack_nframes_t when, struct tm&, time_t); + int flush_header (); + + static Flag default_in_session_flags(); + + protected: + void set_header_timeline_position (); + + jack_nframes_t read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, char * workbuf) const; + jack_nframes_t write_unlocked (Sample *dst, jack_nframes_t cnt, char * workbuf); + + jack_nframes_t write_float (Sample* data, jack_nframes_t pos, jack_nframes_t cnt); private: SNDFILE *sf; SF_INFO _info; + SF_BROADCAST_INFO *_broadcast_info; - mutable float *tmpbuf; - mutable jack_nframes_t tmpbufsize; - mutable Glib::Mutex _tmpbuf_lock; + mutable float *interleave_buf; + mutable jack_nframes_t interleave_bufsize; - void init (const string &str, bool build_peak); + void init (const string &str); + int open(); + void close(); + int setup_broadcast_info (jack_nframes_t when, struct tm&, time_t); }; }; /* namespace ARDOUR */