Skip to content

Commit

Permalink
ZynAddSubFX: added pitch range support
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tobydox committed Mar 3, 2014
1 parent 46ca257 commit b5183fd
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 2 deletions.
10 changes: 10 additions & 0 deletions plugins/zynaddsubfx/LocalZynAddSubFx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions plugins/zynaddsubfx/LocalZynAddSubFx.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class LocalZynAddSubFx
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 );
Expand Down
4 changes: 4 additions & 0 deletions plugins/zynaddsubfx/RemoteZynAddSubFx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ class RemoteZynAddSubFx : public RemotePluginClient, public LocalZynAddSubFx
LocalZynAddSubFx::setLmmsWorkingDir( _m.getString() );
break;

case IdZasfSetPitchWheelBendRange:
LocalZynAddSubFx::setPitchWheelBendRange( _m.getInt() );
break;

default:
return RemotePluginClient::processMessage( _m );
}
Expand Down
5 changes: 3 additions & 2 deletions plugins/zynaddsubfx/RemoteZynAddSubFx.h
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down Expand Up @@ -30,7 +30,8 @@
enum ZasfRemoteMessageIDs
{
IdZasfPresetDirectory = IdUserBase,
IdZasfLmmsWorkingDirectory
IdZasfLmmsWorkingDirectory,
IdZasfSetPitchWheelBendRange
} ;

#endif
18 changes: 18 additions & 0 deletions plugins/zynaddsubfx/ZynAddSubFx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ ZynAddSubFxInstrument::ZynAddSubFxInstrument(

connect( engine::mixer(), SIGNAL( sampleRateChanged() ),
this, SLOT( reloadPlugin() ) );

connect( instrumentTrack()->pitchRangeModel(), SIGNAL( dataChanged() ),
this, SLOT( updatePitchRange() ) );
}


Expand Down Expand Up @@ -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() \
Expand Down
2 changes: 2 additions & 0 deletions plugins/zynaddsubfx/ZynAddSubFx.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class ZynAddSubFxInstrument : public Instrument
private slots:
void reloadPlugin();

void updatePitchRange();

void updatePortamento();
void updateFilterFreq();
void updateFilterQ();
Expand Down

0 comments on commit b5183fd

Please sign in to comment.