ardour
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ARDOUR::SndFileSource Class Reference

#include <sndfilesource.h>

Inheritance diagram for ARDOUR::SndFileSource:
ARDOUR::AudioFileSource ARDOUR::AudioSource ARDOUR::FileSource ARDOUR::Source ARDOUR::Readable boost::enable_shared_from_this< ARDOUR::AudioSource > ARDOUR::Source ARDOUR::SessionObject ARDOUR::SessionObject ARDOUR::SessionHandleRef PBD::StatefulDestructible ARDOUR::SessionHandleRef PBD::StatefulDestructible PBD::ScopedConnectionList PBD::Stateful PBD::Destructible PBD::ScopedConnectionList PBD::Stateful PBD::Destructible

Public Member Functions

 SndFileSource (Session &, const std::string &path, int chn, Flag flags)
 
 SndFileSource (Session &, const std::string &path, const std::string &origin, SampleFormat samp_format, HeaderFormat hdr_format, framecnt_t rate, Flag flags=SndFileSource::default_writable_flags)
 
 SndFileSource (Session &, const std::string &path, int chn)
 
 SndFileSource (Session &, const XMLNode &)
 
 ~SndFileSource ()
 
float sample_rate () const
 
int update_header (framepos_t when, struct tm &, time_t)
 
int flush_header ()
 
void flush ()
 
framepos_t natural_position () const
 
framepos_t last_capture_start_frame () const
 
void mark_capture_start (framepos_t)
 
void mark_capture_end ()
 
void clear_capture_marks ()
 
bool set_destructive (bool yn)
 
bool one_of_several_channels () const
 
bool clamped_at_unity () const
 
- Public Member Functions inherited from ARDOUR::AudioFileSource
virtual ~AudioFileSource ()
 
std::string peak_path (std::string audio_path)
 
std::string find_broken_peakfile (std::string missing_peak_path, std::string audio_path)
 
bool safe_file_extension (const std::string &path) const
 
void mark_streaming_write_completed (const Lock &lock)
 
int setup_peakfile ()
 
XMLNodeget_state ()
 
int set_state (const XMLNode &, int version)
 
bool can_truncate_peaks () const
 
bool can_be_analysed () const
 
- Public Member Functions inherited from ARDOUR::AudioSource
 AudioSource (Session &, std::string name)
 
 AudioSource (Session &, const XMLNode &)
 
virtual ~AudioSource ()
 
framecnt_t readable_length () const
 
virtual uint32_t n_channels () const
 
virtual bool empty () const
 
framecnt_t length (framepos_t pos) const
 
void update_length (framecnt_t cnt)
 
virtual framecnt_t available_peaks (double zoom) const
 
virtual framecnt_t read (Sample *dst, framepos_t start, framecnt_t cnt, int channel=0) const
 
virtual framecnt_t write (Sample *src, framecnt_t cnt)
 
void set_captured_for (std::string str)
 
std::string captured_for () const
 
int read_peaks (PeakData *peaks, framecnt_t npeaks, framepos_t start, framecnt_t cnt, double samples_per_visual_peak) const
 
int build_peaks ()
 
bool peaks_ready (boost::function< void()> callWhenReady, PBD::ScopedConnection **connection_created_if_not_ready, PBD::EventLoop *event_loop) const
 
XMLNodeget_state ()
 
int set_state (const XMLNode &, int version)
 
int rename_peakfile (std::string newpath)
 
void touch_peakfile ()
 
int prepare_for_peakfile_writes ()
 
void done_with_peakfile_writes (bool done=true)
 
- Public Member Functions inherited from ARDOUR::Source
 Source (Session &, DataType type, const std::string &name, Flag flags=Flag(0))
 
 Source (Session &, const XMLNode &)
 
virtual ~Source ()
 
DataType type ()
 
time_t timestamp () const
 
void stamp (time_t when)
 
void mark_for_remove ()
 
virtual void mark_streaming_write_started (const Lock &lock)
 
virtual void session_saved ()
 
