Improvement of FxMixer multithreading

Use dynamic building of jobqueues with dependency counting:
- At the start, each channel that has no dependencies is added automatically to the queue
- Then, after each channel is processed, it increments the dep.counter of all its recipients
- When a channel's dep.counter hits the amount of its dependencies (senders), it gets automatically added to the queue
- The queue is finished when the master channel has been processed
- Muted channels are automatically processed at the start regardless dependencies, because they don't have to care about senders, being muted

Hopefully this will improve Fx Mixer performance.
This commit is contained in:
Vesa
2014-11-15 18:51:49 +02:00
parent df843e2b32
commit c92774af27
2 changed files with 56 additions and 53 deletions

View File

@@ -57,6 +57,7 @@ class FxChannel : public ThreadableJob
QMutex m_lock;
int m_channelIndex; // what channel index are we
bool m_queued; // are we queued up for rendering yet?
bool m_muted; // are we muted? updated per period so we don't have to call m_muteModel.value() twice
// pointers to other channels that this one sends to
FxRouteVector m_sends;
@@ -65,7 +66,10 @@ class FxChannel : public ThreadableJob
FxRouteVector m_receives;
virtual bool requiresProcessing() const { return true; }
QAtomicInt m_dependenciesMet;
void incrementDeps();
private:
virtual void doProcessing( sampleFrame * _working_buffer );
};
@@ -189,8 +193,6 @@ private:
void allocateChannelsTo(int num);
QMutex m_sendsMutex;
void addChannelLeaf( FxChannel * ch, sampleFrame * buf );
friend class MixerWorkerThread;
friend class FxMixerView;