Ardour  9.0-pre0-582-g084a23a80d
ARDOUR::AudioSource Class Referenceabstract

#include <audiosource.h>

Inheritance diagram for ARDOUR::AudioSource:
[legend]

Public Member Functions

 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)
 
virtual float sample_rate () const =0
 
virtual void mark_streaming_write_completed (const WriterLock &lock, Temporal::timecnt_t const &duration)
 
virtual bool can_truncate_peaks () const
 
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 ()
 
virtual int setup_peakfile ()
 
int close_peakfile ()
 
int prepare_for_peakfile_writes ()
 
void done_with_peakfile_writes (bool done=true)
 
virtual bool clamped_at_unity () const =0
 
- 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 bool can_be_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
 
virtual void set_natural_position (timepos_t const &pos)
 
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 ()
 

Static Public Member Functions

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 &)
 

Public Attributes

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 Member Functions

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 samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const =0
 
virtual samplecnt_t write_unlocked (Sample const *dst, samplecnt_t cnt)=0
 
virtual std::string construct_peak_filepath (const std::string &audio_path, const bool in_session=false, const bool old_peak_name=false) const =0
 
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 Attributes

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
 

Static Protected Attributes

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
 

Private Attributes

bool _peaks_built
 
Glib::Threads::Mutex _peaks_ready_lock
 
Glib::Threads::Mutex _initialize_peaks_lock
 
int _peakfile_fd
 
samplecnt_t peak_leftover_cnt
 
samplecnt_t peak_leftover_size
 
Samplepeak_leftovers
 
samplepos_t peak_leftover_sample
 
bool _first_run
 
double _last_scale
 
off_t _last_map_off
 
size_t _last_raw_map_length
 
std::unique_ptr< PeakData[]> peak_cache
 

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
 
- 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
 
- Protected Types inherited from ARDOUR::Source
typedef std::vector< SegmentDescriptorSegmentDescriptors
 

Detailed Description

Definition at line 39 of file audiosource.h.

Constructor & Destructor Documentation

◆ AudioSource() [1/2]

ARDOUR::AudioSource::AudioSource ( Session ,
const std::string &  name 
)

◆ AudioSource() [2/2]

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

◆ ~AudioSource()

virtual ARDOUR::AudioSource::~AudioSource ( )
virtual

Member Function Documentation

◆ available_peaks()

virtual samplecnt_t ARDOUR::AudioSource::available_peaks ( double  zoom) const
virtual

◆ build_peaks()

int ARDOUR::AudioSource::build_peaks ( )

◆ build_peaks_from_scratch()

int ARDOUR::AudioSource::build_peaks_from_scratch ( )
protected

◆ can_truncate_peaks()

virtual bool ARDOUR::AudioSource::can_truncate_peaks ( ) const
inlinevirtual

Reimplemented in ARDOUR::AudioFileSource, and ARDOUR::AudioPlaylistSource.

Definition at line 60 of file audiosource.h.

◆ clamped_at_unity()

virtual bool ARDOUR::AudioSource::clamped_at_unity ( ) const
pure virtual

◆ close_peakfile()

int ARDOUR::AudioSource::close_peakfile ( )

◆ compute_and_write_peaks() [1/2]

int ARDOUR::AudioSource::compute_and_write_peaks ( Sample const *  buf,
samplecnt_t  first_sample,
samplecnt_t  cnt,
bool  force,
bool  intermediate_peaks_ready_signal 
)
protected

◆ compute_and_write_peaks() [2/2]

int ARDOUR::AudioSource::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

◆ construct_peak_filepath()

virtual std::string ARDOUR::AudioSource::construct_peak_filepath ( const std::string &  audio_path,
const bool  in_session = false,
const bool  old_peak_name = false 
) const
protectedpure virtual

◆ done_with_peakfile_writes()

void ARDOUR::AudioSource::done_with_peakfile_writes ( bool  done = true)

◆ get_build_peakfiles()

static bool ARDOUR::AudioSource::get_build_peakfiles ( )
inlinestatic