XMLNodeget_state ()
 
int set_state (const XMLNode &, int version)
 
bool destructive () const
 
bool writable () const
 
virtual bool length_mutable () const
 
bool has_been_analysed () const
 
virtual void set_been_analysed (bool yn)
 
virtual bool check_for_analysis_data_on_disk ()
 
std::string get_transients_path () const
 
int load_transients (const std::string &)
 
framepos_t timeline_position () const
 
void set_allow_remove_if_empty (bool yn)
 
Glib::Threads::Mutex & mutex ()
 
Flag flags () const
 
virtual void dec_use_count ()
 
int use_count () const
 
bool used () const
 
uint32_t level () const
 
std::string ancestor_name ()
 
void set_ancestor_name (const std::string &name)
 
- Public Member Functions inherited from ARDOUR::SessionObject
 SessionObject (Session &session, const std::string &name)
 
Sessionsession () const
 
std::string name () const
 
virtual bool set_name (const std::string &str)
 
- Public Member Functions inherited from ARDOUR::SessionHandleRef
 SessionHandleRef (ARDOUR::Session &s)
 
virtual ~SessionHandleRef ()
 
- Public Member Functions inherited from PBD::ScopedConnectionList
 ScopedConnectionList ()
 
virtual ~ScopedConnectionList ()
 
void add_connection (const UnscopedConnection &c)
 
void drop_connections ()
 
- Public Member Functions inherited from PBD::Stateful
 Stateful ()
 
virtual ~Stateful ()
 
virtual bool apply_changes (PropertyBase const &)
 
PropertyChange apply_changes (PropertyList const &)
 
const OwnedPropertyListproperties () const
 
void add_property (PropertyBase &s)
 
void add_extra_xml (XMLNode &)
 
XMLNodeextra_xml (const std::string &str, bool add_if_missing=false)
 
void save_extra_xml (const XMLNode &)
 
const PBD::IDid () const
 
bool set_id (const XMLNode &)
 
void set_id (const std::string &)
 
void reset_id ()
 
void clear_changes ()
 
virtual void clear_owned_changes ()
 
PropertyListget_changes_as_properties (Command *) const
 
virtual void rdiff (std::vector< Command * > &) const
 
bool changed () const
 
virtual PropertyListproperty_factory (const XMLNode &) const
 
virtual void suspend_property_changes ()
 
virtual void resume_property_changes ()
 
bool property_changes_suspended () const
 
- Public Member Functions inherited from PBD::Destructible
 Destructible ()
 
virtual ~Destructible ()
 
void drop_references ()
 
- Public Member Functions inherited from ARDOUR::Readable
 Readable ()
 
virtual ~Readable ()
 
- Public Member Functions inherited from ARDOUR::FileSource
virtual ~FileSource ()
 
const std::string & path () const
 
int move_to_trash (const std::string &trash_dir_name)
 
void mark_take (const std::string &id)
 
void mark_immutable ()
 
void mark_immutable_except_write ()
 
void mark_nonremovable ()
 
const std::string & take_id () const
 
bool within_session () const
 
uint16_t channel () const
 
int set_state (const XMLNode &, int version)
 
int set_source_name (const std::string &newname, bool destructive)
 
void inc_use_count ()
 
bool removable () const
 
bool is_stub () const
 
const std::string & origin () const
 
void existence_check ()
 
virtual void prevent_deletion ()
 
int rename (const std::string &name)
 

Static Public Member Functions

static void setup_standard_crossfades (Session const &, framecnt_t sample_rate)
 
static int get_soundfile_info (const std::string &path, SoundFileInfo &_info, std::string &error_msg)
 
- Static Public Member Functions inherited from ARDOUR::AudioFileSource
static void set_peak_dir (std::string dir)
 
static bool get_soundfile_info (std::string path, SoundFileInfo &_info, std::string &error)
 
static bool safe_audio_file_extension (const std::string &path)
 
static bool is_empty (Session &, std::string path)
 
static void set_bwf_serial_number (int)
 
