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
This commit is contained in:
parent
3e36907353
commit
2aba860ba1
@ -916,7 +916,6 @@ ExportDialog::do_export ()
|
|||||||
void
|
void
|
||||||
ExportDialog::end_dialog ()
|
ExportDialog::end_dialog ()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (spec.running) {
|
if (spec.running) {
|
||||||
spec.stop = true;
|
spec.stop = true;
|
||||||
|
|
||||||
@ -929,7 +928,7 @@ ExportDialog::end_dialog ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
session->engine().freewheel (false);
|
session->finalize_audio_export ();
|
||||||
|
|
||||||
hide_all ();
|
hide_all ();
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ ExportRangeMarkersDialog::process_range_markers_export(Locations::LocationList&
|
|||||||
Locations::LocationList::iterator locationIter;
|
Locations::LocationList::iterator locationIter;
|
||||||
current_range_marker_index = 0;
|
current_range_marker_index = 0;
|
||||||
init_progress_computing(locations);
|
init_progress_computing(locations);
|
||||||
|
|
||||||
for (locationIter = locations.begin(); locationIter != locations.end(); ++locationIter) {
|
for (locationIter = locations.begin(); locationIter != locations.end(); ++locationIter) {
|
||||||
Location *currentLocation = (*locationIter);
|
Location *currentLocation = (*locationIter);
|
||||||
|
|
||||||
@ -90,7 +90,8 @@ ExportRangeMarkersDialog::process_range_markers_export(Locations::LocationList&
|
|||||||
|
|
||||||
// wait until export of this range finished
|
// wait until export of this range finished
|
||||||
gtk_main_iteration();
|
gtk_main_iteration();
|
||||||
while(spec.running){
|
|
||||||
|
while (spec.running){
|
||||||
if(gtk_events_pending()){
|
if(gtk_events_pending()){
|
||||||
gtk_main_iteration();
|
gtk_main_iteration();
|
||||||
}else {
|
}else {
|
||||||
@ -197,12 +198,6 @@ ExportRangeMarkersDialog::progress_timeout ()
|
|||||||
{
|
{
|
||||||
double progress = 0.0;
|
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()){
|
if (current_range_marker_index >= range_markers_durations.size()){
|
||||||
progress = 1.0;
|
progress = 1.0;
|
||||||
} else{
|
} else{
|
||||||
|
@ -76,9 +76,9 @@ namespace ARDOUR
|
|||||||
|
|
||||||
/* shared between UI thread and audio thread */
|
/* shared between UI thread and audio thread */
|
||||||
|
|
||||||
float progress; /* audio thread sets this */
|
volatile float progress; /* audio thread sets this */
|
||||||
bool stop; /* UI sets this */
|
volatile bool stop; /* UI sets this */
|
||||||
bool running; /* audio thread sets to false when export is done */
|
volatile bool running; /* audio thread sets to false when export is done */
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
@ -575,7 +575,8 @@ class Session : public PBD::StatefulDestructible
|
|||||||
|
|
||||||
int start_audio_export (ARDOUR::AudioExportSpecification&);
|
int start_audio_export (ARDOUR::AudioExportSpecification&);
|
||||||
int stop_audio_export (ARDOUR::AudioExportSpecification&);
|
int stop_audio_export (ARDOUR::AudioExportSpecification&);
|
||||||
|
void finalize_audio_export ();
|
||||||
|
|
||||||
void add_source (boost::shared_ptr<Source>);
|
void add_source (boost::shared_ptr<Source>);
|
||||||
void remove_source (boost::weak_ptr<Source>);
|
void remove_source (boost::weak_ptr<Source>);
|
||||||
|
|
||||||
|
@ -671,7 +671,7 @@ AudioSource::compute_and_write_peaks (Sample* buf, nframes_t first_frame, nframe
|
|||||||
Sample* buf2 = 0;
|
Sample* buf2 = 0;
|
||||||
nframes_t to_do;
|
nframes_t to_do;
|
||||||
uint32_t peaks_computed;
|
uint32_t peaks_computed;
|
||||||
PeakData* peakbuf;
|
PeakData* peakbuf = 0;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
nframes_t current_frame;
|
nframes_t current_frame;
|
||||||
nframes_t frames_done;
|
nframes_t frames_done;
|
||||||
|
@ -117,7 +117,6 @@ Session::import_audiofile (import_status& status)
|
|||||||
float *data = 0;
|
float *data = 0;
|
||||||
Sample **channel_data = 0;
|
Sample **channel_data = 0;
|
||||||
long nfiles = 0;
|
long nfiles = 0;
|
||||||
long n;
|
|
||||||
string basepath;
|
string basepath;
|
||||||
string sounds_dir;
|
string sounds_dir;
|
||||||
nframes_t so_far;
|
nframes_t so_far;
|
||||||
@ -143,14 +142,14 @@ Session::import_audiofile (import_status& status)
|
|||||||
importable = new ImportableSource (in, &info);
|
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>());
|
newfiles.push_back (boost::shared_ptr<AudioFileSource>());
|
||||||
}
|
}
|
||||||
|
|
||||||
sounds_dir = discover_best_sound_dir ();
|
sounds_dir = discover_best_sound_dir ();
|
||||||
basepath = PBD::basename_nosuffix (status.paths.front());
|
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;
|
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());
|
snprintf (buf, sizeof(buf), "%s/%s-R.wav", sounds_dir.c_str(), basepath.c_str());
|
||||||
}
|
}
|
||||||
} else if (info.channels > 1) {
|
} 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 {
|
} else {
|
||||||
snprintf (buf, sizeof(buf), "%s/%s.wav", sounds_dir.c_str(), basepath.c_str());
|
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];
|
data = new float[nframes * info.channels];
|
||||||
channel_data = new Sample * [ 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];
|
channel_data[n] = new Sample[nframes];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +221,8 @@ Session::import_audiofile (import_status& status)
|
|||||||
/* de-interleave */
|
/* de-interleave */
|
||||||
|
|
||||||
for (chn = 0; chn < info.channels; ++chn) {
|
for (chn = 0; chn < info.channels; ++chn) {
|
||||||
|
|
||||||
|
nframes_t n;
|
||||||
for (x = chn, n = 0; n < nfread; x += info.channels, ++n) {
|
for (x = chn, n = 0; n < nfread; x += info.channels, ++n) {
|
||||||
channel_data[chn][n] = (Sample) data[x];
|
channel_data[chn][n] = (Sample) data[x];
|
||||||
}
|
}
|
||||||
@ -257,7 +257,7 @@ Session::import_audiofile (import_status& status)
|
|||||||
if (status.multichan) {
|
if (status.multichan) {
|
||||||
/* all sources are used in a single multichannel region */
|
/* 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 */
|
/* flush the final length to the header */
|
||||||
newfiles[n]->update_header(0, *now, xnow);
|
newfiles[n]->update_header(0, *now, xnow);
|
||||||
sources.push_back(newfiles[n]);
|
sources.push_back(newfiles[n]);
|
||||||
@ -274,7 +274,7 @@ Session::import_audiofile (import_status& status)
|
|||||||
status.new_regions.push_back (r);
|
status.new_regions.push_back (r);
|
||||||
|
|
||||||
} else {
|
} 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 */
|
/* flush the final length to the header */
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ Session::import_audiofile (import_status& status)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (channel_data) {
|
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[n];
|
||||||
}
|
}
|
||||||
delete [] channel_data;
|
delete [] channel_data;
|
||||||
|
@ -92,7 +92,7 @@ compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current)
|
|||||||
void
|
void
|
||||||
find_peaks (ARDOUR::Sample *buf, nframes_t nframes, float *min, float *max)
|
find_peaks (ARDOUR::Sample *buf, nframes_t nframes, float *min, float *max)
|
||||||
{
|
{
|
||||||
long i;
|
nframes_t i;
|
||||||
float a, b;
|
float a, b;
|
||||||
|
|
||||||
a = *max;
|
a = *max;
|
||||||
|
@ -3626,7 +3626,6 @@ Session::next_insert_id ()
|
|||||||
for (boost::dynamic_bitset<uint32_t>::size_type n = 0; n < insert_bitset.size(); ++n) {
|
for (boost::dynamic_bitset<uint32_t>::size_type n = 0; n < insert_bitset.size(); ++n) {
|
||||||
if (!insert_bitset[n]) {
|
if (!insert_bitset[n]) {
|
||||||
insert_bitset[n] = true;
|
insert_bitset[n] = true;
|
||||||
cerr << "Returning " << n << " as insert ID\n";
|
|
||||||
return 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) {
|
for (boost::dynamic_bitset<uint32_t>::size_type n = 0; n < send_bitset.size(); ++n) {
|
||||||
if (!send_bitset[n]) {
|
if (!send_bitset[n]) {
|
||||||
send_bitset[n] = true;
|
send_bitset[n] = true;
|
||||||
cerr << "Returning " << n << " as send ID\n";
|
|
||||||
return n;
|
return n;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,7 @@ AudioExportSpecification::process (nframes_t nframes)
|
|||||||
char errbuf[256];
|
char errbuf[256];
|
||||||
nframes_t to_write = 0;
|
nframes_t to_write = 0;
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
/* now do sample rate conversion */
|
/* now do sample rate conversion */
|
||||||
@ -427,8 +427,6 @@ AudioExportSpecification::process (nframes_t nframes)
|
|||||||
int
|
int
|
||||||
Session::start_audio_export (AudioExportSpecification& spec)
|
Session::start_audio_export (AudioExportSpecification& spec)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (spec.prepare (current_block_size, frame_rate())) {
|
if (spec.prepare (current_block_size, frame_rate())) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -436,40 +434,21 @@ Session::start_audio_export (AudioExportSpecification& spec)
|
|||||||
spec.pos = spec.start_frame;
|
spec.pos = spec.start_frame;
|
||||||
spec.end_frame = spec.end_frame;
|
spec.end_frame = spec.end_frame;
|
||||||
spec.total_frames = spec.end_frame - spec.start_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));
|
spec.freewheel_connection = _engine.Freewheel.connect (sigc::bind (mem_fun (*this, &Session::process_export), &spec));
|
||||||
|
|
||||||
if ((ret = _engine.freewheel (true)) == 0) {
|
return _engine.freewheel (true);
|
||||||
spec.running = true;
|
|
||||||
spec.do_freewheel = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Session::stop_audio_export (AudioExportSpecification& spec)
|
Session::stop_audio_export (AudioExportSpecification& spec)
|
||||||
{
|
{
|
||||||
/* can't use stop_transport() here because we need
|
/* don't stop freewheeling but do stop paying attention to it for now */
|
||||||
an immediate halt and don't require all the declick
|
|
||||||
stuff that stop_transport() implements.
|
|
||||||
*/
|
|
||||||
|
|
||||||
realtime_stop (true);
|
spec.freewheel_connection.disconnect ();
|
||||||
schedule_butler_transport_work ();
|
spec.clear (); /* resets running/stop etc */
|
||||||
|
|
||||||
/* 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;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -639,3 +618,25 @@ Session::process_export (nframes_t nframes, AudioExportSpecification* spec)
|
|||||||
return ret;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -54,6 +54,8 @@ AbstractUI<RequestObject>::get_request (RequestType rt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
RequestBufferVector vec;
|
RequestBufferVector vec;
|
||||||
|
vec.buf[0] = 0;
|
||||||
|
vec.buf[1] = 0;
|
||||||
|
|
||||||
rbuf->get_write_vector (&vec);
|
rbuf->get_write_vector (&vec);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ PBD::stacktrace (std::ostream& out, int levels)
|
|||||||
|
|
||||||
printf ("Obtained %zd stack frames.\n", size);
|
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;
|
out << strings[i] << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ split (ustring str, vector<ustring>& result, char splitchar)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (ustring::size_type n = 0; n < len; ++n) {
|
for (ustring::size_type n = 0; n < len; ++n) {
|
||||||
if (str[n] == splitchar) {
|
if (str[n] == gunichar(splitchar)) {
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,7 @@ void RateTransposer::clear()
|
|||||||
|
|
||||||
|
|
||||||
// Returns nonzero if there aren't any samples available for outputting.
|
// Returns nonzero if there aren't any samples available for outputting.
|
||||||
uint RateTransposer::isEmpty()
|
int RateTransposer::isEmpty() const
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ public:
|
|||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
/// Returns nonzero if there aren't any samples available for outputting.
|
/// Returns nonzero if there aren't any samples available for outputting.
|
||||||
uint isEmpty();
|
int isEmpty() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
// Sets routine control parameters. These control are certain time constants
|
||||||
// defining how the sound is stretched to the desired duration.
|
// defining how the sound is stretched to the desired duration.
|
||||||
|
Loading…
Reference in New Issue
Block a user