Definition at line 85 of file audiosource.h.

◆ get_state()

XMLNode& ARDOUR::AudioSource::get_state ( ) const
virtual

Implements PBD::Stateful.

◆ initialize_peakfile()

int ARDOUR::AudioSource::initialize_peakfile ( const std::string &  path,
const bool  in_session = false 
)
protected

◆ mark_streaming_write_completed()

virtual void ARDOUR::AudioSource::mark_streaming_write_completed ( const WriterLock lock,
Temporal::timecnt_t const &  duration 
)
virtual

Implements ARDOUR::Source.

Reimplemented in ARDOUR::AudioFileSource.

◆ n_channels()

virtual uint32_t ARDOUR::AudioSource::n_channels ( ) const
inlinevirtual

Implements ARDOUR::AudioReadable.

Reimplemented in ARDOUR::AudioPlaylistSource.

Definition at line 47 of file audiosource.h.

◆ peaks_ready()

bool ARDOUR::AudioSource::peaks_ready ( std::function< void()>  callWhenReady,
PBD::ScopedConnection **  connection_created_if_not_ready,
PBD::EventLoop event_loop 
) const

◆ prepare_for_peakfile_writes()

int ARDOUR::AudioSource::prepare_for_peakfile_writes ( )

◆ read()

virtual samplecnt_t ARDOUR::AudioSource::read ( Sample dst,
samplepos_t  start,
samplecnt_t  cnt,
int  channel = 0 
) const
virtual

Implements ARDOUR::AudioReadable.

◆ read_peaks()

int ARDOUR::AudioSource::read_peaks ( PeakData peaks,
samplecnt_t  npeaks,
samplepos_t  start,
samplecnt_t  cnt,
double  samples_per_visual_peak 
) const

◆ read_peaks_with_fpp()

virtual int ARDOUR::AudioSource::read_peaks_with_fpp ( PeakData peaks,
samplecnt_t  npeaks,
samplepos_t  start,
samplecnt_t  cnt,
double  samples_per_visual_peak,
samplecnt_t  fpp 
) const
protectedvirtual

◆ read_unlocked()

virtual samplecnt_t ARDOUR::AudioSource::read_unlocked ( Sample dst,
samplepos_t  start,
samplecnt_t  cnt 
) const
protectedpure virtual

◆ readable_length_samples()

samplecnt_t ARDOUR::AudioSource::readable_length_samples ( ) const
inlinevirtual

Implements ARDOUR::AudioReadable.

Reimplemented in ARDOUR::SrcFileSource.

Definition at line 46 of file audiosource.h.

◆ rename_peakfile()

int ARDOUR::AudioSource::rename_peakfile ( std::string  newpath)

◆ sample_rate()

◆ set_build_missing_peakfiles()

static void ARDOUR::AudioSource::set_build_missing_peakfiles ( bool  yn)
inlinestatic

Definition at line 77 of file audiosource.h.

◆ set_build_peakfiles()

static void ARDOUR::AudioSource::set_build_peakfiles ( bool  yn)
inlinestatic

Definition at line 81 of file audiosource.h.

◆ set_state()

int ARDOUR::AudioSource::set_state ( const XMLNode ,
int  version 
)
virtual

Implements PBD::Stateful.

◆ setup_peakfile()

virtual int ARDOUR::AudioSource::setup_peakfile ( )
inlinevirtual

Reimplemented in ARDOUR::AudioFileSource, and ARDOUR::AudioPlaylistSource.

Definition at line 89 of file audiosource.h.

◆ touch_peakfile()

void ARDOUR::AudioSource::touch_peakfile ( )

◆ truncate_peakfile()

void ARDOUR::AudioSource::truncate_peakfile ( )
protected

◆ update_length()

void ARDOUR::AudioSource::update_length ( timepos_t const &  dur)
virtual

Reimplemented from ARDOUR::Source.

◆ write()

virtual samplecnt_t ARDOUR::AudioSource::write ( Sample const *  src,
samplecnt_t  cnt 
)
virtual