static void set_header_position_offset (framecnt_t offset)
 
- Static Public Member Functions inherited from ARDOUR::AudioSource
static void set_build_missing_peakfiles (bool yn)
 
static void set_build_peakfiles (bool yn)
 
static bool get_build_peakfiles ()
 
static void allocate_working_buffers (framecnt_t framerate)
 
- Static Public Member Functions inherited from ARDOUR::SessionObject
static void make_property_quarks ()
 
- Static Public Member Functions inherited from ARDOUR::FileSource
static bool find (Session &, DataType type, const std::string &path, bool must_exist, bool &is_new, uint16_t &chan, std::string &found_path)
 
static bool find_2X (Session &, DataType type, const std::string &path, bool must_exist, bool &is_new, uint16_t &chan, std::string &found_path)
 

Static Public Attributes

static const Source::Flag default_writable_flags
 
- Static Public Attributes inherited from ARDOUR::AudioFileSource
static PBD::Signal0< void > HeaderPositionOffsetChanged
 
- Static Public Attributes inherited from ARDOUR::Source
static PBD::Signal1< void,
Source * > 
SourceCreated
 
- Static Public Attributes inherited from PBD::Stateful
static int current_state_version = 0
 
static int loading_state_version = 0
 
- Static Public Attributes inherited from ARDOUR::FileSource
static PBD::Signal2< int,
std::string, std::vector
< std::string > > 
AmbiguousFileName
 

Protected Member Functions

void close ()
 
void set_path (const std::string &p)
 
void set_header_timeline_position ()
 
framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const
 
framecnt_t write_unlocked (Sample *dst, framecnt_t cnt)
 
framecnt_t write_float (Sample *data, framepos_t pos, framecnt_t cnt)
 
- Protected Member Functions inherited from ARDOUR::AudioFileSource
 AudioFileSource (Session &, const std::string &path, Source::Flag flags)
 
 AudioFileSource (Session &, const std::string &path, const std::string &origin, Source::Flag flags, SampleFormat samp_format, HeaderFormat hdr_format)
 
 AudioFileSource (Session &, const XMLNode &, bool must_exist=true)
 
 AudioFileSource (Session &, const std::string &path, Source::Flag flags, bool)
 
int init (const std::string &idstr, bool must_exist)
 
int move_dependents_to_trash ()
 
- Protected Member Functions inherited from ARDOUR::AudioSource
int initialize_peakfile (std::string path)
 
int build_peaks_from_scratch ()
 
int compute_and_write_peaks (Sample *buf, framecnt_t first_frame, framecnt_t cnt, bool force, bool intermediate_peaks_ready_signal)
 
void truncate_peakfile ()
 
virtual int read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t start, framecnt_t cnt, double samples_per_visual_peak, framecnt_t fpp) const
 
int compute_and_write_peaks (Sample *buf, framecnt_t first_frame, framecnt_t cnt, bool force, bool intermediate_peaks_ready_signal, framecnt_t frames_per_peak)
 
- Protected Member Functions inherited from ARDOUR::SessionHandleRef
virtual void session_going_away ()
 
virtual void insanity_check ()
 
- Protected Member Functions inherited from PBD::Stateful
void add_instant_xml (XMLNode &, const std::string &directory_path)
 
XMLNodeinstant_xml (const std::string &str, const std::string &directory_path)
 
void add_properties (XMLNode &)
 
PropertyChange set_values (XMLNode const &)
 
virtual void post_set (const PropertyChange &)
 
virtual void send_change (const PropertyChange &)
 
virtual void mid_thaw (const PropertyChange &)
 
- Protected Member Functions inherited from ARDOUR::FileSource
 FileSource (Session &session, DataType type, const std::string &path, const std::string &origin, Source::Flag flags=Source::Flag(0))
 
 FileSource (Session &session, const XMLNode &node, bool must_exist)
 
void set_within_session_from_path (const std::string &)
 

Private Member Functions

void init_sndfile ()
 
int open ()
 
