~mattmik/mixxx/mic_modifications

« back to all changes in this revision

Viewing changes to mixxx/src/engine/enginexfader.cpp

  • Committer: Matt Mikolay
  • Date: 2012-10-22 14:10:21 UTC
  • mfrom: (3255.1.46 mixxx-trunk)
  • Revision ID: mikolaym@yahoo.com-20121022141021-9hxxx5o4amaqqw80
MergingĀ fromĀ lp:mixxx

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include "defs.h"
2
2
#include "enginexfader.h"
3
3
 
4
 
float EngineXfader::getCalibration(float transform)
5
 
{
 
4
float EngineXfader::getCalibration(float transform) {
6
5
    //get the transform_root of -3db (.5)
7
6
    return pow(.5, 1./transform);
8
7
}
9
8
 
10
 
void EngineXfader::getXfadeGains(float &gain1, float &gain2, float xfadePosition, float transform, float calibration, bool constPower)
11
 
{
 
9
void EngineXfader::getXfadeGains(
 
10
    float &gain1, float &gain2, float xfadePosition, float transform,
 
11
    float calibration, bool constPower, bool reverse) {
12
12
    // Slow-fade/fast-cut
13
13
    float xfadePositionLeft = xfadePosition;
14
14
    float xfadePositionRight = xfadePosition;
15
 
    
 
15
 
16
16
    if (constPower) {
17
17
        //Apply Calibration
18
18
        if(calibration != 0.)
22
22
        xfadePositionRight = xfadePosition + calibration;
23
23
    }
24
24
 
25
 
    if(xfadePositionLeft < 0) //on left side
26
 
    {
 
25
    if (xfadePositionLeft < 0) { //on left side
27
26
        xfadePositionLeft *= -1;
28
27
        gain2 = (1. - (1. * pow(xfadePositionLeft, transform)));
29
 
    }
30
 
    else
 
28
    } else {
31
29
        gain2 = 1.;
32
 
    if(xfadePositionRight > 0) //right side
33
 
    {
 
30
    }
 
31
 
 
32
    if(xfadePositionRight > 0) { //right side
34
33
        gain1 = (1. - (1. * pow(xfadePositionRight, transform)));
35
 
    }
36
 
    else
 
34
    } else {
37
35
        gain1 = 1.;
38
 
    
 
36
    }
 
37
 
39
38
    //prevent phase reversal
40
 
    if(gain1 < 0.)
 
39
    if (gain1 < 0.)
41
40
        gain1 = 0.;
42
 
    if(gain2 < 0.)
 
41
    if (gain2 < 0.)
43
42
        gain2 = 0.;
44
43
 
 
44
    if (reverse) {
 
45
        float gaint = gain1;
 
46
        gain1 = gain2;
 
47
        gain2 = gaint;
 
48
    }
45
49
}