FxMixer, Mixer, FxMixerView: backported FX send support from master branch

There once have been huge efforts to implement FX send support in the
master branch. In order to make it available on a stable base here's
a backport which is non-trivial as there have been major rewrites of
the mixer's worker thread architecture.

There still seem to be bugs which we have to fix before merging into
stable branch.

Thanks to Andrew Kelley for the original work.
This commit is contained in:
Tobias Doerffel
2014-01-08 23:19:07 +01:00
parent 0ff1f91c1b
commit a955fb755a
20 changed files with 1660 additions and 579 deletions

View File

@@ -27,6 +27,7 @@
#include <QtGui/QProgressDialog>
#include <QtCore/QDir>
#include <QtCore/QBuffer>
#include <QtCore/QDebug>
#include "FlpImport.h"
#include "note_play_handle.h"
@@ -40,6 +41,7 @@
#include "Effect.h"
#include "engine.h"
#include "FxMixer.h"
#include "FxMixerView.h"
#include "group_box.h"
#include "Instrument.h"
#include "InstrumentTrack.h"
@@ -96,7 +98,7 @@ extern QString outstring;
}
const int NumFLFxChannels = 64;
static void dump_mem( const void * buffer, uint n_bytes )
{
@@ -534,7 +536,7 @@ struct FL_Project
int currentPattern;
int activeEditPattern;
FL_EffectChannel effectChannels[NumFxChannels+1];
FL_EffectChannel effectChannels[NumFLFxChannels+1];
int currentEffectChannel;
QString projectNotes;
@@ -884,7 +886,7 @@ bool FlpImport::tryImport( trackContainer * _tc )
break;
case FLP_EffectChannelMuted:
if( p.currentEffectChannel <= NumFxChannels )
if( p.currentEffectChannel <= NumFLFxChannels )
{
p.effectChannels[p.currentEffectChannel].isMuted =
( data & 0x08 ) > 0 ? false : true;
@@ -1121,7 +1123,7 @@ if( p.currentEffectChannel <= NumFxChannels )
case FLP_Text_EffectChanName:
++p.currentEffectChannel;
if( p.currentEffectChannel <= NumFxChannels )
if( p.currentEffectChannel <= NumFLFxChannels )
{
p.effectChannels[p.currentEffectChannel].name = text;
}
@@ -1344,7 +1346,7 @@ if( p.currentEffectChannel <= NumFxChannels )
const int param = pi[i*3+1] & 0xffff;
const int ch = ( pi[i*3+1] >> 22 )
& 0x7f;
if( ch < 0 || ch > NumFxChannels )
if( ch < 0 || ch > NumFLFxChannels )
{
continue;
}
@@ -1405,9 +1407,15 @@ else
// now create a project from FL_Project data structure
engine::getSong()->clearProject();
// configure the mixer
for( int i=0; i<NumFLFxChannels; ++i )
{
engine::fxMixer()->createChannel();
}
engine::fxMixerView()->refreshDisplay();
// set global parameters
engine::getSong()->setMasterVolume( p.mainVolume );
engine::getSong()->setMasterPitch( p.mainPitch );
@@ -1644,7 +1652,7 @@ p->putValue( jt->pos, value, false );
}
}
for( int fx_ch = 0; fx_ch <= NumFxChannels ; ++fx_ch )
for( int fx_ch = 0; fx_ch <= NumFLFxChannels ; ++fx_ch )
{
FxChannel * ch = engine::fxMixer()->effectChannel( fx_ch );
if( !ch )
@@ -1704,7 +1712,7 @@ p->putValue( jt->pos, value, false );
break;
}
if( effName.isEmpty() || it->fxChannel < 0 ||
it->fxChannel > NumFxChannels )
it->fxChannel > NumFLFxChannels )
{
continue;
}