int setup_broadcast_info (framepos_t when, struct tm &, time_t)
 
void file_closed ()
 
framecnt_t crossfade (Sample *data, framecnt_t cnt, int dir)
 
void set_timeline_position (framepos_t)
 
framecnt_t destructive_write_unlocked (Sample *dst, framecnt_t cnt)
 
framecnt_t nondestructive_write_unlocked (Sample *dst, framecnt_t cnt)
 
void handle_header_position_change ()
 

Private Attributes

SNDFILE * _sndfile
 
SF_INFO _info
 
BroadcastInfo_broadcast_info
 
bool _capture_start
 
bool _capture_end
 
framepos_t capture_start_frame
 
framepos_t file_pos
 
Samplexfade_buf
 
PBD::ScopedConnection header_position_connection
 

Static Private Attributes

static framecnt_t xfade_frames = 64
 
static gain_tout_coefficient = 0
 
static gain_tin_coefficient = 0
 

Additional Inherited Members

- Public Types inherited from ARDOUR::Source
enum  Flag {
  Writable = 0x1, CanRename = 0x2, Broadcast = 0x4, Removable = 0x8,
  RemovableIfEmpty = 0x10, RemoveAtDestroy = 0x20, NoPeakFile = 0x40, Destructive = 0x80,
  Empty = 0x100
}
 
typedef Glib::Threads::Mutex::Lock Lock
 
- Public Attributes inherited from ARDOUR::AudioSource
PBD::Signal0< void > PeaksReady
 
PBD::Signal2< void, framepos_t,
framepos_t
PeakRangeReady
 
- Public Attributes inherited from ARDOUR::Source
PBD::Signal0< void > AnalysisChanged
 
AnalysisFeatureList transients
 
- Public Attributes inherited from PBD::Stateful
PBD::Signal1< void, const
PropertyChange & > 
PropertyChanged
 
- Public Attributes inherited from PBD::Destructible
PBD::Signal0< void > Destroyed
 
PBD::Signal0< void > DropReferences
 
- Static Protected Member Functions inherited from ARDOUR::AudioFileSource
static Sampleget_interleave_buffer (framecnt_t size)
 
- Static Protected Member Functions inherited from ARDOUR::AudioSource
static void ensure_buffers_for_level (uint32_t, framecnt_t)
 
static void ensure_buffers_for_level_locked (uint32_t, framecnt_t)
 
- Protected Attributes inherited from ARDOUR::AudioSource
framecnt_t _length
 
std::string peakpath
 
std::string _captured_for
 
off_t _peak_byte_max
 
- Protected Attributes inherited from ARDOUR::Source
DataType _type
 
Flag _flags
 
time_t _timestamp
 
framepos_t _timeline_position
 
bool _analysed
 
Glib::Threads::Mutex _lock
 
Glib::Threads::Mutex _analysis_lock
 
gint _use_count
 
uint32_t _level
 
std::string _ancestor_name
 
- Protected Attributes inherited from ARDOUR::SessionObject
PBD::Property< std::string > _name
 
- Protected Attributes inherited from ARDOUR::SessionHandleRef
ARDOUR::Session_session
 
- Protected Attributes inherited from PBD::Stateful
XMLNode_extra_xml
 
XMLNode_instant_xml
 
PBD::PropertyChange _pending_changed
 
Glib::Threads::Mutex _lock
 
std::string _xml_node_name
 name of node to use for this object in XML More...
 
OwnedPropertyList_properties
 
- Protected Attributes inherited from ARDOUR::FileSource
std::string _path
 
std::string _take_id
 
bool _file_is_new
 
uint16_t _channel
 
bool _within_session
 
std::string _origin
 
- Static Protected Attributes inherited from ARDOUR::AudioFileSource
static std::string peak_dir = ""
 
static char bwf_country_code [3]
 
static char bwf_organization_code [4]
 
static char bwf_serial_number [13] = "000000000000"
 
static framecnt_t header_position_offset = 0
 
