1 /*
2 Copyright (C) 2007 Remon Sijrier
3 
4 This file is part of Traverso
5 
6 Traverso is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
19 
20 */
21 
22 #include "AudioClipExternalProcessing.h"
23 
24 #include "ExternalProcessingDialog.h"
25 
26 #include <AudioClip.h>
27 #include <AudioClipView.h>
28 #include <Track.h>
29 #include <InputEngine.h>
30 #include <ReadSource.h>
31 #include <ProjectManager.h>
32 #include <Project.h>
33 #include <ResourcesManager.h>
34 #include <Utils.h>
35 #include "Interface.h"
36 
37 
38 // Always put me below _all_ includes, this is needed
39 // in case we run with memory leak detection enabled!
40 #include "Debugger.h"
41 
42 
43 
44 
AudioClipExternalProcessing(AudioClip * clip)45 AudioClipExternalProcessing::AudioClipExternalProcessing(AudioClip* clip)
46 	: Command(clip, tr("Clip: External Processing"))
47 {
48 	m_clip = clip;
49 	m_resultingclip = 0;
50 	m_track = m_clip->get_track();
51 }
52 
53 
~AudioClipExternalProcessing()54 AudioClipExternalProcessing::~AudioClipExternalProcessing()
55 {}
56 
57 
prepare_actions()58 int AudioClipExternalProcessing::prepare_actions()
59 {
60 	PENTER;
61 	ExternalProcessingDialog epdialog(Interface::instance(), this);
62 
63 	epdialog.exec();
64 
65 	if (! m_resultingclip) {
66 		return -1;
67 	}
68 
69 	return 1;
70 }
71 
72 
do_action()73 int AudioClipExternalProcessing::do_action()
74 {
75 	PENTER;
76 	Command::process_command(m_track->remove_clip(m_clip, false));
77 	Command::process_command(m_track->add_clip(m_resultingclip, false));
78 
79 	return 1;
80 }
81 
undo_action()82 int AudioClipExternalProcessing::undo_action()
83 {
84 	PENTER;
85 	Command::process_command(m_track->remove_clip(m_resultingclip, false));
86 	Command::process_command(m_track->add_clip(m_clip, false));
87 	return 1;
88 }
89 
90 
91 
92