summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-03-16 21:44:10 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-03-16 21:44:10 +0000
commit2aba860ba1603cb84efc5d0212bf97493aa0bf46 (patch)
treed7b1ff50796820902a960652001519265caf2e5d /libs
parent3e369073533988b8536216389d52cc947535e51c (diff)
fix errors in multi-range export (and possibly other export styles); compiler warnings patch from Carl
git-svn-id: svn://localhost/ardour2/trunk@1605 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/export.h6
-rw-r--r--libs/ardour/ardour/session.h3
-rw-r--r--libs/ardour/audiosource.cc2
-rw-r--r--libs/ardour/import.cc18
-rw-r--r--libs/ardour/mix.cc2
-rw-r--r--libs/ardour/session.cc2
-rw-r--r--libs/ardour/session_export.cc57
-rw-r--r--libs/pbd/pbd/abstract_ui.cc2
-rw-r--r--libs/pbd/stacktrace.cc2
-rw-r--r--libs/pbd/strsplit.cc2
-rw-r--r--libs/soundtouch/RateTransposer.cpp2
-rw-r--r--libs/soundtouch/RateTransposer.h2
-rw-r--r--libs/soundtouch/TDStretch.cpp7
13 files changed, 51 insertions, 56 deletions
diff --git a/libs/ardour/ardour/export.h b/libs/ardour/ardour/export.h
index f66acec893..66e5b1b7d5 100644
--- a/libs/ardour/ardour/export.h
+++ b/libs/ardour/ardour/export.h
@@ -76,9 +76,9 @@ namespace ARDOUR
/* shared between UI thread and audio thread */
- float progress; /* audio thread sets this */
- bool stop; /* UI sets this */
- bool running; /* audio thread sets to false when export is done */
+ volatile float progress; /* audio thread sets this */
+ volatile bool stop; /* UI sets this */
+ volatile bool running; /* audio thread sets to false when export is done */
int status;
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 919d9a8162..5beaee8e33 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -575,7 +575,8 @@ class Session : public PBD::StatefulDestructible
int start_audio_export (ARDOUR::AudioExportSpecification&);
int stop_audio_export (ARDOUR::AudioExportSpecification&);
-
+ void finalize_audio_export ();
+
void add_source (boost::shared_ptr<Source>);
void remove_source (boost::weak_ptr<Source>);
diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc
index dfe88ace78..0043df7d2e 100644
--- a/libs/ardour/audiosource.cc
+++ b/libs/ardour/audiosource.cc
@@ -671,7 +671,7 @@ AudioSource::compute_and_write_peaks (Sample* buf, nframes_t first_frame, nframe
Sample* buf2 = 0;
nframes_t to_do;
uint32_t peaks_computed;
- PeakData* peakbuf;
+ PeakData* peakbuf = 0;
int ret = -1;
nframes_t current_frame;
nframes_t frames_done;
diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc
index b81f438490..712b9a35e4 100644
--- a/libs/ardour/import.cc
+++ b/libs/ardour/import.cc
@@ -117,7 +117,6 @@ Session::import_audiofile (import_status& status)
float *data = 0;
Sample **channel_data = 0;
long nfiles = 0;
- long n;
string basepath;
string sounds_dir;
nframes_t so_far;
@@ -143,14 +142,14 @@ Session::import_audiofile (import_status& status)
importable = new ImportableSource (in, &info);
}
- for (n = 0; n < info.channels; ++n) {
+ for (int n = 0; n < info.channels; ++n) {
newfiles.push_back (boost::shared_ptr<AudioFileSource>());
}
sounds_dir = discover_best_sound_dir ();
basepath = PBD::basename_nosuffix (status.paths.front());
- for (n = 0; n < info.channels; ++n) {
+ for (int n = 0; n < info.channels; ++n) {
bool goodfile = false;
@@ -162,7 +161,7 @@ Session::import_audiofile (import_status& status)
snprintf (buf, sizeof(buf), "%s/%s-R.wav", sounds_dir.c_str(), basepath.c_str());
}
} else if (info.channels > 1) {
- snprintf (buf, sizeof(buf), "%s/%s-c%lu.wav", sounds_dir.c_str(), basepath.c_str(), n+1);
+ snprintf (buf, sizeof(buf), "%s/%s-c%d.wav", sounds_dir.c_str(), basepath.c_str(), n+1);
} else {
snprintf (buf, sizeof(buf), "%s/%s.wav", sounds_dir.c_str(), basepath.c_str());
}
@@ -199,7 +198,7 @@ Session::import_audiofile (import_status& status)
data = new float[nframes * info.channels];
channel_data = new Sample * [ info.channels ];
- for (n = 0; n < info.channels; ++n) {
+ for (int n = 0; n < info.channels; ++n) {
channel_data[n] = new Sample[nframes];
}
@@ -222,7 +221,8 @@ Session::import_audiofile (import_status& status)
/* de-interleave */
for (chn = 0; chn < info.channels; ++chn) {
-
+
+ nframes_t n;
for (x = chn, n = 0; n < nfread; x += info.channels, ++n) {
channel_data[chn][n] = (Sample) data[x];
}
@@ -257,7 +257,7 @@ Session::import_audiofile (import_status& status)
if (status.multichan) {
/* all sources are used in a single multichannel region */
- for (n = 0; n < nfiles && !status.cancel; ++n) {
+ for (int n = 0; n < nfiles && !status.cancel; ++n) {
/* flush the final length to the header */
newfiles[n]->update_header(0, *now, xnow);
sources.push_back(newfiles[n]);
@@ -274,7 +274,7 @@ Session::import_audiofile (import_status& status)
status.new_regions.push_back (r);
} else {
- for (n = 0; n < nfiles && !status.cancel; ++n) {
+ for (int n = 0; n < nfiles && !status.cancel; ++n) {
/* flush the final length to the header */
@@ -309,7 +309,7 @@ Session::import_audiofile (import_status& status)
}
if (channel_data) {
- for (n = 0; n < info.channels; ++n) {
+ for (int n = 0; n < info.channels; ++n) {
delete [] channel_data[n];
}
delete [] channel_data;
diff --git a/libs/ardour/mix.cc b/libs/ardour/mix.cc
index a32c274b7c..2d31c8ccc8 100644
--- a/libs/ardour/mix.cc
+++ b/libs/ardour/mix.cc
@@ -92,7 +92,7 @@ compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current)
void
find_peaks (ARDOUR::Sample *buf, nframes_t nframes, float *min, float *max)
{
- long i;
+ nframes_t i;
float a, b;
a = *max;
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 129fa5f743..b496afe9d6 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -3626,7 +3626,6 @@ Session::next_insert_id ()
for (boost::dynamic_bitset<uint32_t>::size_type n = 0; n < insert_bitset.size(); ++n) {
if (!insert_bitset[n]) {
insert_bitset[n] = true;
- cerr << "Returning " << n << " as insert ID\n";
return n;
}
@@ -3647,7 +3646,6 @@ Session::next_send_id ()
for (boost::dynamic_bitset<uint32_t>::size_type n = 0; n < send_bitset.size(); ++n) {
if (!send_bitset[n]) {
send_bitset[n] = true;
- cerr << "Returning " << n << " as send ID\n";
return n;
}
diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc
index 82dd23f724..87bf5a5b03 100644
--- a/libs/ardour/session_export.cc
+++ b/libs/ardour/session_export.cc
@@ -267,7 +267,7 @@ AudioExportSpecification::process (nframes_t nframes)
char errbuf[256];
nframes_t to_write = 0;
int cnt = 0;
-
+
do {
/* now do sample rate conversion */
@@ -427,8 +427,6 @@ AudioExportSpecification::process (nframes_t nframes)
int
Session::start_audio_export (AudioExportSpecification& spec)
{
- int ret;
-
if (spec.prepare (current_block_size, frame_rate())) {
return -1;
}
@@ -436,40 +434,21 @@ Session::start_audio_export (AudioExportSpecification& spec)
spec.pos = spec.start_frame;
spec.end_frame = spec.end_frame;
spec.total_frames = spec.end_frame - spec.start_frame;
+ spec.running = true;
+ spec.do_freewheel = false; /* force a call to ::prepare_to_export() before proceeding to normal operation */
spec.freewheel_connection = _engine.Freewheel.connect (sigc::bind (mem_fun (*this, &Session::process_export), &spec));
- if ((ret = _engine.freewheel (true)) == 0) {
- spec.running = true;
- spec.do_freewheel = false;
- }
-
- return ret;
+ return _engine.freewheel (true);
}
int
Session::stop_audio_export (AudioExportSpecification& spec)
{
- /* can't use stop_transport() here because we need
- an immediate halt and don't require all the declick
- stuff that stop_transport() implements.
- */
-
- realtime_stop (true);
- schedule_butler_transport_work ();
-
- /* restart slaving */
+ /* don't stop freewheeling but do stop paying attention to it for now */
- if (post_export_slave != None) {
- Config->set_slave_source (post_export_slave);
- } else {
- locate (post_export_position, false, false, false);
- }
-
- spec.clear ();
- _exporting = false;
-
- spec.running = false;
+ spec.freewheel_connection.disconnect ();
+ spec.clear (); /* resets running/stop etc */
return 0;
}
@@ -639,3 +618,25 @@ Session::process_export (nframes_t nframes, AudioExportSpecification* spec)
return ret;
}
+void
+Session::finalize_audio_export ()
+{
+ _engine.freewheel (false);
+ _exporting = false;
+
+ /* can't use stop_transport() here because we need
+ an immediate halt and don't require all the declick
+ stuff that stop_transport() implements.
+ */
+
+ realtime_stop (true);
+ schedule_butler_transport_work ();
+
+ /* restart slaving */
+
+ if (post_export_slave != None) {
+ Config->set_slave_source (post_export_slave);
+ } else {
+ locate (post_export_position, false, false, false);
+ }
+}
diff --git a/libs/pbd/pbd/abstract_ui.cc b/libs/pbd/pbd/abstract_ui.cc
index 6c3f0bac7f..97f19e1fe5 100644
--- a/libs/pbd/pbd/abstract_ui.cc
+++ b/libs/pbd/pbd/abstract_ui.cc
@@ -54,6 +54,8 @@ AbstractUI<RequestObject>::get_request (RequestType rt)
}
RequestBufferVector vec;
+ vec.buf[0] = 0;
+ vec.buf[1] = 0;
rbuf->get_write_vector (&vec);
diff --git a/libs/pbd/stacktrace.cc b/libs/pbd/stacktrace.cc
index 6495009765..8a6eb606b2 100644
--- a/libs/pbd/stacktrace.cc
+++ b/libs/pbd/stacktrace.cc
@@ -23,7 +23,7 @@ PBD::stacktrace (std::ostream& out, int levels)
printf ("Obtained %zd stack frames.\n", size);
- for (i = 0; i < size && (levels == 0 || i < levels); i++) {
+ for (i = 0; i < size && (levels == 0 || i < size_t(levels)); i++) {
out << strings[i] << std::endl;
}
diff --git a/libs/pbd/strsplit.cc b/libs/pbd/strsplit.cc
index 80da357cc0..1fb6112150 100644
--- a/libs/pbd/strsplit.cc
+++ b/libs/pbd/strsplit.cc
@@ -56,7 +56,7 @@ split (ustring str, vector<ustring>& result, char splitchar)
}
for (ustring::size_type n = 0; n < len; ++n) {
- if (str[n] == splitchar) {
+ if (str[n] == gunichar(splitchar)) {
cnt++;
}
}
diff --git a/libs/soundtouch/RateTransposer.cpp b/libs/soundtouch/RateTransposer.cpp
index 740d099239..493d5326f2 100644
--- a/libs/soundtouch/RateTransposer.cpp
+++ b/libs/soundtouch/RateTransposer.cpp
@@ -339,7 +339,7 @@ void RateTransposer::clear()
// Returns nonzero if there aren't any samples available for outputting.
-uint RateTransposer::isEmpty()
+int RateTransposer::isEmpty() const
{
int res;
diff --git a/libs/soundtouch/RateTransposer.h b/libs/soundtouch/RateTransposer.h
index f7c03f759e..5315d6fec3 100644
--- a/libs/soundtouch/RateTransposer.h
+++ b/libs/soundtouch/RateTransposer.h
@@ -150,7 +150,7 @@ public:
void clear();
/// Returns nonzero if there aren't any samples available for outputting.
- uint isEmpty();
+ int isEmpty() const;
};
}
diff --git a/libs/soundtouch/TDStretch.cpp b/libs/soundtouch/TDStretch.cpp
index f1b85b5f17..c71c65967f 100644
--- a/libs/soundtouch/TDStretch.cpp
+++ b/libs/soundtouch/TDStretch.cpp
@@ -114,13 +114,6 @@ TDStretch::~TDStretch()
-// Calculates the x having the closest 2^x value for the given value
-static int _getClosest2Power(double value)
-{
- return (int)(log(value) / log(2.0) + 0.5);
-}
-
-
// Sets routine control parameters. These control are certain time constants
// defining how the sound is stretched to the desired duration.