Fixed some valgrind errors from using uninitialized variables in
[ardour.git] / gtk2_ardour / export_region_dialog.cc
1 /*
2     Copyright (C) 2006 Paul Davis
3     Author: Andre Raue
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 */
20
21 #include <pbd/pthread_utils.h>
22 #include <ardour/audioregion.h>
23
24 #include "export_region_dialog.h"
25
26 #include "i18n.h"
27
28
29 ExportRegionDialog::ExportRegionDialog (PublicEditor& editor, ARDOUR::AudioRegion* region) 
30         : ExportDialog(editor)
31 {
32         audio_region = region;
33         
34         do_not_allow_track_and_master_selection();
35         do_not_allow_channel_count_selection();
36 }
37
38
39 void
40 ExportRegionDialog::export_audio_data()
41 {
42         pthread_t thr;
43         pthread_create_and_store ("region export", &thr, 0, ExportRegionDialog::_export_region_thread, this);
44
45         gtk_main_iteration ();
46         while (spec.running) {
47                 if (gtk_events_pending()) {
48                         gtk_main_iteration ();
49                 } else {
50                         usleep (10000);
51                 }
52         }
53 }
54
55
56 void*
57 ExportRegionDialog::_export_region_thread (void *arg)
58 {
59         PBD::ThreadCreated (pthread_self(), X_("Export Region"));
60
61         static_cast<ExportRegionDialog*>(arg)->export_region ();
62         return 0;
63 }
64
65 void
66 ExportRegionDialog::export_region ()
67 {
68         audio_region->exportme (getSession(), spec);
69 }