ZynAddSubFX: added pitch range support

Even though ZynAddSubFX does not support updating its pitch wheel range
via MIDI events we can set it manually using provided internal functions.

Closes #394.
This commit is contained in:
Tobias Doerffel
2014-03-03 22:37:00 +01:00
parent 46ca257c14
commit b5183fdd5f
6 changed files with 39 additions and 2 deletions

View File

@@ -190,6 +190,16 @@ void LocalZynAddSubFx::setLmmsWorkingDir( const std::string & _dir )
void LocalZynAddSubFx::setPitchWheelBendRange( int semitones )
{
for( int i = 0; i < NUM_MIDI_PARTS; ++i )
{
m_master->part[i]->ctl.setpitchwheelbendrange( semitones * 100 );
}
}
void LocalZynAddSubFx::processMidiEvent( const MidiEvent& event )
{
// all functions are called while m_master->mutex is held

View File

@@ -49,6 +49,8 @@ public:
void setPresetDir( const std::string & _dir );
void setLmmsWorkingDir( const std::string & _dir );
void setPitchWheelBendRange( int semitones );
void processMidiEvent( const MidiEvent& event );
void processAudio( sampleFrame * _out );

View File

@@ -119,6 +119,10 @@ public:
LocalZynAddSubFx::setLmmsWorkingDir( _m.getString() );
break;
case IdZasfSetPitchWheelBendRange:
LocalZynAddSubFx::setPitchWheelBendRange( _m.getInt() );
break;
default:
return RemotePluginClient::processMessage( _m );
}

View File

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

View File

@@ -133,6 +133,9 @@ ZynAddSubFxInstrument::ZynAddSubFxInstrument(
connect( engine::mixer(), SIGNAL( sampleRateChanged() ),
this, SLOT( reloadPlugin() ) );
connect( instrumentTrack()->pitchRangeModel(), SIGNAL( dataChanged() ),
this, SLOT( updatePitchRange() ) );
}
@@ -378,6 +381,21 @@ void ZynAddSubFxInstrument::reloadPlugin()
void ZynAddSubFxInstrument::updatePitchRange()
{
m_pluginMutex.lock();
if( m_remotePlugin )
{
m_remotePlugin->sendMessage( RemotePlugin::message( IdZasfSetPitchWheelBendRange ).
addInt( instrumentTrack()->midiPitchRange() ) );
}
else
{
m_plugin->setPitchWheelBendRange( instrumentTrack()->midiPitchRange() );
}
m_pluginMutex.unlock();
}
#define GEN_CC_SLOT(slotname,midictl,modelname) \
void ZynAddSubFxInstrument::slotname() \

View File

@@ -91,6 +91,8 @@ public:
private slots:
void reloadPlugin();
void updatePitchRange();
void updatePortamento();
void updateFilterFreq();
void updateFilterQ();