Ardour  9.0-pre0-582-g084a23a80d
ARDOUR::SndFileSource Class Reference

#include <sndfilesource.h>

Inheritance diagram for ARDOUR::SndFileSource:
[legend]

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, samplecnt_t rate, Flag flags=SndFileSource::default_writable_flags)
 
 SndFileSource (Session &, const std::string &path, int chn)
 
 SndFileSource (Session &, const XMLNode &)
 
 SndFileSource (Session &s, const AudioFileSource &other, const std::string &path, bool use16bits=false, PBD::Progress *p=NULL)
 
 ~SndFileSource ()
 
float sample_rate () const
 
int update_header (samplepos_t when, struct tm &, time_t)
 
int flush_header ()
 
void flush ()
 
bool one_of_several_channels () const
 
uint32_t channel_count () const
 
bool clamped_at_unity () const
 
- Public Member Functions inherited from ARDOUR::AudioFileSource
virtual ~AudioFileSource ()
 
std::string construct_peak_filepath (const std::string &audio_path, const bool in_session=false, const bool old_peak_name=false) const
 
bool safe_file_extension (const std::string &path) const
 
virtual samplepos_t last_capture_start_sample () const
 
virtual void mark_capture_start (samplepos_t)
 
virtual void mark_capture_end ()
 
virtual void clear_capture_marks ()
 
void mark_streaming_write_completed (const WriterLock &lock, Temporal::timecnt_t const &duration)
 
int setup_peakfile ()
 
void set_gain (float g, bool temporarily=false)
 
XMLNodeget_state () const
 
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 &, const std::string &name)
 
 AudioSource (Session &, const XMLNode &)
 
virtual ~AudioSource ()
 
samplecnt_t readable_length_samples () const
 
virtual uint32_t n_channels () const
 
void update_length (timepos_t const &dur)
 
virtual samplecnt_t available_peaks (double zoom) const
 
virtual samplecnt_t read (Sample *dst, samplepos_t start, samplecnt_t cnt, int channel=0) const
 
virtual samplecnt_t write (Sample const *src, samplecnt_t cnt)
 
int read_peaks (PeakData *peaks, samplecnt_t npeaks, samplepos_t start, samplecnt_t cnt, double samples_per_visual_peak) const
 
int build_peaks ()
 
bool peaks_ready (std::function< void()> callWhenReady, PBD::ScopedConnection **connection_created_if_not_ready, PBD::EventLoop *event_loop) const
 
XMLNodeget_state () const
 
int set_state (const XMLNode &, int version)
 
int rename_peakfile (std::string newpath)
 
void touch_peakfile ()
 
int close_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)
 
virtual timepos_t length () const
 
virtual bool empty () const
 
void set_take_id (std::string id)
 
const std::string & take_id () const
 
void mark_for_remove ()
 
virtual void mark_streaming_write_started (const WriterLock &lock)
 
virtual void session_saved ()
 
XMLNodeget_state () const
 
int set_state (XMLNode const &, int version)
 
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 &)
 
size_t n_captured_xruns () const
 
XrunPositions const & captured_xruns () const
 
void set_captured_xruns (XrunPositions const &xruns)
 
void set_captured_marks (CueMarkers const &marks)
 
CueMarkers const & cue_markers () const
 
bool add_cue_marker (CueMarker const &)
 
bool move_cue_marker (CueMarker const &, timepos_t const &source_relative_position)
 
bool remove_cue_marker (CueMarker const &)
 
bool rename_cue_marker (CueMarker &, std::string const &)
 
bool clear_cue_markers ()
 
virtual timepos_t natural_position () const
 
bool have_natural_position () const
 
timecnt_t time_since_capture_start (timepos_t const &pos)
 
void set_allow_remove_if_empty (bool yn)
 
Glib::Threads::RWLock & mutex ()
 
Flag flags () const
 
virtual void inc_use_count ()
 
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)
 
void set_captured_for (std::string str)
 
std::string captured_for () const
 
bool get_segment_descriptor (TimelineRange const &, SegmentDescriptor &)
 
int set_segment_descriptor (SegmentDescriptor const &)
 
- 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 ()
 
 ScopedConnectionList (const ScopedConnectionList &)=delete
 
ScopedConnectionListoperator= (const ScopedConnectionList &)=delete
 
virtual ~ScopedConnectionList ()
 
void add_connection (const UnscopedConnection &c)
 
void drop_connections ()
 
- Public Member Functions inherited from PBD::Stateful
 Stateful ()
 
virtual ~Stateful ()
 