- Static Protected Attributes inherited from ARDOUR::AudioSource
static bool _build_missing_peakfiles = false
 
static bool _build_peakfiles = false
 
static size_t _working_buffers_size = 0
 
static std::vector
< boost::shared_array< Sample > > 
_mixdown_buffers
 
static std::vector
< boost::shared_array< gain_t > > 
_gain_buffers
 
static Glib::Threads::Mutex _level_buffer_lock
 

Detailed Description

Definition at line 30 of file sndfilesource.h.

Constructor & Destructor Documentation

ARDOUR::SndFileSource::SndFileSource ( Session ,
const std::string &  path,
int  chn,
Flag  flags 
)

Constructor to be called for existing external-to-session files

ARDOUR::SndFileSource::SndFileSource ( Session ,
const std::string &  path,
const std::string &  origin,
SampleFormat  samp_format,
HeaderFormat  hdr_format,
framecnt_t  rate,
Flag  flags = SndFileSource::default_writable_flags 
)
ARDOUR::SndFileSource::SndFileSource ( Session ,
const std::string &  path,
int  chn 
)
SndFileSource::SndFileSource ( Session s,
const XMLNode node 
)

Constructor to be called for existing in-session files during session loading

Definition at line 58 of file sndfilesource.cc.

SndFileSource::~SndFileSource ( )

Definition at line 344 of file sndfilesource.cc.

Member Function Documentation

bool SndFileSource::clamped_at_unity ( ) const
virtual
Returns
true if the each source sample s must be clamped to -1 < s < 1

Implements ARDOUR::AudioSource.

Definition at line 960 of file sndfilesource.cc.

void SndFileSource::clear_capture_marks ( )
virtual

Reimplemented from ARDOUR::AudioFileSource.

Definition at line 713 of file sndfilesource.cc.

void SndFileSource::close ( )
protectedvirtual

Implements ARDOUR::FileSource.

Definition at line 234 of file sndfilesource.cc.

framecnt_t SndFileSource::crossfade ( Sample data,
framecnt_t  cnt,
int  dir 
)
private

Definition at line 742 of file sndfilesource.cc.

framecnt_t SndFileSource::destructive_write_unlocked ( Sample dst,
framecnt_t  cnt 
)
private

Definition at line 486 of file sndfilesource.cc.

void SndFileSource::file_closed ( )
private

Definition at line 969 of file sndfilesource.cc.

void SndFileSource::flush ( )
virtual

Implements ARDOUR::AudioFileSource.

Definition at line 607 of file sndfilesource.cc.

int SndFileSource::flush_header ( )
virtual

Implements ARDOUR::AudioFileSource.

Definition at line 589 of file sndfilesource.cc.

int SndFileSource::get_soundfile_info ( const std::string &  path,
SoundFileInfo _info,
std::string &  error_msg 
)
static

Definition at line 919 of file sndfilesource.cc.

void SndFileSource::handle_header_position_change ( )
privatevirtual

Reimplemented from ARDOUR::AudioFileSource.

Definition at line 875 of file sndfilesource.cc.

void SndFileSource::init_sndfile ( )
private

Definition at line 217 of file sndfilesource.cc.

framepos_t SndFileSource::last_capture_start_frame ( ) const
virtual

Reimplemented from ARDOUR::AudioFileSource.

Definition at line 865 of file sndfilesource.cc.

void SndFileSource::mark_capture_end ( )
virtual

Reimplemented from ARDOUR::AudioFileSource.

Definition at line 734 of file sndfilesource.cc.

void SndFileSource::mark_capture_start ( framepos_t  pos)
virtual
Parameters
posCapture start position in session frames

Reimplemented from ARDOUR::AudioFileSource.

Definition at line 721 of file sndfilesource.cc.

framepos_t SndFileSource::natural_position ( ) const
virtual

Reimplemented from ARDOUR::Source.

Definition at line 688 of file sndfilesource.cc.

framecnt_t SndFileSource::nondestructive_write_unlocked ( Sample dst,
framecnt_t  cnt 
)
private

