fix crash when copy'ing latent plugins
[ardour.git] / libs / ardour / export_status.cc
1 /*
2     Copyright (C) 2008 Paul Davis
3     Author: Sakari Bergen
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/stacktrace.h>
22
23 #include "ardour/export_status.h"
24
25 namespace ARDOUR
26 {
27
28 ExportStatus::ExportStatus ()
29 {
30         init();
31 }
32
33 void
34 ExportStatus::init ()
35 {
36         Glib::Threads::Mutex::Lock l (_run_lock);
37         stop = false;
38         _running = false;
39         _aborted = false;
40         _errors = false;
41
42         active_job = Exporting;
43
44         total_timespans = 0;
45         timespan = 0;
46
47         total_frames = 0;
48         processed_frames = 0;
49
50         total_frames_current_timespan = 0;
51         processed_frames_current_timespan = 0;
52
53         total_postprocessing_cycles = 0;
54         current_postprocessing_cycle = 0;
55         result_map.clear();
56 }
57
58 void
59 ExportStatus::abort (bool error_occurred)
60 {
61         Glib::Threads::Mutex::Lock l (_run_lock);
62         _aborted = true;
63         _errors = _errors || error_occurred;
64         _running = false;
65 }
66
67 void
68 ExportStatus::finish ()
69 {
70         Glib::Threads::Mutex::Lock l (_run_lock);
71         set_running (false);
72         Finished(); /* EMIT SIGNAL */
73 }
74
75 } // namespace ARDOUR