summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-02-19 21:06:56 +0000
committerDavid Robillard <d@drobilla.net>2009-02-19 21:06:56 +0000
commitbed0d89337b0775e669439ef4e0759feb7ddc74e (patch)
treed8e065e64e32970d6d2b67bec936f0f078d1802f
parent75c15679bf1551dcb93d4fa62075517c66d3b222 (diff)
Clean up Region interface, remove Readable stub kludge.
git-svn-id: svn://localhost/ardour2/branches/3.0@4643 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/ardour/ardour/audioregion.h20
-rw-r--r--libs/ardour/ardour/audiosource.h10
-rw-r--r--libs/ardour/ardour/crossfade.h4
-rw-r--r--libs/ardour/ardour/midi_region.h14
-rw-r--r--libs/ardour/ardour/readable.h6
-rw-r--r--libs/ardour/audioregion.cc36
-rw-r--r--libs/ardour/audiosource.cc2
-rw-r--r--libs/ardour/crossfade.cc7
-rw-r--r--libs/ardour/midi_region.cc4
9 files changed, 48 insertions, 55 deletions
diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h
index b259a13229..9be2defaa7 100644
--- a/libs/ardour/ardour/audioregion.h
+++ b/libs/ardour/ardour/audioregion.h
@@ -92,21 +92,21 @@ class AudioRegion : public Region
ReadOpsFades = 0x8
};
- virtual nframes64_t read (Sample*, nframes64_t pos, nframes64_t cnt, int channel) const;
- virtual nframes64_t read_with_ops (Sample*, nframes64_t pos, nframes64_t cnt, int channel, ReadOps rops) const;
+ virtual nframes_t read (Sample*, sframes_t pos, nframes_t cnt, int channel) const;
+ virtual nframes_t read_with_ops (Sample*, sframes_t pos, nframes_t cnt, int channel, ReadOps rops) const;
virtual nframes64_t readable_length() const { return length(); }
- virtual nframes_t read_at (Sample *buf, Sample *mixdown_buf,
- float *gain_buf, nframes_t position, nframes_t cnt,
+ virtual nframes_t read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf,
+ sframes_t position,
+ nframes_t cnt,
uint32_t chan_n = 0,
nframes_t read_frames = 0,
nframes_t skip_frames = 0) const;
- virtual nframes_t master_read_at (Sample *buf, Sample *mixdown_buf,
- float *gain_buf,
- nframes_t position, nframes_t cnt, uint32_t chan_n=0) const;
+ virtual nframes_t master_read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf,
+ sframes_t position, nframes_t cnt, uint32_t chan_n=0) const;
- virtual nframes_t read_raw_internal (Sample*, nframes_t, nframes_t) const;
+ virtual nframes_t read_raw_internal (Sample*, sframes_t, nframes_t) const;
XMLNode& state (bool);
int set_state (const XMLNode&);
@@ -186,8 +186,8 @@ class AudioRegion : public Region
void recompute_gain_at_start ();
nframes_t _read_at (const SourceList&, nframes_t limit,
- Sample *buf, Sample *mixdown_buffer,
- float *gain_buffer, nframes_t position, nframes_t cnt,
+ Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
+ sframes_t position, nframes_t cnt,
uint32_t chan_n = 0,
nframes_t read_frames = 0,
nframes_t skip_frames = 0,
diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h
index 0ed621c6ac..08435bf3b1 100644
--- a/libs/ardour/ardour/audiosource.h
+++ b/libs/ardour/ardour/audiosource.h
@@ -57,15 +57,7 @@ class AudioSource : virtual public Source,
virtual nframes_t available_peaks (double zoom) const;
- /** Stopgap for Readable until nframes_t becomes nframes64_t. */
- virtual nframes64_t read (Sample *dst, nframes64_t start, nframes64_t cnt, int channel) const {
- /* XXX currently ignores channel, assuming that source is always mono, which
- historically has been true.
- */
- return read (dst, (nframes_t) start, (nframes_t) cnt);
- }
-
- virtual nframes_t read (Sample *dst, sframes_t start, nframes_t cnt) const;
+ virtual nframes_t read (Sample *dst, sframes_t start, nframes_t cnt, int channel=0) const;
virtual nframes_t write (Sample *src, nframes_t cnt);
virtual float sample_rate () const = 0;
diff --git a/libs/ardour/ardour/crossfade.h b/libs/ardour/ardour/crossfade.h
index b0785a6e59..2b893478d4 100644
--- a/libs/ardour/ardour/crossfade.h
+++ b/libs/ardour/ardour/crossfade.h
@@ -81,7 +81,7 @@ class Crossfade : public ARDOUR::AudioRegion
boost::shared_ptr<ARDOUR::AudioRegion> out() const { return _out; }
nframes_t read_at (Sample *buf, Sample *mixdown_buffer,
- float *gain_buffer, nframes_t position, nframes_t cnt,
+ float *gain_buffer, sframes_t position, nframes_t cnt,
uint32_t chan_n,
nframes_t read_frames = 0,
nframes_t skip_frames = 0) const;
@@ -170,7 +170,7 @@ class Crossfade : public ARDOUR::AudioRegion
bool update ();
protected:
- nframes_t read_raw_internal (Sample*, nframes_t, nframes_t) const;
+ nframes_t read_raw_internal (Sample*, sframes_t, nframes_t) const;
};
diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h
index dc95fccdb4..0760fb7268 100644
--- a/libs/ardour/ardour/midi_region.h
+++ b/libs/ardour/ardour/midi_region.h
@@ -54,17 +54,17 @@ class MidiRegion : public Region
boost::shared_ptr<MidiSource> midi_source (uint32_t n=0) const;
/* Stub Readable interface */
- virtual nframes64_t read (Sample*, nframes64_t pos, nframes64_t cnt, int channel) const { return 0; }
- virtual nframes64_t readable_length() const { return length(); }
+ virtual nframes_t read (Sample*, sframes_t pos, nframes_t cnt, int channel) const { return 0; }
+ virtual sframes_t readable_length() const { return length(); }
nframes_t read_at (MidiRingBuffer<nframes_t>& dst,
- nframes_t position,
- nframes_t dur,
- uint32_t chan_n = 0,
- NoteMode mode = Sustained) const;
+ sframes_t position,
+ nframes_t dur,
+ uint32_t chan_n = 0,
+ NoteMode mode = Sustained) const;
nframes_t master_read_at (MidiRingBuffer<nframes_t>& dst,
- nframes_t position,
+ sframes_t position,
nframes_t dur,
uint32_t chan_n = 0,
NoteMode mode = Sustained) const;
diff --git a/libs/ardour/ardour/readable.h b/libs/ardour/ardour/readable.h
index e072a1c95e..a65af23312 100644
--- a/libs/ardour/ardour/readable.h
+++ b/libs/ardour/ardour/readable.h
@@ -10,9 +10,9 @@ class Readable {
Readable () {}
virtual ~Readable() {}
- virtual nframes64_t read (Sample*, nframes64_t pos, nframes64_t cnt, int channel) const = 0;
- virtual nframes64_t readable_length() const = 0;
- virtual uint32_t n_channels () const = 0;
+ virtual nframes_t read (Sample*, sframes_t pos, nframes_t cnt, int channel) const = 0;
+ virtual sframes_t readable_length() const = 0;
+ virtual uint32_t n_channels () const = 0;
};
}
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index e48f2ae586..aafa67e7d3 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -76,7 +76,7 @@ AudioRegion::init ()
listen_to_my_sources ();
}
-/* constructor for use by derived types only */
+/** Constructor for use by derived types only */
AudioRegion::AudioRegion (Session& s, nframes_t start, nframes_t length, string name)
: Region (s, start, length, name, DataType::AUDIO)
, _automatable(s)
@@ -119,7 +119,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, n
init ();
}
-/* Basic AudioRegion constructor (many channels) */
+/** Basic AudioRegion constructor (many channels) */
AudioRegion::AudioRegion (const SourceList& srcs, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags)
: Region (srcs, start, length, name, DataType::AUDIO, layer, flags)
, _automatable(srcs[0]->session())
@@ -329,43 +329,43 @@ AudioRegion::read_peaks (PeakData *buf, nframes_t npeaks, nframes_t offset, nfra
}
}
-nframes64_t
-AudioRegion::read (Sample* buf, nframes64_t timeline_position, nframes64_t cnt, int channel) const
+nframes_t
+AudioRegion::read (Sample* buf, sframes_t timeline_position, nframes_t cnt, int channel) const
{
/* raw read, no fades, no gain, nada */
return _read_at (_sources, _length, buf, 0, 0, _position + timeline_position, cnt, channel, 0, 0, ReadOps (0));
}
-nframes64_t
-AudioRegion::read_with_ops (Sample* buf, nframes64_t file_position, nframes64_t cnt, int channel, ReadOps rops) const
+nframes_t
+AudioRegion::read_with_ops (Sample* buf, sframes_t file_position, nframes_t cnt, int channel, ReadOps rops) const
{
return _read_at (_sources, _length, buf, 0, 0, file_position, cnt, channel, 0, 0, rops);
}
nframes_t
-AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nframes_t file_position,
- nframes_t cnt,
- uint32_t chan_n, nframes_t read_frames, nframes_t skip_frames) const
+AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
+ sframes_t file_position, nframes_t cnt, uint32_t chan_n,
+ nframes_t read_frames, nframes_t skip_frames) const
{
/* regular diskstream/butler read complete with fades etc */
return _read_at (_sources, _length, buf, mixdown_buffer, gain_buffer, file_position, cnt, chan_n, read_frames, skip_frames, ReadOps (~0));
}
nframes_t
-AudioRegion::master_read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nframes_t position,
- nframes_t cnt, uint32_t chan_n) const
+AudioRegion::master_read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
+ sframes_t position, nframes_t cnt, uint32_t chan_n) const
{
return _read_at (_master_sources, _master_sources.front()->length(), buf, mixdown_buffer, gain_buffer, position, cnt, chan_n, 0, 0);
}
nframes_t
AudioRegion::_read_at (const SourceList& srcs, nframes_t limit,
- Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
- nframes_t position, nframes_t cnt,
- uint32_t chan_n,
- nframes_t read_frames,
- nframes_t skip_frames,
- ReadOps rops) const
+ Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
+ sframes_t position, nframes_t cnt,
+ uint32_t chan_n,
+ nframes_t read_frames,
+ nframes_t skip_frames,
+ ReadOps rops) const
{
nframes_t internal_offset;
nframes_t buf_offset;
@@ -1058,7 +1058,7 @@ AudioRegion::separate_by_channel (Session& session, vector<boost::shared_ptr<Reg
}
nframes_t
-AudioRegion::read_raw_internal (Sample* buf, nframes_t pos, nframes_t cnt) const
+AudioRegion::read_raw_internal (Sample* buf, sframes_t pos, nframes_t cnt) const
{
return audio_source()->read (buf, pos, cnt);
}
diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc
index a25a2dc8ab..15f35bf1f1 100644
--- a/libs/ardour/audiosource.cc
+++ b/libs/ardour/audiosource.cc
@@ -247,7 +247,7 @@ AudioSource::initialize_peakfile (bool newfile, ustring audio_path)
}
nframes_t
-AudioSource::read (Sample *dst, sframes_t start, nframes_t cnt) const
+AudioSource::read (Sample *dst, sframes_t start, nframes_t cnt, int channel) const
{
Glib::Mutex::Lock lm (_lock);
return read_unlocked (dst, start, cnt);
diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc
index 70790787c3..5d180ceccc 100644
--- a/libs/ardour/crossfade.cc
+++ b/libs/ardour/crossfade.cc
@@ -271,8 +271,9 @@ Crossfade::initialize ()
}
nframes_t
-Crossfade::read_raw_internal (Sample* buf, nframes_t start, nframes_t cnt) const
+Crossfade::read_raw_internal (Sample* buf, sframes_t start, nframes_t cnt) const
{
+ // FIXME: Why is this disabled?
#if 0
Sample* mixdown = new Sample[cnt];
float* gain = new float[cnt];
@@ -290,7 +291,7 @@ Crossfade::read_raw_internal (Sample* buf, nframes_t start, nframes_t cnt) const
nframes_t
Crossfade::read_at (Sample *buf, Sample *mixdown_buffer,
- float *gain_buffer, nframes_t start, nframes_t cnt, uint32_t chan_n,
+ float *gain_buffer, sframes_t start, nframes_t cnt, uint32_t chan_n,
nframes_t read_frames, nframes_t skip_frames) const
{
nframes_t offset;
@@ -320,7 +321,7 @@ Crossfade::read_at (Sample *buf, Sample *mixdown_buffer,
} else {
- to_write = min (_length - (start - _position), cnt);
+ to_write = min (nframes_t(_length - (start - _position)), cnt);
}
diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc
index 1ce4bbdb7f..5eea77ebca 100644
--- a/libs/ardour/midi_region.cc
+++ b/libs/ardour/midi_region.cc
@@ -117,13 +117,13 @@ MidiRegion::~MidiRegion ()
}
nframes_t
-MidiRegion::read_at (MidiRingBuffer<nframes_t>& out, nframes_t position, nframes_t dur, uint32_t chan_n, NoteMode mode) const
+MidiRegion::read_at (MidiRingBuffer<nframes_t>& out, sframes_t position, nframes_t dur, uint32_t chan_n, NoteMode mode) const
{
return _read_at (_sources, out, position, dur, chan_n, mode);
}
nframes_t
-MidiRegion::master_read_at (MidiRingBuffer<nframes_t>& out, nframes_t position, nframes_t dur, uint32_t chan_n, NoteMode mode) const
+MidiRegion::master_read_at (MidiRingBuffer<nframes_t>& out, sframes_t position, nframes_t dur, uint32_t chan_n, NoteMode mode) const
{
return _read_at (_master_sources, out, position, dur, chan_n, mode);
}