13
0

const-ify first "src" argument in AudioSource::write() and derivatives

This commit is contained in:
Paul Davis 2024-09-26 17:52:50 -06:00
parent 8069a4a514
commit b4d0b06d95
11 changed files with 21 additions and 21 deletions

View File

@ -40,7 +40,7 @@ public:
bool clamped_at_unity () const { return false; }
samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const;
samplecnt_t write_unlocked (Sample *src, samplecnt_t cnt);
samplecnt_t write_unlocked (Sample const * src, samplecnt_t cnt);
float sample_rate () const;
int setup_peakfile ();

View File

@ -55,7 +55,7 @@ class LIBARDOUR_API AudioSource : virtual public Source, public ARDOUR::AudioRea
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 *src, samplecnt_t cnt);
virtual samplecnt_t write (Sample const * src, samplecnt_t cnt);
virtual float sample_rate () const = 0;
@ -117,21 +117,21 @@ class LIBARDOUR_API AudioSource : virtual public Source, public ARDOUR::AudioRea
int initialize_peakfile (const std::string& path, const bool in_session = false);
int build_peaks_from_scratch ();
int compute_and_write_peaks (Sample* buf, samplecnt_t first_sample, samplecnt_t cnt,
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();
mutable off_t _peak_byte_max; // modified in compute_and_write_peak()
virtual samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const = 0;
virtual samplecnt_t write_unlocked (Sample *dst, samplecnt_t cnt) = 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* buf, samplecnt_t first_sample, samplecnt_t cnt,
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);

View File

@ -55,7 +55,7 @@ class LIBARDOUR_API CoreAudioSource : public AudioFileSource {
protected:
void close ();
samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const;
samplecnt_t write_unlocked (Sample *, samplecnt_t) { return 0; }
samplecnt_t write_unlocked (Sample const * src, samplecnt_t) { return 0; }
private:
#ifdef COREAUDIO105

View File

@ -49,7 +49,7 @@ protected:
void close ();
/* AudioSource API */
samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const;
samplecnt_t write_unlocked (Sample *, samplecnt_t) { return 0; }
samplecnt_t write_unlocked (Sample const *, samplecnt_t) { return 0; }
private:
mutable FFMPEGFileImportableSource _ffmpeg;

View File

@ -47,7 +47,7 @@ protected:
void close ();
/* AudioSource API */
samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const;
samplecnt_t write_unlocked (Sample *, samplecnt_t) { return 0; }
samplecnt_t write_unlocked (Sample const *, samplecnt_t) { return 0; }
private:
mutable Mp3FileImportableSource _mp3;

View File

@ -58,7 +58,7 @@ protected:
return cnt;
}
samplecnt_t write_unlocked (Sample */*dst*/, samplecnt_t /*cnt*/) { return 0; }
samplecnt_t write_unlocked (Sample const * /*src*/, samplecnt_t /*cnt*/) { return 0; }
void set_header_natural_position () {}

View File

@ -83,8 +83,8 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource {
void set_header_natural_position ();
samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const;
samplecnt_t write_unlocked (Sample *dst, samplecnt_t cnt);
samplecnt_t write_float (Sample* data, samplepos_t pos, samplecnt_t cnt);
samplecnt_t write_unlocked (Sample const * dst, samplecnt_t cnt);
samplecnt_t write_float (Sample const * data, samplepos_t pos, samplecnt_t cnt);
private:
SNDFILE* _sndfile;
@ -97,7 +97,7 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource {
void file_closed ();
void set_natural_position (timepos_t const &);
samplecnt_t nondestructive_write_unlocked (Sample *dst, samplecnt_t cnt);
samplecnt_t nondestructive_write_unlocked (Sample const *src, samplecnt_t cnt);
PBD::ScopedConnection header_position_connection;
};

View File

@ -51,7 +51,7 @@ public:
protected:
void close ();
samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const;
samplecnt_t write_unlocked (Sample */*dst*/, samplecnt_t /*cnt*/) { return 0; }
samplecnt_t write_unlocked (Sample const */*src*/, samplecnt_t /*cnt*/) { return 0; }
int read_peaks_with_fpp (PeakData *peaks, samplecnt_t npeaks, samplepos_t /*start*/, samplecnt_t /*cnt*/,
double /*samples_per_unit*/, samplecnt_t /*fpp*/) const {

View File

@ -151,7 +151,7 @@ AudioPlaylistSource::read_unlocked (Sample* dst, samplepos_t start, samplecnt_t
}
samplecnt_t
AudioPlaylistSource::write_unlocked (Sample *, samplecnt_t)
AudioPlaylistSource::write_unlocked (Sample const *, samplecnt_t)
{
fatal << string_compose (_("programming error: %1"), "AudioPlaylistSource::write() called - should be impossible") << endmsg;
abort(); /*NOTREACHED*/

View File

@ -327,12 +327,12 @@ AudioSource::read (Sample *dst, samplepos_t start, samplecnt_t cnt, int /*channe
}
samplecnt_t
AudioSource::write (Sample *dst, samplecnt_t cnt)
AudioSource::write (Sample const * src, samplecnt_t cnt)
{
WriterLock lm (_lock);
/* any write makes the file not removable */
_flags = Flag (_flags & ~Removable);
return write_unlocked (dst, cnt);
return write_unlocked (src, cnt);
}
int
@ -918,14 +918,14 @@ AudioSource::done_with_peakfile_writes (bool done)
* process. _lock MUST be held by caller.
*/
int
AudioSource::compute_and_write_peaks (Sample* buf, samplecnt_t first_sample, samplecnt_t cnt,
AudioSource::compute_and_write_peaks (Sample const * buf, samplecnt_t first_sample, samplecnt_t cnt,
bool force, bool intermediate_peaks_ready)
{
return compute_and_write_peaks (buf, first_sample, cnt, force, intermediate_peaks_ready, _FPP);
}
int
AudioSource::compute_and_write_peaks (Sample* buf, samplecnt_t first_sample, samplecnt_t cnt,
AudioSource::compute_and_write_peaks (Sample const * buf, samplecnt_t first_sample, samplecnt_t cnt,
bool force, bool intermediate_peaks_ready, samplecnt_t fpp)
{
samplecnt_t to_do;

View File

@ -599,7 +599,7 @@ SndFileSource::read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) c
}
samplecnt_t
SndFileSource::write_unlocked (Sample *data, samplecnt_t cnt)
SndFileSource::write_unlocked (Sample const * data, samplecnt_t cnt)
{
if (open()) {
return 0; // failure
@ -609,7 +609,7 @@ SndFileSource::write_unlocked (Sample *data, samplecnt_t cnt)
}
samplecnt_t
SndFileSource::nondestructive_write_unlocked (Sample *data, samplecnt_t cnt)
SndFileSource::nondestructive_write_unlocked (Sample const * data, samplecnt_t cnt)
{
if (!writable()) {
warning << string_compose (_("attempt to write a non-writable audio file source (%1)"), _path) << endmsg;
@ -736,7 +736,7 @@ SndFileSource::set_header_natural_position ()
}
samplecnt_t
SndFileSource::write_float (Sample* data, samplepos_t sample_pos, samplecnt_t cnt)
SndFileSource::write_float (Sample const * data, samplepos_t sample_pos, samplecnt_t cnt)
{
if ((_info.format & SF_FORMAT_TYPEMASK ) == SF_FORMAT_FLAC) {
assert (_length == sample_pos);