diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc index 8902391b0b..75b0f8c1e9 100644 --- a/gtk2_ardour/export_dialog.cc +++ b/gtk2_ardour/export_dialog.cc @@ -916,7 +916,6 @@ ExportDialog::do_export () void ExportDialog::end_dialog () { - if (spec.running) { spec.stop = true; @@ -929,7 +928,7 @@ ExportDialog::end_dialog () } } - session->engine().freewheel (false); + session->finalize_audio_export (); hide_all (); diff --git a/gtk2_ardour/export_range_markers_dialog.cc b/gtk2_ardour/export_range_markers_dialog.cc index b6bd25a60d..1184294a67 100644 --- a/gtk2_ardour/export_range_markers_dialog.cc +++ b/gtk2_ardour/export_range_markers_dialog.cc @@ -65,7 +65,7 @@ ExportRangeMarkersDialog::process_range_markers_export(Locations::LocationList& Locations::LocationList::iterator locationIter; current_range_marker_index = 0; init_progress_computing(locations); - + for (locationIter = locations.begin(); locationIter != locations.end(); ++locationIter) { Location *currentLocation = (*locationIter); @@ -90,7 +90,8 @@ ExportRangeMarkersDialog::process_range_markers_export(Locations::LocationList& // wait until export of this range finished gtk_main_iteration(); - while(spec.running){ + + while (spec.running){ if(gtk_events_pending()){ gtk_main_iteration(); }else { @@ -197,12 +198,6 @@ ExportRangeMarkersDialog::progress_timeout () { double progress = 0.0; - cerr << "Progress timeout, total = " << total_duration << " index = " << current_range_marker_index - << " current = " << range_markers_durations[current_range_marker_index] - << " agg = " << range_markers_durations_aggregated[current_range_marker_index] - << " prog = " << spec.progress - << endl; - if (current_range_marker_index >= range_markers_durations.size()){ progress = 1.0; } else{ 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); void remove_source (boost::weak_ptr); 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()); } 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::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::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. - */ + /* don't stop freewheeling but do stop paying attention to it for now */ - 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); - } - - 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::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& 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.