/usr/include/CLAM/LadspaProcessingExporter.hxx is in libclam-dev 1.4.0-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | /*
* Copyright (c) 2004 MUSIC TECHNOLOGY GROUP (MTG)
* UNIVERSITAT POMPEU FABRA
*
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef LadspaProcessingExporter_hxx
#define LadspaProcessingExporter_hxx
#include "Audio.hxx"
#include "AudioOutPort.hxx"
#include "AudioInPort.hxx"
#include "OutControl.hxx"
#include "Processing.hxx"
#include "ProcessingFactory.hxx"
#include "LadspaLibrary.hxx"
namespace CLAM
{
namespace Hidden
{
class ProcessingClass2LadspaBase
{
std::vector<LADSPA_Data *> _portBuffers;
LADSPA_Data ** _outportBuffers;
LADSPA_Data ** _inportBuffers;
LADSPA_Data ** _incontrolBuffers;
LADSPA_Data ** _outcontrolBuffers;
std::vector<AudioOutPort*> mWrappersList;
unsigned _nInPorts;
unsigned _nOutPorts;
unsigned _nInControls;
unsigned _nOutControls;
private:
Processing * _proc;
public:
// Ladspa entry points
// Instantiate
ProcessingClass2LadspaBase(CLAM::Processing * processing)
: _proc(0)
{
SetProcessing(processing);
}
ProcessingClass2LadspaBase(const std::string & className)
: _proc(0)
{
SetProcessing(ProcessingFactory::GetInstance().Create(className));
}
void Instantiate()
{
_portBuffers.resize(NPorts());
_incontrolBuffers = &(_portBuffers[0]);
_outcontrolBuffers = _incontrolBuffers + _nInControls;
_inportBuffers = _outcontrolBuffers + _nOutControls;
_outportBuffers = _inportBuffers + _nInPorts;
mWrappersList.resize(_nInPorts);
for (unsigned i=0; i<mWrappersList.size(); i++)
{
mWrappersList[i] = new AudioOutPort("out", 0 );
mWrappersList[i]->ConnectToIn( _proc->GetInPort(i) );
}
}
void Activate()
{
_proc->Start();
}
void ConnectPort(unsigned long port, LADSPA_Data * data)
{
_portBuffers[port] = data;
}
void Run(unsigned long sampleCount)
{
DoControls();
SetPortSizes(sampleCount);
DoProc(sampleCount);
}
void Deactivate()
{
_proc->Stop();
}
// CleanUp
~ProcessingClass2LadspaBase()
{
for (unsigned i=0; i<mWrappersList.size(); i++)
delete mWrappersList[i];
SetProcessing(0);
}
private:
void DoProc(unsigned long nSamples);
void DoControls();
void SetPortSizes(int size);
// Pre instantiation interface
public:
LADSPA_Descriptor * CreateDescriptor(unsigned long id,
const std::string & maker, const std::string & copyright);
private:
void SetPortsAndControls(LADSPA_Descriptor *& descriptor);
// Helper shortcuts
private:
void SetProcessing(Processing * processing)
{
if (_proc) delete _proc;
_proc = processing;
_nInPorts = _proc?_proc->GetNInPorts():0;
_nOutPorts = _proc?_proc->GetNOutPorts():0;
_nInControls = _proc?_proc->GetNInControls():0;
_nOutControls = _proc?_proc->GetNOutControls():0;
}
const char * GetInControlName(int id) const;
const char * GetOutControlName(int id) const;
const char * GetInPortName(int id) const;
const char * GetOutPortName(int id) const;
unsigned NPorts() const
{
return _nInPorts + _nOutPorts + _nInControls + _nOutControls;
}
};
}
template <typename ProcessingType>
class LadspaProcessingExporter
{
public:
LadspaProcessingExporter(LadspaLibrary & library, unsigned long id,
const std::string & maker, const std::string & copyright)
{
Hidden::ProcessingClass2LadspaBase adapter(new ProcessingType);
LADSPA_Descriptor * descriptor = adapter.CreateDescriptor(id,maker,copyright);
library.AddPluginType(descriptor);
}
};
}
#endif//LadspaProcessingExporter_hxx
|