summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-06-20 18:50:38 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-06-20 18:50:38 +0000
commitbe362ae53c1d191e23d8a084d0327044bce4544c (patch)
treefb64f8276c64a495a0fdcf99e772d983af7725c0 /libs
parentc03dbd7568322d553ff681cb7f0bbd3452abd6cf (diff)
fixes for libsndfile conversion issues, tape track waveform display and overloaded virtual functions
git-svn-id: svn://localhost/ardour2/trunk@624 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/SConscript1
-rw-r--r--libs/ardour/ardour/destructive_filesource.h2
-rw-r--r--libs/ardour/ardour/io.h1
-rw-r--r--libs/ardour/ardour/region.h1
-rw-r--r--libs/ardour/ardour/route.h2
-rw-r--r--libs/ardour/audiosource.cc4
-rw-r--r--libs/ardour/destructive_filesource.cc6
-rw-r--r--libs/ardour/io.cc6
-rw-r--r--libs/ardour/route.cc2
-rw-r--r--libs/ardour/session_transport.cc4
-rw-r--r--libs/ardour/sndfilesource.cc16
-rw-r--r--libs/libsndfile/src/sndfile.c18
12 files changed, 31 insertions, 32 deletions
diff --git a/libs/ardour/SConscript b/libs/ardour/SConscript
index 7f4ee15eee..5361354962 100644
--- a/libs/ardour/SConscript
+++ b/libs/ardour/SConscript
@@ -103,6 +103,7 @@ extra_sources = [ ]
if ardour['VST']:
extra_sources += vst_files
+ ardour.Append(CCFLAGS="-DVST_SUPPORT", CPPPATH="#libs/fst")
if ardour['LIBLO']:
extra_sources += osc_files
diff --git a/libs/ardour/ardour/destructive_filesource.h b/libs/ardour/ardour/destructive_filesource.h
index 49a1e3b48a..c92a0762ee 100644
--- a/libs/ardour/ardour/destructive_filesource.h
+++ b/libs/ardour/ardour/destructive_filesource.h
@@ -48,7 +48,7 @@ class DestructiveFileSource : public SndFileSource {
static void setup_standard_crossfades (jack_nframes_t sample_rate);
protected:
- jack_nframes_t write_unlocked (Sample *src, jack_nframes_t start, jack_nframes_t cnt, char * workbuf);
+ jack_nframes_t write_unlocked (Sample *src, jack_nframes_t cnt, char * workbuf);
private:
static jack_nframes_t xfade_frames;
diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h
index c80a7abfaa..8ae45fe65c 100644
--- a/libs/ardour/ardour/io.h
+++ b/libs/ardour/ardour/io.h
@@ -321,7 +321,6 @@ public:
Change restore_state (State&);
StateManager::State* state_factory (std::string why) const;
- void send_state_changed();
bool get_midi_node_info (XMLNode * node, MIDI::eventType & ev, MIDI::channel_t & chan, MIDI::byte & additional);
bool set_midi_node_info (XMLNode * node, MIDI::eventType ev, MIDI::channel_t chan, MIDI::byte additional);
diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h
index 3c94dad6fd..aae776625e 100644
--- a/libs/ardour/ardour/region.h
+++ b/libs/ardour/ardour/region.h
@@ -233,7 +233,6 @@ class Region : public Stateful, public StateManager
/* state management */
void send_change (Change);
- void send_state_changed ();
/* derived classes need these during their own state management calls */
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index 5699d9ef14..5686dfc908 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -95,7 +95,7 @@ class Route : public IO
virtual bool can_record() const { return false; }
virtual void set_record_enable (bool yn, void *src) {}
virtual bool record_enabled() const { return false; }
- virtual void transport_stopped (bool abort, bool did_locate, bool flush_redirects);
+ virtual void handle_transport_stopped (bool abort, bool did_locate, bool flush_redirects);
virtual void set_pending_declick (int);
/* end of vfunc-based API */
diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc
index 46596ad64f..add9364cad 100644
--- a/libs/ardour/audiosource.cc
+++ b/libs/ardour/audiosource.cc
@@ -792,7 +792,9 @@ AudioSource::do_build_peak (jack_nframes_t first_frame, jack_nframes_t cnt)
frames_to_read = min (frames_per_peak, cnt);
- if ((frames_read = read_unlocked (buf, current_frame, frames_to_read, workbuf)) != frames_to_read) {
+ /* lock for every read */
+
+ if ((frames_read = read (buf, current_frame, frames_to_read, workbuf)) != frames_to_read) {
error << string_compose(_("%1: could not write read raw data for peak computation (%2)"), _name, strerror (errno)) << endmsg;
goto out;
}
diff --git a/libs/ardour/destructive_filesource.cc b/libs/ardour/destructive_filesource.cc
index 00fabba445..306b377320 100644
--- a/libs/ardour/destructive_filesource.cc
+++ b/libs/ardour/destructive_filesource.cc
@@ -255,7 +255,7 @@ DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in,
}
jack_nframes_t
-DestructiveFileSource::write_unlocked (Sample* data, jack_nframes_t start, jack_nframes_t cnt, char * workbuf)
+DestructiveFileSource::write_unlocked (Sample* data, jack_nframes_t cnt, char * workbuf)
{
jack_nframes_t old_file_pos;
@@ -319,9 +319,7 @@ DestructiveFileSource::write_unlocked (Sample* data, jack_nframes_t start, jack_
}
old_file_pos = file_pos;
- if (file_pos + cnt > _length) {
- _length = file_pos + cnt;
- }
+ update_length (file_pos, cnt);
file_pos += cnt;
if (_build_peakfiles) {
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 9f4c3cd9e3..2f04b7eaca 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -2443,12 +2443,6 @@ IO::state_factory (std::string why) const
return state;
}
-void
-IO::send_state_changed ()
-{
- return;
-}
-
/**
Update the peak meters.
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 93fbb85e49..2ed0659485 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -2002,7 +2002,7 @@ Route::set_active (bool yn)
}
void
-Route::transport_stopped (bool abort_ignored, bool did_locate, bool can_flush_redirects)
+Route::handle_transport_stopped (bool abort_ignored, bool did_locate, bool can_flush_redirects)
{
jack_nframes_t now = _session.transport_frame();
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index 4a1f7a182b..60fa3dd94d 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -1198,8 +1198,8 @@ Session::update_latency_compensation (bool with_stop, bool abort)
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
if (with_stop) {
- (*i)->transport_stopped (abort, (post_transport_work & PostTransportLocate),
- (!(post_transport_work & PostTransportLocate) || pending_locate_flush));
+ (*i)->handle_transport_stopped (abort, (post_transport_work & PostTransportLocate),
+ (!(post_transport_work & PostTransportLocate) || pending_locate_flush));
}
jack_nframes_t old_latency = (*i)->signal_latency ();
diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc
index 6929385141..6ea0929ae0 100644
--- a/libs/ardour/sndfilesource.cc
+++ b/libs/ardour/sndfilesource.cc
@@ -81,8 +81,6 @@ SndFileSource::SndFileSource (string idstr, SampleFormat sfmt, HeaderFormat hf,
init (idstr);
- cerr << "creating " << idstr << " hf = " << hf << endl;
-
switch (hf) {
case CAF:
fmt = SF_FORMAT_CAF;
@@ -174,7 +172,7 @@ SndFileSource::SndFileSource (string idstr, SampleFormat sfmt, HeaderFormat hf,
}
if (_build_peakfiles) {
- if (initialize_peakfile (false, _path)) {
+ if (initialize_peakfile (true, _path)) {
sf_close (sf);
sf = 0;
throw failed_constructor ();
@@ -187,14 +185,6 @@ SndFileSource::SndFileSource (string idstr, SampleFormat sfmt, HeaderFormat hf,
HeaderPositionOffsetChanged.connect (mem_fun (*this, &AudioFileSource::handle_header_position_change));
}
- if (_build_peakfiles) {
- if (initialize_peakfile (false, _path)) {
- sf_close (sf);
- sf = 0;
- throw failed_constructor ();
- }
- }
-
AudioSourceCreated (this); /* EMIT SIGNAL */
}
@@ -310,7 +300,7 @@ SndFileSource::read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t
if (file_cnt) {
- if (sf_seek (sf, (off_t) start, SEEK_SET) < 0) {
+ if (sf_seek (sf, (sf_count_t) start, SEEK_SET|SFM_READ) != (sf_count_t) start) {
char errbuf[256];
sf_error_str (0, errbuf, sizeof (errbuf) - 1);
error << string_compose(_("SndFileSource: could not seek to frame %1 within %2 (%3)"), start, _name.substr (1), errbuf) << endmsg;
@@ -505,7 +495,7 @@ SndFileSource::set_header_timeline_position ()
jack_nframes_t
SndFileSource::write_float (Sample* data, jack_nframes_t frame_pos, jack_nframes_t cnt)
{
- if (sf_seek (sf, frame_pos, SEEK_SET) != frame_pos) {
+ if (sf_seek (sf, frame_pos, SEEK_SET|SFM_WRITE) != frame_pos) {
error << string_compose (_("%1: cannot seek to %2"), _path, frame_pos) << endmsg;
return 0;
}
diff --git a/libs/libsndfile/src/sndfile.c b/libs/libsndfile/src/sndfile.c
index c30d7b61b4..b627c88ffe 100644
--- a/libs/libsndfile/src/sndfile.c
+++ b/libs/libsndfile/src/sndfile.c
@@ -1150,7 +1150,7 @@ sf_seek (SNDFILE *sndfile, sf_count_t offset, int whence)
** it makes sense.
*/
if (((whence & SFM_MASK) == SFM_WRITE && psf->mode == SFM_READ) ||
- ((whence & SFM_MASK) == SFM_WRITE && psf->mode == SFM_WRITE))
+ ((whence & SFM_MASK) == SFM_READ && psf->mode == SFM_WRITE))
{ psf->error = SFE_WRONG_SEEK ;
return PSF_SEEK_ERROR ;
} ;
@@ -1210,10 +1210,25 @@ sf_seek (SNDFILE *sndfile, sf_count_t offset, int whence)
if (psf->error)
return PSF_SEEK_ERROR ;
+#ifdef ECDL_ORIGINAL#
if (seek_from_start < 0 || seek_from_start > psf->sf.frames)
{ psf->error = SFE_BAD_SEEK ;
return PSF_SEEK_ERROR ;
} ;
+#else
+ if (((whence & SFM_MASK) == SFM_WRITE) || (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR))
+ { if (seek_from_start < 0 /* || (seek_from_start > psf->sf.frames && post-audio chunks exist) */ )
+ { psf->error = SFE_BAD_SEEK ;
+ return PSF_SEEK_ERROR ;
+ }
+ }
+ else /* seek for reading */
+ { if (seek_from_start < 0 || seek_from_start > psf->sf.frames)
+ { psf->error = SFE_BAD_SEEK ;
+ return PSF_SEEK_ERROR ;
+ }
+ }
+#endif
if (psf->seek)
{ int new_mode = (whence & SFM_MASK) ? (whence & SFM_MASK) : psf->mode ;
@@ -1234,6 +1249,7 @@ sf_seek (SNDFILE *sndfile, sf_count_t offset, int whence)
break ;
} ;
+
psf->last_op = new_mode ;
return retval ;