2
2
* FxMixer.h - effect-mixer for LMMS
4
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
4
* Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
6
6
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
30
30
#include "EffectChain.h"
31
31
#include "JournallingObject.h"
32
#include "ThreadableJob.h"
37
class FxChannel : public ThreadableJob
34
const int NumFxChannels = 64;
40
FxChannel( int idx, Model * _parent );
43
EffectChain m_fxChain;
45
// set to true if any effect in the channel is enabled and running
50
sampleFrame * m_buffer;
51
BoolModel m_muteModel;
52
FloatModel m_volumeModel;
55
int m_channelIndex; // what channel index are we
56
bool m_queued; // are we queued up for rendering yet?
58
// pointers to other channels that this one sends to
59
QVector<fx_ch_t> m_sends;
60
QVector<FloatModel *> m_sendAmount;
62
// pointers to other channels that send to this one
63
QVector<fx_ch_t> m_receives;
65
virtual bool requiresProcessing() const { return true; }
68
virtual void doProcessing( sampleFrame * _working_buffer );
73
class EXPORT FxMixer : public JournallingObject, public Model
39
FxChannel( Model * _parent );
42
EffectChain m_fxChain;
47
sampleFrame * m_buffer;
48
BoolModel m_muteModel;
49
FloatModel m_volumeModel;
57
class FxMixer : public JournallingObject, public Model
77
61
virtual ~FxMixer();
79
63
void mixToChannel( const sampleFrame * _buf, fx_ch_t _ch );
64
void processChannel( fx_ch_t _ch, sampleFrame * _buf = NULL );
81
66
void prepareMasterMix();
82
67
void masterMix( sampleFrame * _buf );
84
72
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
85
73
virtual void loadSettings( const QDomElement & _this );
92
80
FxChannel * effectChannel( int _ch )
94
return m_fxChannels[_ch];
97
// make the output of channel fromChannel go to the input of channel toChannel
98
// it is safe to call even if the send already exists
99
void createChannelSend(fx_ch_t fromChannel, fx_ch_t toChannel,
100
float amount = 1.0f);
102
// delete the connection made by createChannelSend
103
void deleteChannelSend(fx_ch_t fromChannel, fx_ch_t toChannel);
105
// determine if adding a send from sendFrom to
106
// sendTo would result in an infinite mixer loop.
107
bool isInfiniteLoop(fx_ch_t fromChannel, fx_ch_t toChannel);
109
// return the FloatModel of fromChannel sending its output to the input of
110
// toChannel. NULL if there is no send.
111
FloatModel * channelSendModel(fx_ch_t fromChannel, fx_ch_t toChannel);
113
// add a new channel to the Fx Mixer.
114
// returns the index of the channel that was just added
117
// delete a channel from the FX mixer.
118
void deleteChannel(int index);
120
// delete all the mixer channels except master and remove all effects
123
// re-arrange channels
124
void moveChannelLeft(int index);
125
void moveChannelRight(int index);
127
// reset a channel's name, fx, sends, etc
128
void clearChannel(fx_ch_t channelIndex);
130
inline fx_ch_t numChannels() const
132
return m_fxChannels.size();
82
if( _ch >= 0 && _ch <= NumFxChannels )
84
return m_fxChannels[_ch];
136
// the fx channels in the mixer. index 0 is always master.
137
QVector<FxChannel *> m_fxChannels;
139
// make sure we have at least num channels
140
void allocateChannelsTo(int num);
142
void addChannelLeaf( int _ch, sampleFrame * _buf );
91
FxChannel * m_fxChannels[NumFxChannels+1]; // +1 = master
144
94
friend class MixerWorkerThread;
145
95
friend class FxMixerView;