On Mon, 02 Sep 2013 23:45:20 -0700
Daniel Schürmann <notifications@github.com> wrote:

> > @@ -231,13 +251,13 @@ void EngineMaster::process(const CSAMPLE *,
> > const CSAMPLE *pOut, const int iBuff m_pXFaderReverse->get() == 1.0,
> >                                  &c1_gain, &c2_gain);
> >  
> > -    // Now set the gains for overall volume and the left, center,
> > right gains.
> > -    m_masterGain.setGains(m_pMasterVolume->get(), c1_gain, 1.0,
> > c2_gain); -
> > -    // Perform the master mix
> > -    ChannelMixer::mixChannels(m_channels, m_masterGain,
> > masterOutput,
> > -                              maxChannels,
> > &m_channelMasterGainCache,
> > -                              m_pMaster, iBufferSize);
> > +    // And mix the 3 buses into the master
> > +    float master_gain = m_pMasterVolume->get();
> > +    SampleUtil::copy3WithGain(m_pMaster,
> > +
> > m_OutputBus[EngineChannel::LEFT].m_pBuffer, c1_gain*master_gain,
> > +
> > m_OutputBus[EngineChannel::CENTER].m_pBuffer, master_gain,
> > +
> > m_OutputBus[EngineChannel::RIGHT].m_pBuffer, c2_gain*master_gain,
> > +                              iBufferSize);
> 
> Can we skip this, and most of the following code in your use case?
> This will probably a huge performance boost.

Unless you run on an old PII I doubt you'll see any difference that
could be called 'hudge' here :) I used this patch a lot on a very
slow netbook without any noticeable performance hit. I didn't run any
serious benchmark, but the normal tools (top) didn't show any
difference at all, even on the netbook.

> The question here is how significant is the Mixxx master output for
> headphones because it dos not depend on your external Mixxer. I think
> headphones are connected to the external Mixer as well, right? 

Yes, when using an external mixer this output is not needed. However
unless the process() function can check if an output is used or not you
still have to compute it.

You can definitely drop this hunk if you like, the worst case would be
definitely slower, but for the average case, using only 1 or 2 channels,
it would be slightly faster.

It should also be possible to optimize the copy3WithGain to only copy
one bus or only mix 2 of them when possible. However I didn't felt that
the complexity was worth it for this patch.