◆ write_unlocked()

virtual samplecnt_t ARDOUR::AudioSource::write_unlocked ( Sample const *  dst,
samplecnt_t  cnt 
)
protectedpure virtual

Member Data Documentation

◆ _build_missing_peakfiles

bool ARDOUR::AudioSource::_build_missing_peakfiles
staticprotected

Definition at line 99 of file audiosource.h.

◆ _build_peakfiles

bool ARDOUR::AudioSource::_build_peakfiles
staticprotected

Definition at line 100 of file audiosource.h.

◆ _first_run

bool ARDOUR::AudioSource::_first_run
mutableprivate

Definition at line 151 of file audiosource.h.

◆ _gain_buffers

std::vector<std::shared_ptr<gain_t[]> > ARDOUR::AudioSource::_gain_buffers
staticprotected

Definition at line 109 of file audiosource.h.

◆ _initialize_peaks_lock

Glib::Threads::Mutex ARDOUR::AudioSource::_initialize_peaks_lock
private

Definition at line 143 of file audiosource.h.

◆ _last_map_off

off_t ARDOUR::AudioSource::_last_map_off
mutableprivate

Definition at line 153 of file audiosource.h.

◆ _last_raw_map_length

size_t ARDOUR::AudioSource::_last_raw_map_length
mutableprivate

Definition at line 154 of file audiosource.h.

◆ _last_scale

double ARDOUR::AudioSource::_last_scale
mutableprivate

Definition at line 152 of file audiosource.h.

◆ _level_buffer_lock

Glib::Threads::Mutex ARDOUR::AudioSource::_level_buffer_lock
staticprotected

Definition at line 110 of file audiosource.h.

◆ _mixdown_buffers

std::vector<std::shared_ptr<Sample[]> > ARDOUR::AudioSource::_mixdown_buffers
staticprotected

Definition at line 108 of file audiosource.h.

◆ _peak_byte_max

off_t ARDOUR::AudioSource::_peak_byte_max
mutableprotected

Definition at line 120 of file audiosource.h.

◆ _peakfile_fd

int ARDOUR::AudioSource::_peakfile_fd
private

Definition at line 145 of file audiosource.h.

◆ _peakpath

std::string ARDOUR::AudioSource::_peakpath
protected

Definition at line 112 of file audiosource.h.

◆ _peaks_built

bool ARDOUR::AudioSource::_peaks_built
private

Definition at line 135 of file audiosource.h.

◆ _peaks_ready_lock

Glib::Threads::Mutex ARDOUR::AudioSource::_peaks_ready_lock
mutableprivate

This mutex is used to protect both the _peaks_built variable and also the emission (and handling) of the PeaksReady signal. Holding the lock when emitting PeaksReady means that _peaks_built cannot be changed during the handling of the signal.

Definition at line 142 of file audiosource.h.

◆ peak_cache

std::unique_ptr<PeakData[]> ARDOUR::AudioSource::peak_cache
mutableprivate

Definition at line 155 of file audiosource.h.

◆ peak_leftover_cnt

samplecnt_t ARDOUR::AudioSource::peak_leftover_cnt
private

Definition at line 146 of file audiosource.h.

◆ peak_leftover_sample

samplepos_t ARDOUR::AudioSource::peak_leftover_sample
private

Definition at line 149 of file audiosource.h.

◆ peak_leftover_size

samplecnt_t ARDOUR::AudioSource::peak_leftover_size
private

Definition at line 147 of file audiosource.h.

◆ peak_leftovers

Sample* ARDOUR::AudioSource::peak_leftovers
private

Definition at line 148 of file audiosource.h.

◆ PeakRangeReady

PBD::Signal<void(samplepos_t,samplepos_t)> ARDOUR::AudioSource::PeakRangeReady
mutable

Definition at line 69 of file audiosource.h.

◆ PeaksReady

PBD::Signal<void()> ARDOUR::AudioSource::PeaksReady
mutable

Definition at line 68 of file audiosource.h.


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