~ubuntu-branches/ubuntu/saucy/openal-soft/saucy

« back to all changes in this revision

Viewing changes to Alc/alcEcho.c

  • Committer: Bazaar Package Importer
  • Author(s): Andres Mejia
  • Date: 2011-04-22 18:30:58 UTC
  • mfrom: (7.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110422183058-pgxqd8022xk3vwao
Tags: 1:1.13-2
Don't build with ALSA compatibility on non-Linux architectures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
 
50
50
    ALfloat FeedGain;
51
51
 
 
52
    ALfloat Gain[MAXCHANNELS];
 
53
 
52
54
    FILTER iirFilter;
53
55
    ALfloat history[2];
54
56
} ALechoState;
55
57
 
56
 
ALvoid EchoDestroy(ALeffectState *effect)
 
58
static ALvoid EchoDestroy(ALeffectState *effect)
57
59
{
58
60
    ALechoState *state = (ALechoState*)effect;
59
61
    if(state)
64
66
    }
65
67
}
66
68
 
67
 
ALboolean EchoDeviceUpdate(ALeffectState *effect, ALCdevice *Device)
 
69
static ALboolean EchoDeviceUpdate(ALeffectState *effect, ALCdevice *Device)
68
70
{
69
71
    ALechoState *state = (ALechoState*)effect;
70
72
    ALuint maxlen, i;
88
90
    for(i = 0;i < state->BufferLength;i++)
89
91
        state->SampleBuffer[i] = 0.0f;
90
92
 
 
93
    for(i = 0;i < MAXCHANNELS;i++)
 
94
        state->Gain[i] = 0.0f;
 
95
    for(i = 0;i < Device->NumChan;i++)
 
96
    {
 
97
        Channel chan = Device->Speaker2Chan[i];
 
98
        state->Gain[chan] = 1.0f;
 
99
    }
 
100
 
91
101
    return AL_TRUE;
92
102
}
93
103
 
94
 
ALvoid EchoUpdate(ALeffectState *effect, ALCcontext *Context, const ALeffect *Effect)
 
104
static ALvoid EchoUpdate(ALeffectState *effect, ALCcontext *Context, const ALeffect *Effect)
95
105
{
96
106
    ALechoState *state = (ALechoState*)effect;
97
107
    ALuint frequency = Context->Device->Frequency;
115
125
    state->iirFilter.coeff = a;
116
126
}
117
127
 
118
 
ALvoid EchoProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[OUTPUTCHANNELS])
 
128
static ALvoid EchoProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[MAXCHANNELS])
119
129
{
120
130
    ALechoState *state = (ALechoState*)effect;
121
131
    const ALuint mask = state->BufferLength-1;
146
156
        samp[0] *= gain;
147
157
        samp[1] *= gain;
148
158
 
149
 
        SamplesOut[i][FRONT_LEFT]  += samp[0];
150
 
        SamplesOut[i][FRONT_RIGHT] += samp[1];
151
 
        SamplesOut[i][SIDE_LEFT]   += samp[0];
152
 
        SamplesOut[i][SIDE_RIGHT]  += samp[1];
153
 
        SamplesOut[i][BACK_LEFT]   += samp[0];
154
 
        SamplesOut[i][BACK_RIGHT]  += samp[1];
 
159
        SamplesOut[i][FRONT_LEFT]  += state->Gain[FRONT_LEFT]  * samp[0];
 
160
        SamplesOut[i][FRONT_RIGHT] += state->Gain[FRONT_RIGHT] * samp[1];
 
161
        SamplesOut[i][SIDE_LEFT]   += state->Gain[SIDE_LEFT]   * samp[0];
 
162
        SamplesOut[i][SIDE_RIGHT]  += state->Gain[SIDE_RIGHT]  * samp[1];
 
163
        SamplesOut[i][BACK_LEFT]   += state->Gain[BACK_LEFT]   * samp[0];
 
164
        SamplesOut[i][BACK_RIGHT]  += state->Gain[BACK_RIGHT]  * samp[1];
155
165
    }
156
166
    state->Offset = offset;
157
167
}