Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/ladspa/ladspaplugin.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002 *                                                                         *
00003 *   This program is free software; you can redistribute it and/or modify  *
00004 *   it under the terms of the GNU General Public License as published by  *
00005 *   the Free Software Foundation; either version 2 of the License, or     *
00006 *   (at your option) any later version.                                   *
00007 *                                                                         *
00008 ***************************************************************************/
00009 
00010 #include <QtCore>
00011 #include "ladspaplugin.h"
00012 #include "ladspainstancestereo.h"
00013 #include "ladspainstancemono.h"
00014 
00015 LADSPAPlugin::LADSPAPlugin(const LADSPA_Descriptor * descriptor)
00016 {
00017     m_pDescriptor = descriptor;
00018 }
00019 
00020 LADSPAPlugin::~LADSPAPlugin()
00021 {
00022     // TODO
00023 }
00024 
00025 LADSPAInstance * LADSPAPlugin::instantiate(int slot)
00026 {
00027     int inputs = 0;
00028     int outputs = 0;
00029     for (unsigned long port = 0; port < m_pDescriptor->PortCount; port++)
00030     {
00031         if (LADSPA_IS_PORT_AUDIO(m_pDescriptor->PortDescriptors [port]))
00032         {
00033             if (LADSPA_IS_PORT_INPUT(m_pDescriptor->PortDescriptors [port]))
00034             {
00035                 inputs++;
00036             }
00037             else
00038             {
00039                 outputs++;
00040             }
00041         }
00042     }
00043 
00044     if (inputs == 2)
00045     {
00046         if (outputs == 2)
00047         {
00048             return new LADSPAInstanceStereo(m_pDescriptor, slot);
00049         }
00050         else if (outputs == 1)
00051         {
00052             qDebug() << "LADSPA: 2 inputs + 1 output not supported yet!";
00053         }
00054         else
00055         {
00056             qDebug() << "LADSPA: unsupported number of outputs (" << outputs << ")!";
00057         }
00058     }
00059     else if (inputs == 1)
00060     {
00061         if (outputs == 1)
00062         {
00063             return new LADSPAInstanceMono(m_pDescriptor, slot);
00064         }
00065         else if (outputs == 2)
00066         {
00067             qDebug() << "LADSPA: 1 input + 2 outputs not supported yet!";
00068         }
00069         else
00070         {
00071             qDebug() << "LADSPA: unsupported number of outputs (" << outputs << ")!";
00072         }
00073     }
00074     else
00075     {
00076         qDebug() << "LADSPA: unsupported number of inputs (" << inputs << ")!";
00077     }
00078 
00079     return NULL;
00080 }
00081 
00082 const QString LADSPAPlugin::getLabel()
00083 {
00084   return QString(m_pDescriptor->Label);
00085 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines