diff --git a/include/RemotePlugin.h b/include/RemotePlugin.h index 12ad00026..aeba87601 100644 --- a/include/RemotePlugin.h +++ b/include/RemotePlugin.h @@ -1072,9 +1072,12 @@ bool RemotePluginClient::processMessage( const message & _m ) break; default: - fprintf( stderr, "undefined message: %d\n", - (int) _m.id ); + { + char buf[64]; + sprintf( buf, "undefined message: %d\n", (int) _m.id ); + debugMessage( buf ); break; + } } if( reply ) { @@ -1097,7 +1100,7 @@ void RemotePluginClient::setShmKey( key_t _key, int _size ) } else { - fprintf( stderr, "failed getting shared memory\n" ); + debugMessage( "failed getting shared memory\n" ); } #else if( m_shm != NULL ) @@ -1115,7 +1118,7 @@ void RemotePluginClient::setShmKey( key_t _key, int _size ) int shm_id = shmget( _key, _size, 0 ); if( shm_id == -1 ) { - fprintf( stderr, "failed getting shared memory\n" ); + debugMessage( "failed getting shared memory\n" ); } else { @@ -1135,6 +1138,10 @@ void RemotePluginClient::doProcessing() (sampleFrame *)( m_shm + ( m_inputCount*m_bufferSize ) ) ); } + else + { + debugMessage( "doProcessing(): have no shared memory!\n" ); + } } 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 0f022e210..f8cb137e5 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 * @@ -320,6 +320,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 0921d3df1..a58f64dc6 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; };