Definition at line 457 of file sndfilesource.cc.

bool SndFileSource::one_of_several_channels ( ) const
virtual

Reimplemented from ARDOUR::AudioFileSource.

Definition at line 954 of file sndfilesource.cc.

int SndFileSource::open ( )
private

Definition at line 243 of file sndfilesource.cc.

framecnt_t SndFileSource::read_unlocked ( Sample dst,
framepos_t  start,
framecnt_t  cnt 
) const
protectedvirtual

Implements ARDOUR::AudioSource.

Definition at line 358 of file sndfilesource.cc.

float SndFileSource::sample_rate ( ) const
virtual

Implements ARDOUR::AudioSource.

Definition at line 352 of file sndfilesource.cc.

bool SndFileSource::set_destructive ( bool  yn)
virtual

Reimplemented from ARDOUR::Source.

Definition at line 694 of file sndfilesource.cc.

void SndFileSource::set_header_timeline_position ( )
protectedvirtual

Implements ARDOUR::AudioFileSource.

Definition at line 651 of file sndfilesource.cc.

void SndFileSource::set_path ( const std::string &  p)
protectedvirtual

Reimplemented from ARDOUR::FileSource.

Definition at line 981 of file sndfilesource.cc.

void SndFileSource::set_timeline_position ( framepos_t  pos)
privatevirtual

Reimplemented from ARDOUR::Source.

Definition at line 907 of file sndfilesource.cc.

int SndFileSource::setup_broadcast_info ( framepos_t  when,
struct tm &  now,
time_t   
)
private

Definition at line 624 of file sndfilesource.cc.

void SndFileSource::setup_standard_crossfades ( Session const &  s,
framecnt_t  sample_rate 
)
static

Definition at line 889 of file sndfilesource.cc.

int SndFileSource::update_header ( framepos_t  when,
struct tm &  now,
time_t  tnow 
)
virtual

Implements ARDOUR::AudioFileSource.

Definition at line 575 of file sndfilesource.cc.

framecnt_t SndFileSource::write_float ( Sample data,
framepos_t  pos,
framecnt_t  cnt 
)
protected

Definition at line 671 of file sndfilesource.cc.

framecnt_t SndFileSource::write_unlocked ( Sample dst,
framecnt_t  cnt 
)
protectedvirtual

Implements ARDOUR::AudioSource.

Definition at line 443 of file sndfilesource.cc.

Member Data Documentation

BroadcastInfo* ARDOUR::SndFileSource::_broadcast_info
private

Definition at line 90 of file sndfilesource.h.

bool ARDOUR::SndFileSource::_capture_end
private

Definition at line 104 of file sndfilesource.h.

bool ARDOUR::SndFileSource::_capture_start
private

Definition at line 103 of file sndfilesource.h.

SF_INFO ARDOUR::SndFileSource::_info
private

Definition at line 89 of file sndfilesource.h.

SNDFILE* ARDOUR::SndFileSource::_sndfile
private

Definition at line 88 of file sndfilesource.h.

framepos_t ARDOUR::SndFileSource::capture_start_frame
private

Definition at line 105 of file sndfilesource.h.

const Source::Flag SndFileSource::default_writable_flags
static
framepos_t ARDOUR::SndFileSource::file_pos
private

Definition at line 106 of file sndfilesource.h.

PBD::ScopedConnection ARDOUR::SndFileSource::header_position_connection
private

Definition at line 114 of file sndfilesource.h.

gain_t * SndFileSource::in_coefficient = 0
staticprivate

Definition at line 101 of file sndfilesource.h.

gain_t * SndFileSource::out_coefficient = 0
staticprivate

Definition at line 100 of file sndfilesource.h.

Sample* ARDOUR::SndFileSource::xfade_buf
private

Definition at line 107 of file sndfilesource.h.

framecnt_t SndFileSource::xfade_frames = 64
staticprivate

Definition at line 99 of file sndfilesource.h.


The documentation for this class was generated from the following files: