thirdparty/openal-soft-1.10.622/Alc/alcReverb.c
ALboolean VerbDeviceUpdate(ALeffectState *effect, ALCdevice *Device)
{
    ALverbState *State = (ALverbState*)effect;
    ALuint length[13], totalLength;
    ALuint index;

    totalLength = CalcLengths(length, Device->Frequency);
    if(totalLength != State->TotalLength)
    {
        void *temp;

        temp = realloc(State->SampleBuffer, totalLength * sizeof(ALfloat));
        if(!temp)
        {
            alSetError(AL_OUT_OF_MEMORY);
            return AL_FALSE;
        }
        State->TotalLength = totalLength;
        State->SampleBuffer = temp;

        // All lines share a single sample buffer
        State->Delay.Mask = length[0] - 1;
        State->Delay.Line = &State->SampleBuffer[0];
        totalLength = length[0];
        for(index = 0;index < 4;index++)
        {
            State->Early.Delay[index].Mask = length[1 + index] - 1;
            State->Early.Delay[index].Line = &State->SampleBuffer[totalLength];
            totalLength += length[1 + index];
        }
        for(index = 0;index < 4;index++)
        {
            State->Late.ApDelay[index].Mask = length[5 + index] - 1;
            State->Late.ApDelay[index].Line = &State->SampleBuffer[totalLength];
            totalLength += length[5 + index];
        }
        for(index = 0;index < 4;index++)
        {
            State->Late.Delay[index].Mask = length[9 + index] - 1;
            State->Late.Delay[index].Line = &State->SampleBuffer[totalLength];
            totalLength += length[9 + index];
        }
    }

    for(index = 0;index < 4;index++)
    {
        State->Early.Offset[index] = (ALuint)(EARLY_LINE_LENGTH[index] *
                                              Device->Frequency);
        State->Late.ApOffset[index] = (ALuint)(ALLPASS_LINE_LENGTH[index] *
                                               Device->Frequency);
    }

    for(index = 0;index < State->TotalLength;index++)
        State->SampleBuffer[index] = 0.0f;

    return AL_TRUE;
}
// This updates the device-dependant reverb state.  This is called on
// initialization and any time the device parameters (eg. playback frequency,
// format) have been changed.
This updates the device-dependant reverb state.  This is called on
initialization and any time the device parameters  have been changed.
This updates the device - dependant reverb state . This is called on initialization and any time the device parameters have been changed .
ALboolean VerbDeviceUpdate(ALeffectState *effect, ALCdevice *Device)
{
    ALverbState *State = (ALverbState*)effect;
    ALuint length[13], totalLength;
    ALuint index;
    totalLength = CalcLengths(length, Device->Frequency);
    if(totalLength != State->TotalLength)
    {
        void *temp;
        temp = realloc(State->SampleBuffer, totalLength * sizeof(ALfloat));
        if(!temp)
        {
            alSetError(AL_OUT_OF_MEMORY);
            return AL_FALSE;
        }
        State->TotalLength = totalLength;
        State->SampleBuffer = temp;
        State->Delay.Mask = length[0] - 1;
        State->Delay.Line = &State->SampleBuffer[0];
        totalLength = length[0];
        for(index = 0;index < 4;index++)
        {
            State->Early.Delay[index].Mask = length[1 + index] - 1;
            State->Early.Delay[index].Line = &State->SampleBuffer[totalLength];
            totalLength += length[1 + index];
        }
        for(index = 0;index < 4;index++)
        {
            State->Late.ApDelay[index].Mask = length[5 + index] - 1;
            State->Late.ApDelay[index].Line = &State->SampleBuffer[totalLength];
            totalLength += length[5 + index];
        }
        for(index = 0;index < 4;index++)
        {
            State->Late.Delay[index].Mask = length[9 + index] - 1;
            State->Late.Delay[index].Line = &State->SampleBuffer[totalLength];
            totalLength += length[9 + index];
        }
    }
    for(index = 0;index < 4;index++)
    {
        State->Early.Offset[index] = (ALuint)(EARLY_LINE_LENGTH[index] *
                                              Device->Frequency);
        State->Late.ApOffset[index] = (ALuint)(ALLPASS_LINE_LENGTH[index] *
                                               Device->Frequency);
    }
    for(index = 0;index < State->TotalLength;index++)
        State->SampleBuffer[index] = 0.0f;
    return AL_TRUE;
}
ALboolean VerbDeviceUpdate ( ALeffectState * effect , ALCdevice * Device ) { ALverbState * State = ( ALverbState * ) effect ; ALuint length [ 13 ] , totalLength ; ALuint index ; totalLength = CalcLengths ( length , Device -> Frequency ) ; if ( totalLength != State -> TotalLength ) { void * temp ; temp = realloc ( State -> SampleBuffer , totalLength * sizeof ( ALfloat ) ) ; if ( ! temp ) { alSetError ( AL_OUT_OF_MEMORY ) ; return AL_FALSE ; } State -> TotalLength = totalLength ; State -> SampleBuffer = temp ; State -> Delay . Mask = length [ 0 ] - 1 ; State -> Delay . Line = & State -> SampleBuffer [ 0 ] ; totalLength = length [ 0 ] ; for ( index = 0 ; index < 4 ; index ++ ) { State -> Early . Delay [ index ] . Mask = length [ 1 + index ] - 1 ; State -> Early . Delay [ index ] . Line = & State -> SampleBuffer [ totalLength ] ; totalLength += length [ 1 + index ] ; } for ( index = 0 ; index < 4 ; index ++ ) { State -> Late . ApDelay [ index ] . Mask = length [ 5 + index ] - 1 ; State -> Late . ApDelay [ index ] . Line = & State -> SampleBuffer [ totalLength ] ; totalLength += length [ 5 + index ] ; } for ( index = 0 ; index < 4 ; index ++ ) { State -> Late . Delay [ index ] . Mask = length [ 9 + index ] - 1 ; State -> Late . Delay [ index ] . Line = & State -> SampleBuffer [ totalLength ] ; totalLength += length [ 9 + index ] ; } } for ( index = 0 ; index < 4 ; index ++ ) { State -> Early . Offset [ index ] = ( ALuint ) ( EARLY_LINE_LENGTH [ index ] * Device -> Frequency ) ; State -> Late . ApOffset [ index ] = ( ALuint ) ( ALLPASS_LINE_LENGTH [ index ] * Device -> Frequency ) ; } for ( index = 0 ; index < State -> TotalLength ; index ++ ) State -> SampleBuffer [ index ] = 0.0f ; return AL_TRUE ; }
This updates the device-dependant reverb state.
This updates the device - dependant reverb state .
// All lines share a single sample buffer