summaryrefslogtreecommitdiff
path: root/libs/ardour/audiosource.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-02-19 05:45:11 +0000
committerDavid Robillard <d@drobilla.net>2009-02-19 05:45:11 +0000
commit8a28ea6154f78d491afe746b3a2b0230185afb91 (patch)
tree35c6b974624bbfc41297dfd08a068585545cf9a0 /libs/ardour/audiosource.cc
parent0f71728a925eb8f16c14c74f0dae9fdd53406a20 (diff)
Introduce new time for session-relative frame time, and make source interface capable of handling 64-bit long sessions.
sframes_t is "session frames". The rules for time stamps are: - Anything relative to transport time, session position, etc, should be sframes_t - Anything relative to jack cycles, including the length thereof, should be nframes_t To support sessions which exceed UINT32_MAX frames, we need to replace all the uses of nframes_t for session time with sframes_t, and make sure the conversions are sound. This does not depend on jack's nframes_t; that we are using the same type at all right now was an oops. This is also be kinda nice for readability since the two different time bases have different types... git-svn-id: svn://localhost/ardour2/branches/3.0@4636 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audiosource.cc')
-rw-r--r--libs/ardour/audiosource.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc
index 7b56d1891e..a25a2dc8ab 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, nframes_t start, nframes_t cnt) const
+AudioSource::read (Sample *dst, sframes_t start, nframes_t cnt) const
{
Glib::Mutex::Lock lm (_lock);
return read_unlocked (dst, start, cnt);
@@ -261,13 +261,13 @@ AudioSource::write (Sample *dst, nframes_t cnt)
}
int
-AudioSource::read_peaks (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt, double samples_per_visual_peak) const
+AudioSource::read_peaks (PeakData *peaks, nframes_t npeaks, sframes_t start, nframes_t cnt, double samples_per_visual_peak) const
{
return read_peaks_with_fpp (peaks, npeaks, start, cnt, samples_per_visual_peak, _FPP);
}
int
-AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt,
+AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, sframes_t start, nframes_t cnt,
double samples_per_visual_peak, nframes_t samples_per_file_peak) const
{
Glib::Mutex::Lock lm (_lock);
@@ -426,7 +426,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, nframes_t s
if (i == stored_peaks_read) {
uint32_t start_byte = current_stored_peak * sizeof(PeakData);
- tnp = min ((_length/samples_per_file_peak - current_stored_peak), (nframes_t) expected_peaks);
+ tnp = min ((nframes_t)(_length/samples_per_file_peak - current_stored_peak), (nframes_t) expected_peaks);
to_read = min (chunksize, tnp);
#ifdef DEBUG_READ_PEAKS
@@ -520,7 +520,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, nframes_t s
if (i == frames_read) {
- to_read = min (chunksize, (_length - current_frame));
+ to_read = min (chunksize, nframes_t(_length - current_frame));
if (to_read == 0) {
/* XXX ARGH .. out by one error ... need to figure out why this happens
@@ -681,14 +681,15 @@ AudioSource::done_with_peakfile_writes (bool done)
}
int
-AudioSource::compute_and_write_peaks (Sample* buf, nframes_t first_frame, nframes_t cnt, bool force, bool intermediate_peaks_ready)
+AudioSource::compute_and_write_peaks (Sample* buf, sframes_t first_frame, nframes_t cnt,
+ bool force, bool intermediate_peaks_ready)
{
return compute_and_write_peaks (buf, first_frame, cnt, force, intermediate_peaks_ready, _FPP);
}
int
-AudioSource::compute_and_write_peaks (Sample* buf, nframes_t first_frame, nframes_t cnt, bool force,
- bool intermediate_peaks_ready, nframes_t fpp)
+AudioSource::compute_and_write_peaks (Sample* buf, sframes_t first_frame, nframes_t cnt,
+ bool force, bool intermediate_peaks_ready, nframes_t fpp)
{
Sample* buf2 = 0;
nframes_t to_do;