![]() |
Mixxx
|
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 00011 #include <QtCore> 00012 #include "ladspalibrary.h" 00013 00014 LADSPALibrary::LADSPALibrary(QString file) 00015 { 00016 #ifdef __LINUX__ 00017 //qDebug() << "LADSPA: Loading library \e[91m" << file << "\e[0m:"; 00018 #else 00019 //qDebug() << "LADSPA: Loading library " << file << ":"; 00020 #endif 00021 m_pLibrary = new QLibrary(file); 00022 m_qFilePath = file; 00023 00024 if (m_pLibrary->load() == TRUE) 00025 { 00026 m_descriptorFunction = (LADSPA_Descriptor_Function) m_pLibrary->resolve("ladspa_descriptor"); 00027 00028 if (m_descriptorFunction == NULL) { 00029 QString error("The file " + file + " is not a LADSPA plugin"); 00030 throw error; 00031 } 00032 00033 const LADSPA_Descriptor * descriptor; 00034 00035 for (unsigned long index = 0; (descriptor = m_descriptorFunction(index)) != NULL; index++) 00036 { 00037 LADSPAPlugin * plugin = new LADSPAPlugin(descriptor); 00038 #ifdef __LINUX__ 00039 //qDebug() << "LADSPA: " << index << "u - \e[92m" << plugin->getLabel() << "\e[0m"; 00040 #else 00041 //qDebug() << "LADSPA: " << index << "u - " << plugin->getLabel(); 00042 #endif 00043 m_Plugins.append(plugin); 00044 } 00045 } 00046 } 00047 00048 LADSPALibrary::~LADSPALibrary() 00049 { 00050 // TODO 00051 delete m_pLibrary; 00052 } 00053 00054 const LADSPAPluginList * LADSPALibrary::pluginList() 00055 { 00056 return &m_Plugins; 00057 } 00058 00059 int LADSPALibrary::pluginCount() 00060 { 00061 return m_Plugins.count(); 00062 }