virtual bool apply_change (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 (PBD::Command *) const
 
virtual void rdiff (std::vector< PBD::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
virtual ~Destructible ()
 
virtual void drop_references ()
 
- Public Member Functions inherited from ARDOUR::AudioReadable
virtual ~AudioReadable ()
 
- 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 ()
 
bool within_session () const
 
uint16_t channel () const
 
float gain () const
 
virtual void set_channel (uint16_t c)
 
int set_state (const XMLNode &, int version)
 
int set_source_name (const std::string &newname)
 
bool removable () const
 
bool is_stub () const
 
const std::string & origin () const
 
void set_origin (std::string const &o)
 
void replace_file (const std::string &)
 
void existence_check ()
 
virtual void prevent_deletion ()
 
int rename (const std::string &name)
 

Static Public Member Functions

static int get_soundfile_info (const std::string &path, SoundFileInfo &_info, std::string &error_msg)
 
- Static Public Member Functions inherited from ARDOUR::AudioFileSource
static bool get_soundfile_info (const 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 (samplecnt_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 Public Member Functions inherited from ARDOUR::SessionObject
static void make_property_quarks ()
 
- Static Public Member Functions inherited from ARDOUR::AudioReadable
static std::vector< std::shared_ptr< AudioReadable > > load (Session &, std::string const &)
 
- 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::Signal< void()> HeaderPositionOffsetChanged
 
- Static Public Attributes inherited from ARDOUR::Source
static PBD::Signal< void(Source *)> SourceCreated
 
- Static Public Attributes inherited from PBD::Stateful
static int current_state_version
 
static int loading_state_version
 
- Static Public Attributes inherited from ARDOUR::FileSource
static PBD::Signal< int(std::string, std::vector< std::string >)> AmbiguousFileName
 

Protected Member Functions

void close ()
 
void set_path (const std::string &p)
 
void set_header_natural_position ()
 
samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const
 
samplecnt_t write_unlocked (Sample const *dst, samplecnt_t cnt)
 
samplecnt_t write_float (Sample const *data, samplepos_t pos, samplecnt_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)
 
virtual void handle_header_position_change ()
 
int move_dependents_to_trash ()
 
- Protected Member Functions inherited from ARDOUR::AudioSource
int initialize_peakfile (const std::string &path, const bool in_session=false)
 
int build_peaks_from_scratch ()
 
int compute_and_write_peaks (Sample const *buf, samplecnt_t first_sample, samplecnt_t cnt, bool force, bool intermediate_peaks_ready_signal)
 
void truncate_peakfile ()
 
virtual int read_peaks_with_fpp (PeakData *peaks, samplecnt_t npeaks, samplepos_t start, samplecnt_t cnt, double samples_per_visual_peak, samplecnt_t fpp) const
 
int compute_and_write_peaks (Sample const *buf, samplecnt_t first_sample, samplecnt_t cnt, bool force, bool intermediate_peaks_ready_signal, samplecnt_t samples_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 &) const
 
PropertyChange set_values (XMLNode const &)
 
virtual void post_set (const PropertyChange &)
 
virtual void send_change (const PropertyChange &)
 
virtual void mid_thaw (const PropertyChange &)
 
bool regenerate_xml_or_string_ids () const
 
- 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 (samplepos_t when, struct tm &, time_t)
 
void file_closed ()
 
void set_natural_position (timepos_t const &)
 
samplecnt_t nondestructive_write_unlocked (Sample const *src, samplecnt_t cnt)
 

Private Attributes

SNDFILE * _sndfile
 
SF_INFO _info
 
BroadcastInfo_broadcast_info
 
PBD::ScopedConnection header_position_connection
 

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 , RF64_RIFF = 0x200 , Missing = 0x400
}
 
typedef Glib::Threads::RWLock::ReaderLock ReaderLock
 
typedef Glib::Threads::RWLock::WriterLock WriterLock
 
- Public Attributes inherited from ARDOUR::AudioSource
PBD::Signal< void()> PeaksReady
 
PBD::Signal< void(samplepos_t, samplepos_t)> PeakRangeReady
 
- Public Attributes inherited from ARDOUR::Source
PBD::Signal< void()> AnalysisChanged
 
AnalysisFeatureList transients
 
PBD::Signal< void()> CueMarkersChanged
 
- Public Attributes inherited from PBD::Stateful
PBD::Signal< void(const PropertyChange &)> PropertyChanged
 
- Public Attributes inherited from PBD::Destructible
PBD::Signal< void()> Destroyed
 
PBD::Signal< void()> DropReferences
 
- Protected Types inherited from ARDOUR::Source
typedef std::vector< SegmentDescriptorSegmentDescriptors
 
- Static Protected Member Functions inherited from ARDOUR::AudioFileSource
static Sampleget_interleave_buffer (samplecnt_t size)
 
- Protected Attributes inherited from ARDOUR::AudioSource
std::string _peakpath
 
off_t _peak_byte_max
 
- Protected Attributes inherited from ARDOUR::Source
DataType _type
 
Flag _flags
 
time_t _timestamp
 
std::string _take_id
 
timepos_t _natural_position
 
bool _have_natural_position
 
bool _analysed
 
std::atomic< int > _use_count
 
uint32_t _level
 
std::string _ancestor_name
 
std::string _captured_for
 
timepos_t _length
 
XrunPositions _xruns
 
CueMarkers _cue_markers
 
SegmentDescriptors segment_descriptors
 
Glib::Threads::RWLock _lock
 
Glib::Threads::Mutex _analysis_lock
 
- 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
 
bool _file_is_new
 
uint16_t _channel
 
bool _within_session
 
std::string _origin
 
float _gain
 
- Static Protected Attributes inherited from ARDOUR::AudioFileSource
static char bwf_country_code [3]
 
static char bwf_organization_code [4]
 
static char bwf_serial_number [13]
 
static samplecnt_t header_position_offset
 
- Static Protected Attributes inherited from ARDOUR::AudioSource
static bool _build_missing_peakfiles
 
static bool _build_peakfiles
 
static std::vector< std::shared_ptr< Sample[]> > _mixdown_buffers
 
static std::vector< std::shared_ptr< gain_t[]> > _gain_buffers
 
static Glib::Threads::Mutex _level_buffer_lock
 

Detailed Description

Definition at line 38 of file sndfilesource.h.

Constructor & Destructor Documentation

◆ SndFileSource() [1/5]

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

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

◆ SndFileSource() [2/5]

ARDOUR::SndFileSource::SndFileSource ( Session ,
const std::string &  path,
const std::string &  origin,
SampleFormat  samp_format,
HeaderFormat  hdr_format,
samplecnt_t  rate,
Flag  flags = SndFileSource::default_writable_flags 
)

◆ SndFileSource() [3/5]

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

◆ SndFileSource() [4/5]

ARDOUR::SndFileSource::SndFileSource ( Session ,
const XMLNode  
)

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

◆ SndFileSource() [5/5]

ARDOUR::SndFileSource::SndFileSource ( Session s,
const AudioFileSource other,
const std::string &  path,
bool  use16bits = false,
PBD::Progress p = NULL 
)

Constructor to losslessly compress existing source

◆ ~SndFileSource()

ARDOUR::SndFileSource::~SndFileSource ( )

Member Function Documentation

◆ channel_count()

uint32_t ARDOUR::SndFileSource::channel_count ( ) const
inline

Definition at line 71 of file sndfilesource.h.

◆ clamped_at_unity()

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

Implements ARDOUR::AudioSource.

◆ close()

void ARDOUR::SndFileSource::close ( )
protectedvirtual

Implements ARDOUR::FileSource.

◆ file_closed()

void ARDOUR::SndFileSource::file_closed ( )
private

◆ flush()

void ARDOUR::SndFileSource::flush ( )
virtual

◆ flush_header()

int ARDOUR::SndFileSource::flush_header ( )
virtual

◆ get_soundfile_info()

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

◆ init_sndfile()

void ARDOUR::SndFileSource::init_sndfile ( )
private

◆ nondestructive_write_unlocked()

samplecnt_t ARDOUR::SndFileSource::nondestructive_write_unlocked ( Sample const *  src,
samplecnt_t  cnt 
)
private

◆ one_of_several_channels()

bool ARDOUR::SndFileSource::one_of_several_channels ( ) const
virtual

Reimplemented from ARDOUR::AudioFileSource.

◆ open()

int ARDOUR::SndFileSource::open ( )
private

◆ read_unlocked()

samplecnt_t ARDOUR::SndFileSource::read_unlocked ( Sample dst,
samplepos_t  start,
samplecnt_t  cnt 
) const
protectedvirtual

Implements ARDOUR::AudioSource.

◆ sample_rate()

float ARDOUR::SndFileSource::sample_rate ( ) const
virtual

Implements ARDOUR::AudioSource.

◆ set_header_natural_position()

void ARDOUR::SndFileSource::set_header_natural_position ( )
protectedvirtual

◆ set_natural_position()

void ARDOUR::SndFileSource::set_natural_position ( timepos_t const &  )
privatevirtual

Reimplemented from ARDOUR::Source.

◆ set_path()

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

Reimplemented from ARDOUR::FileSource.

◆ setup_broadcast_info()

int ARDOUR::SndFileSource::setup_broadcast_info ( samplepos_t  when,
struct tm &  ,
time_t   
)
private

◆ update_header()

int ARDOUR::SndFileSource::update_header ( samplepos_t  when,
struct tm &  ,
time_t   
)
virtual

◆ write_float()

samplecnt_t ARDOUR::SndFileSource::write_float ( Sample const *  data,
samplepos_t  pos,
samplecnt_t  cnt 
)
protected

◆ write_unlocked()

samplecnt_t ARDOUR::SndFileSource::write_unlocked ( Sample const *  dst,
samplecnt_t  cnt 
)
protectedvirtual

Implements ARDOUR::AudioSource.

Member Data Documentation

◆ _broadcast_info

BroadcastInfo* ARDOUR::SndFileSource::_broadcast_info
private

Definition at line 92 of file sndfilesource.h.

◆ _info

SF_INFO ARDOUR::SndFileSource::_info
private

Definition at line 91 of file sndfilesource.h.

◆ _sndfile

SNDFILE* ARDOUR::SndFileSource::_sndfile
private

Definition at line 90 of file sndfilesource.h.

◆ default_writable_flags

const Source::Flag ARDOUR::SndFileSource::default_writable_flags
static

Definition at line 75 of file sndfilesource.h.

◆ header_position_connection

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

Definition at line 101 of file sndfilesource.h.


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