1 /*
2  * Copyright (C) 2002 - David W. Durham
3  *
4  * This file is part of ReZound, an audio editing application.
5  *
6  * ReZound is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published
8  * by the Free Software Foundation; either version 2 of the License,
9  * or (at your option) any later version.
10  *
11  * ReZound is distributed in the hope that it will be useful, but
12  * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
19  */
20 
21 #ifndef __CLADSPAAction_H__
22 #define __CLADSPAAction_H__
23 
24 #include "../../../config/common.h"
25 
26 
27 class CLADSPAAction;
28 class CLADSPAActionFactory;
29 class ASoundFileManager;
30 
31 #include "../AAction.h"
32 #include "../CActionParameters.h"
33 
34 #include <vector>
35 
36 #include "ladspa.h"
37 
38 class CLADSPAAction : public AAction
39 {
40 public:
41 	CLADSPAAction(const LADSPA_Descriptor *desc,const AActionFactory *factory,const CActionSound *actionSound,const CActionParameters &actionParameters);
42 	virtual ~CLADSPAAction();
43 
44 protected:
45 	bool doActionSizeSafe(CActionSound *actionSound,bool prepareForUndo);
46 	void undoActionSizeSafe(const CActionSound *actionSound);
47 	CanUndoResults canUndo(const CActionSound *actionSound) const;
48 
49 private:
50 	const LADSPA_Descriptor *desc;
51 	CActionParameters actionParameters;
52 	const CPluginMapping channelMapping;
53 	ASoundFileManager *soundFileManager;
54 
55 	vector<unsigned> inputAudioPorts;
56 	vector<unsigned> outputAudioPorts;
57 	vector<unsigned> inputControlPorts;
58 	vector<unsigned> outputControlPorts; // I don't use these, but I have to bind to them to prevent segfaults in some plugins that assume I've connected to them
59 
60 	int restoreChannelsTempAudioPoolKey; // used if needing to restore removed channels
61 	CSound *origSound;
62 };
63 
64 class CLADSPAActionFactory : public AActionFactory
65 {
66 public:
67 	CLADSPAActionFactory(const LADSPA_Descriptor *desc,AActionDialog *channelSelectDialog,AActionDialog *dialog);
68 	virtual ~CLADSPAActionFactory();
69 
70 	CLADSPAAction *manufactureAction(const CActionSound *actionSound,const CActionParameters *actionParameters) const;
71 
getDescriptor()72 	const LADSPA_Descriptor *getDescriptor() const { return desc; }
73 
74 private:
75 	const LADSPA_Descriptor *desc;
76 };
77 
78 #endif
79