Merge branch 'master' into zynaddsubfx-master

This commit is contained in:
Tobias Doerffel
2010-07-25 20:13:59 +02:00
8 changed files with 49 additions and 9 deletions

View File

@@ -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" );
}
}

View File

@@ -1,7 +1,7 @@
/*
* LocalZynAddSubFx.cpp - local implementation of ZynAddSubFx plugin
*
* Copyright (c) 2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2009-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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

View File

@@ -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 );

View File

@@ -115,6 +115,10 @@ public:
LocalZynAddSubFx::setPresetDir( _m.getString() );
break;
case IdZasfLmmsWorkingDirectory:
LocalZynAddSubFx::setLmmsWorkingDir( _m.getString() );
break;
default:
return RemotePluginClient::processMessage( _m );
}

View File

@@ -1,7 +1,7 @@
/*
* RemoteZynAddSubFx.h - ZynAddSubFX-embedding plugin
*
* Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -29,7 +29,8 @@
enum ZasfRemoteMessageIDs
{
IdZasfPresetDirectory = IdUserBase
IdZasfPresetDirectory = IdUserBase,
IdZasfLmmsWorkingDirectory
} ;
#endif

View File

@@ -1,7 +1,7 @@
/*
* ZynAddSubFx.cpp - ZynAddSubxFX-embedding plugin
*
* Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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();
}

View File

@@ -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
}
}

View File

@@ -52,6 +52,8 @@ class Config
int winwavemax, winmidimax; //number of wave/midi devices on Windows
int maxstringsize;
char * workingDir;
struct winmidionedevice {
char *name;
};