Update GPL boilerplate and (C)
[ardour.git] / gtk2_ardour / editor_export_audio.cc
index 795091fb4142e846753dd1013bd83e7b272925a4..ef55394253fd7b8c24c6cd5a991f71529b807054 100644 (file)
@@ -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 <paul@linuxaudiosystems.com>
+ * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
+ * Copyright (C) 2006-2012 David Robillard <d@drobilla.net>
+ * Copyright (C) 2007-2010 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2007-2017 Tim Mayberry <mojofunk@gmail.com>
+ * Copyright (C) 2008-2012 Sakari Bergen <sakari.bergen@beatwaves.net>
+ * Copyright (C) 2014-2017 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2015 AndrĂ© Nusser <andre.nusser@googlemail.com>
+ *
+ * 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"
@@ -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<AudioRegion> region)
 {
        boost::shared_ptr<AudioFileSource> 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<boost::shared_ptr<AudioFileSource> > sources;
@@ -271,7 +272,7 @@ Editor::write_region (string path, boost::shared_ptr<AudioRegion> region)
                                fs = boost::dynamic_pointer_cast<AudioFileSource> (
                                        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<AudioRegion> 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<AudioRange>& range)
 {
        boost::shared_ptr<AudioFileSource> 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<AudioFileSource> (
                                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) {