diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c3ca298d..0d3f82c7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -521,7 +521,7 @@ ADD_DEFINITIONS(-D'LIB_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/"' -D'PLUGIN_DIR= INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include ${SDL_INCLUDE_DIR} ${PORTAUDIO_INCLUDE_DIR} ${PULSEAUDIO_INCLUDE_DIR} ${JACK_INCLUDE_DIRS} ${OGGVORBIS_INCLUDE_DIR} ${SAMPLERATE_INCLUDE_DIRS} ${SNDFILE_INCLUDE_DIRS} ${ZIP_INCLUDE_DIR}) LINK_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/lib ${ASOUND_LIBRARY_DIR} ${JACK_LIBRARY_DIRS} ${SAMPLERATE_LIBRARY_DIRS} ${SNDFILE_LIBRARY_DIRS}) -LINK_LIBRARIES(${QT_LIBRARIES} ${ASOUND_LIBRARY} ${SDL_LIBRARY} ${PORTAUDIO_LIBRARIES} ${PULSEAUDIO_LIBRARIES} ${JACK_LIBRARIES} ${OGGVORBIS_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${SNDFILE_LIBRARIES} ${ZIP_LIBRARIES}) +LINK_LIBRARIES(${QT_LIBRARIES} ${ASOUND_LIBRARY} ${SDL_LIBRARY} ${PORTAUDIO_LIBRARIES} ${PULSEAUDIO_LIBRARIES} ${JACK_LIBRARIES} ${OGGVORBIS_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${SNDFILE_LIBRARIES} ${ZIP_LIBRARIES} ${SLV2_LIBRARY}) ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/lmms.1.gz COMMAND gzip -c ${CMAKE_SOURCE_DIR}/lmms.1 > ${CMAKE_BINARY_DIR}/lmms.1.gz DEPENDS ${CMAKE_SOURCE_DIR}/lmms.1 COMMENT "Generating lmms.1.gz") diff --git a/include/lv2_2_lmms.h b/include/lv2_2_lmms.h new file mode 100644 index 000000000..1afc4af6e --- /dev/null +++ b/include/lv2_2_lmms.h @@ -0,0 +1,78 @@ +/* + * lv2_2_lmms.h - class that identifies and instantiates LV2 effects + * for use with LMMS + * + * Copyright (c) 2009 Martin Andrews + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * 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 (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef _LV2_2_LMMS_H +#define _LV2_2_LMMS_H + + +#include "lv2_manager.h" + + +class EXPORT lv22LMMS : public lv2Manager +{ +public: + inline l_sortable_plugin_t getInstruments( void ) + { + return m_instruments; + } + + inline l_sortable_plugin_t getValidEffects( void ) + { + return m_validEffects; + } + + inline l_sortable_plugin_t getInvalidEffects( void ) + { + return m_invalidEffects; + } + + inline l_sortable_plugin_t getAnalysisTools( void ) + { + return m_analysisTools; + } + + inline l_sortable_plugin_t getOthers( void ) + { + return m_otherPlugins; + } + + QString getShortName( const lv2_key_t & _key ); + + +private: + lv22LMMS( void ); + virtual ~lv22LMMS(); + + l_sortable_plugin_t m_instruments; + l_sortable_plugin_t m_validEffects; + l_sortable_plugin_t m_invalidEffects; + l_sortable_plugin_t m_analysisTools; + l_sortable_plugin_t m_otherPlugins; + + friend class engine; + +} ; + +#endif diff --git a/plugins/lv2_browser/lv2_manager.h b/include/lv2_manager.h similarity index 100% rename from plugins/lv2_browser/lv2_manager.h rename to include/lv2_manager.h diff --git a/plugins/lv2_browser/CMakeLists.txt b/plugins/lv2_browser/CMakeLists.txt index 04da59849..a98c99265 100644 --- a/plugins/lv2_browser/CMakeLists.txt +++ b/plugins/lv2_browser/CMakeLists.txt @@ -1,5 +1,4 @@ IF(LMMS_SUPPORT_LV2) INCLUDE(BuildPlugin) - LINK_LIBRARIES(${SLV2_LIBRARY}) - BUILD_PLUGIN(lv2browser lv2_browser.cpp lv2_browser.h lv2_manager.cpp lv2_manager.h lv2_description.cpp lv2_description.h lv2_port_dialog.cpp lv2_port_dialog.h MOCFILES lv2_browser.h lv2_description.h lv2_port_dialog.h EMBEDDED_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.png) + BUILD_PLUGIN(lv2browser lv2_browser.cpp lv2_browser.h lv2_description.cpp lv2_description.h lv2_port_dialog.cpp lv2_port_dialog.h MOCFILES lv2_browser.h lv2_description.h lv2_port_dialog.h EMBEDDED_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.png) ENDIF(LMMS_SUPPORT_LV2) diff --git a/src/core/lv2_2_lmms.cpp b/src/core/lv2_2_lmms.cpp new file mode 100644 index 000000000..505aac5fd --- /dev/null +++ b/src/core/lv2_2_lmms.cpp @@ -0,0 +1,126 @@ +/* + * lv2_2_lmms.cpp - class that identifies and instantiates LV2 effects + * for use with LMMS + * + * Copyright (c) 2009-2009 Martin Andrews + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * 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 (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "lv2_2_lmms.h" + + +lv22LMMS::lv22LMMS( void ) +{ + l_sortable_plugin_t plugins = getSortedPlugins(); + + for( l_sortable_plugin_t::iterator it = plugins.begin(); + it != plugins.end(); it++ ) + { + lv2_key_t key = (*it).second; + lv2ManagerDescription * desc = getDescription( key ); + + if( desc->type == SOURCE ) + { + m_instruments.append( qMakePair( getName( key ), + key ) ); + } + else if( desc->type == TRANSFER && + ( desc->inputChannels == desc->outputChannels && + ( desc->inputChannels == 1 || + desc->inputChannels == 2 || + desc->inputChannels == 4 ) ) ) + { + m_validEffects.append( qMakePair( getName( key ), + key ) ); + } + else if( desc->type == TRANSFER && + ( desc->inputChannels != desc->outputChannels || + ( desc->inputChannels != 1 && + desc->inputChannels != 2 && + desc->inputChannels != 4 ) ) ) + { + m_invalidEffects.append( qMakePair( getName( key ), + key ) ); + } + else if( desc->type == SINK ) + { + m_analysisTools.append( qMakePair( getName( key ), + key ) ); + } + else if( desc->type == OTHER ) + { + m_otherPlugins.append( qMakePair( getName( key ), + key ) ); + } + } +} + + + + +lv22LMMS::~lv22LMMS() +{ +} + + + +QString lv22LMMS::getShortName( const lv2_key_t & _key ) +{ + QString name = getName( _key ); + + if( name.indexOf( "(" ) > 0 ) + { + name = name.left( name.indexOf( "(" ) ); + } + if( name.indexOf( " - " ) > 0 ) + { + name = name.left( name.indexOf( " - " ) ); + } + if( name.indexOf( " " ) > 0 ) + { + name = name.left( name.indexOf( " " ) ); + } + Qt::CaseSensitivity cs = Qt::CaseInsensitive; + if( name.indexOf( " with ", 0, cs ) > 0 ) + { + name = name.left( name.indexOf( " with ", 0, cs ) ); + } + if( name.indexOf( ",", 0, cs ) > 0 ) + { + name = name.left( name.indexOf( ",", 0, cs ) ); + } + if( name.length() > 40 ) + { + Uint8 i = 40; + while( name[i] != ' ' && i != 0 ) + { + i--; + } + name = name.left( i ); + } + if( name.length() == 0 ) + { + name = "LV2 Plugin"; + } + + return( name ); +} + diff --git a/plugins/lv2_browser/lv2_manager.cpp b/src/core/lv2_manager.cpp similarity index 100% rename from plugins/lv2_browser/lv2_manager.cpp rename to src/core/lv2_manager.cpp