diff --git a/plugins/zynaddsubfx/LocalZynAddSubFx.cpp b/plugins/zynaddsubfx/LocalZynAddSubFx.cpp index 719da4fb0..8f1a5e007 100644 --- a/plugins/zynaddsubfx/LocalZynAddSubFx.cpp +++ b/plugins/zynaddsubfx/LocalZynAddSubFx.cpp @@ -1,7 +1,7 @@ /* * LocalZynAddSubFx.cpp - local implementation of ZynAddSubFx plugin * - * Copyright (c) 2009 Tobias Doerffel + * Copyright (c) 2009-2010 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -166,6 +166,18 @@ void LocalZynAddSubFx::setPresetDir( const std::string & _dir ) +void LocalZynAddSubFx::setLmmsWorkingDir( const std::string & _dir ) +{ + if( config.workingDir != NULL ) + { + free( config.workingDir ); + } + config.workingDir = strdup( _dir.c_str() ); + config.init(); +} + + + void LocalZynAddSubFx::processMidiEvent( const midiEvent & _e ) { // all functions are called while m_master->mutex is held diff --git a/plugins/zynaddsubfx/LocalZynAddSubFx.h b/plugins/zynaddsubfx/LocalZynAddSubFx.h index 978727257..6ab045742 100644 --- a/plugins/zynaddsubfx/LocalZynAddSubFx.h +++ b/plugins/zynaddsubfx/LocalZynAddSubFx.h @@ -44,6 +44,7 @@ public: void loadPreset( const std::string & _filename, int _part = 0 ); void setPresetDir( const std::string & _dir ); + void setLmmsWorkingDir( const std::string & _dir ); void processMidiEvent( const midiEvent & _e ); diff --git a/plugins/zynaddsubfx/RemoteZynAddSubFx.cpp b/plugins/zynaddsubfx/RemoteZynAddSubFx.cpp index 5e4b2c34b..91cd5f490 100644 --- a/plugins/zynaddsubfx/RemoteZynAddSubFx.cpp +++ b/plugins/zynaddsubfx/RemoteZynAddSubFx.cpp @@ -115,6 +115,10 @@ public: LocalZynAddSubFx::setPresetDir( _m.getString() ); break; + case IdZasfLmmsWorkingDirectory: + LocalZynAddSubFx::setLmmsWorkingDir( _m.getString() ); + break; + default: return RemotePluginClient::processMessage( _m ); } diff --git a/plugins/zynaddsubfx/RemoteZynAddSubFx.h b/plugins/zynaddsubfx/RemoteZynAddSubFx.h index cdf5037cb..a5eb91a38 100644 --- a/plugins/zynaddsubfx/RemoteZynAddSubFx.h +++ b/plugins/zynaddsubfx/RemoteZynAddSubFx.h @@ -1,7 +1,7 @@ /* * RemoteZynAddSubFx.h - ZynAddSubFX-embedding plugin * - * Copyright (c) 2008-2009 Tobias Doerffel + * Copyright (c) 2008-2010 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -29,7 +29,8 @@ enum ZasfRemoteMessageIDs { - IdZasfPresetDirectory = IdUserBase + IdZasfPresetDirectory = IdUserBase, + IdZasfLmmsWorkingDirectory } ; #endif diff --git a/plugins/zynaddsubfx/ZynAddSubFx.cpp b/plugins/zynaddsubfx/ZynAddSubFx.cpp index c1ed4db28..50010981b 100644 --- a/plugins/zynaddsubfx/ZynAddSubFx.cpp +++ b/plugins/zynaddsubfx/ZynAddSubFx.cpp @@ -1,7 +1,7 @@ /* * ZynAddSubFx.cpp - ZynAddSubxFX-embedding plugin * - * Copyright (c) 2008-2009 Tobias Doerffel + * Copyright (c) 2008-2010 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -322,6 +322,11 @@ void ZynAddSubFxInstrument::initPlugin() QSTR_TO_STDSTR( QString( configManager::inst()->factoryPresetsDir() + QDir::separator() + "ZynAddSubFX" ) ) ) ); + m_remotePlugin->sendMessage( + RemotePlugin::message( IdZasfLmmsWorkingDirectory ). + addString( + QSTR_TO_STDSTR( + QString( configManager::inst()->workingDir() ) ) ) ); m_remotePlugin->showUI(); m_remotePlugin->unlock(); } diff --git a/plugins/zynaddsubfx/src/Misc/Config.cpp b/plugins/zynaddsubfx/src/Misc/Config.cpp index 94966e4af..aa996f38a 100644 --- a/plugins/zynaddsubfx/src/Misc/Config.cpp +++ b/plugins/zynaddsubfx/src/Misc/Config.cpp @@ -32,7 +32,8 @@ #include "Config.h" #include "XMLwrapper.h" -Config::Config() +Config::Config() : + workingDir( NULL ) {} void Config::init() { @@ -392,10 +393,17 @@ void Config::saveConfig(const char *filename) void Config::getConfigFileName(char *name, int namesize) { name[0] = 0; + if( workingDir != NULL ) + { + snprintf(name, namesize, "%s%s", workingDir, ".zynaddsubfxXML.cfg"); + } + else + { #ifdef OS_LINUX snprintf(name, namesize, "%s%s", getenv("HOME"), "/.zynaddsubfxXML.cfg"); #else snprintf(name, namesize, "%s", "zynaddsubfxXML.cfg"); #endif + } } diff --git a/plugins/zynaddsubfx/src/Misc/Config.h b/plugins/zynaddsubfx/src/Misc/Config.h index f08505d80..45688addc 100644 --- a/plugins/zynaddsubfx/src/Misc/Config.h +++ b/plugins/zynaddsubfx/src/Misc/Config.h @@ -52,6 +52,8 @@ class Config int winwavemax, winmidimax; //number of wave/midi devices on Windows int maxstringsize; + char * workingDir; + struct winmidionedevice { char *name; };