X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor_export_audio.cc;h=ef55394253fd7b8c24c6cd5a991f71529b807054;hb=4050ca5633dda03679f9aa9fab87d3bbf517395b;hp=2bd607f10871a9a833aced746997eed9b4bccb61;hpb=6ccffbaf0937c7814f3c49510859d13bc033df99;p=ardour.git diff --git a/gtk2_ardour/editor_export_audio.cc b/gtk2_ardour/editor_export_audio.cc index 2bd607f108..ef55394253 100644 --- a/gtk2_ardour/editor_export_audio.cc +++ b/gtk2_ardour/editor_export_audio.cc @@ -1,21 +1,27 @@ /* - Copyright (C) 2001 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ + * Copyright (C) 2005-2017 Paul Davis + * Copyright (C) 2005 Taybin Rutkin + * Copyright (C) 2006-2012 David Robillard + * Copyright (C) 2007-2010 Carl Hetherington + * Copyright (C) 2007-2017 Tim Mayberry + * Copyright (C) 2008-2012 Sakari Bergen + * Copyright (C) 2014-2017 Robin Gareus + * Copyright (C) 2015 André Nusser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ /* Note: public Editor methods are documented in public_editor.h */ @@ -27,8 +33,6 @@ #include "pbd/gstdio_compat.h" -#include "gtkmm2ext/choice.h" - #include "pbd/pthread_utils.h" #include "ardour/audio_track.h" @@ -53,7 +57,7 @@ #include "time_axis_view.h" #include "utils.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using namespace ARDOUR; @@ -125,9 +129,7 @@ Editor::process_midi_export_dialog (MidiExportDialog& dialog, boost::shared_ptr< ::g_unlink (path.c_str()); } - (void) midi_region->clone (path); - - return true; + return midi_region->do_export (path); } /** Export the first selected region */ @@ -163,7 +165,6 @@ Editor::export_region () finished = process_midi_export_dialog (dialog, midi_region); break; default: - finished = true; return; } } @@ -218,11 +219,11 @@ bool Editor::write_region (string path, boost::shared_ptr region) { boost::shared_ptr fs; - const framepos_t chunk_size = 4096; - framepos_t to_read; + const samplepos_t chunk_size = 4096; + samplepos_t to_read; Sample buf[chunk_size]; gain_t gain_buffer[chunk_size]; - framepos_t pos; + samplepos_t pos; char s[PATH_MAX+1]; uint32_t cnt; vector > sources; @@ -271,7 +272,7 @@ Editor::write_region (string path, boost::shared_ptr region) fs = boost::dynamic_pointer_cast ( SourceFactory::createWritable (DataType::AUDIO, *_session, path, true, - false, _session->frame_rate())); + false, _session->sample_rate())); } catch (failed_constructor& err) { @@ -290,7 +291,7 @@ Editor::write_region (string path, boost::shared_ptr region) pos = region->position(); while (to_read) { - framepos_t this_time; + samplepos_t this_time; this_time = min (to_read, chunk_size); @@ -368,11 +369,11 @@ bool Editor::write_audio_range (AudioPlaylist& playlist, const ChanCount& count, list& range) { boost::shared_ptr fs; - const framepos_t chunk_size = 4096; - framepos_t nframes; + const samplepos_t chunk_size = 4096; + samplepos_t nframes; Sample buf[chunk_size]; gain_t gain_buffer[chunk_size]; - framepos_t pos; + samplepos_t pos; char s[PATH_MAX+1]; uint32_t cnt; string path; @@ -410,7 +411,7 @@ Editor::write_audio_range (AudioPlaylist& playlist, const ChanCount& count, list fs = boost::dynamic_pointer_cast ( SourceFactory::createWritable (DataType::AUDIO, *_session, path, true, - false, _session->frame_rate())); + false, _session->sample_rate())); } catch (failed_constructor& err) { @@ -428,7 +429,7 @@ Editor::write_audio_range (AudioPlaylist& playlist, const ChanCount& count, list pos = (*i).start; while (nframes) { - framepos_t this_time; + samplepos_t this_time; this_time = min (nframes, chunk_size); @@ -460,7 +461,7 @@ Editor::write_audio_range (AudioPlaylist& playlist, const ChanCount& count, list while (nframes) { - framepos_t this_time = min (nframes, chunk_size); + samplepos_t this_time = min (nframes, chunk_size); memset (buf, 0, sizeof (Sample) * this_time); for (uint32_t n=0; n < channels; ++n) {