Lines Matching defs:pReverbData
81 S_REVERB_OBJECT *pReverbData;
86 pReverbData = EAS_CMEnumFXData(EAS_MODULE_REVERB);
90 pReverbData = EAS_HWMalloc(pEASData->hwInstData, sizeof(S_REVERB_OBJECT));
92 if (pReverbData == NULL)
99 EAS_HWMemSet(pReverbData, 0, sizeof(S_REVERB_OBJECT));
101 ReverbReadInPresets(pReverbData);
103 pReverbData->m_nMinSamplesToAdd = REVERB_UPDATE_PERIOD_IN_SAMPLES;
105 pReverbData->m_nRevOutFbkR = 0;
106 pReverbData->m_nRevOutFbkL = 0;
108 pReverbData->m_sAp0.m_zApIn = AP0_IN;
109 pReverbData->m_sAp0.m_zApOut = AP0_IN + DEFAULT_AP0_LENGTH;
110 pReverbData->m_sAp0.m_nApGain = DEFAULT_AP0_GAIN;
112 pReverbData->m_zD0In = DELAY0_IN;
114 pReverbData->m_sAp1.m_zApIn = AP1_IN;
115 pReverbData->m_sAp1.m_zApOut = AP1_IN + DEFAULT_AP1_LENGTH;
116 pReverbData->m_sAp1.m_nApGain = DEFAULT_AP1_GAIN;
118 pReverbData->m_zD1In = DELAY1_IN;
120 pReverbData->m_zLpf0 = 0;
121 pReverbData->m_zLpf1 = 0;
122 pReverbData->m_nLpfFwd = 8837;
123 pReverbData->m_nLpfFbk = 6494;
125 pReverbData->m_nSin = 0;
126 pReverbData->m_nCos = 0;
127 pReverbData->m_nSinIncrement = 0;
128 pReverbData->m_nCosIncrement = 0;
131 pReverbData->m_nXfadeInterval = (EAS_U16)REVERB_XFADE_PERIOD_IN_SAMPLES;
132 pReverbData->m_nXfadeCounter = pReverbData->m_nXfadeInterval + 1; // force update on first iteration
133 pReverbData->m_nPhase = -32768;
134 pReverbData->m_nPhaseIncrement = REVERB_XFADE_PHASE_INCREMENT;
136 pReverbData->m_nNoise = (EAS_I16)0xABCD;
138 pReverbData->m_nMaxExcursion = 0x007F;
141 nOffset = ReverbCalculateNoise( pReverbData->m_nMaxExcursion,
142 &pReverbData->m_nNoise );
144 pReverbData->m_zD1Cross =
145 DELAY1_OUT - pReverbData->m_nMaxExcursion + nOffset;
147 nOffset = ReverbCalculateNoise( pReverbData->m_nMaxExcursion,
148 &pReverbData->m_nNoise );
150 pReverbData->m_zD0Cross =
151 DELAY1_OUT - pReverbData->m_nMaxExcursion - nOffset;
153 nOffset = ReverbCalculateNoise( pReverbData->m_nMaxExcursion,
154 &pReverbData->m_nNoise );
156 pReverbData->m_zD0Self =
157 DELAY0_OUT - pReverbData->m_nMaxExcursion - nOffset;
159 nOffset = ReverbCalculateNoise( pReverbData->m_nMaxExcursion,
160 &pReverbData->m_nNoise );
162 pReverbData->m_zD1Self =
163 DELAY1_OUT - pReverbData->m_nMaxExcursion + nOffset;
166 pReverbData->m_bUseNoise = EAS_FALSE;
169 pReverbData->m_bBypass = EAS_TRUE; //EAS_FALSE;
171 pReverbData->m_nNextRoom = 1;
173 pReverbData->m_nCurrentRoom = pReverbData->m_nNextRoom + 1; // force update on first iteration
175 pReverbData->m_nWet = REVERB_DEFAULT_WET;
177 pReverbData->m_nDry = REVERB_DEFAULT_DRY;
180 pReverbData->m_nBaseIndex = 0;
183 pReverbData->m_sEarlyL.m_nLpfFbk = 4915;
184 pReverbData->m_sEarlyL.m_nLpfFwd = 27852;
185 pReverbData->m_sEarlyL.m_zLpf = 0;
189 pReverbData->m_sEarlyL.m_nGain[i] = 0;
190 pReverbData->m_sEarlyL.m_zDelay[i] = 0;
194 pReverbData->m_sEarlyR.m_nLpfFbk = 4915;
195 pReverbData->m_sEarlyR.m_nLpfFwd = 27852;
196 pReverbData->m_sEarlyR.m_zLpf = 0;
200 pReverbData->m_sEarlyR.m_nGain[i] = 0;
201 pReverbData->m_sEarlyR.m_zDelay[i] = 0;
207 pReverbData->m_nDelayLine[i] = 0;
213 pPreset = &pReverbData->m_sPreset.m_sPreset[pReverbData->m_nNextRoom];
215 pReverbData->m_nLpfFbk = pPreset->m_nLpfFbk;
216 pReverbData->m_nLpfFwd = pPreset->m_nLpfFwd;
218 pReverbData->m_nEarly = pPreset->m_nEarly;
219 pReverbData->m_nWet = pPreset->m_nWet;
220 pReverbData->m_nDry = pPreset->m_nDry;
222 pReverbData->m_nMaxExcursion = pPreset->m_nMaxExcursion;
227 pReverbData->m_nXfadeInterval = (EAS_U16) temp;
230 pReverbData->m_sAp0.m_nApGain = pPreset->m_nAp0_ApGain;
235 pReverbData->m_sAp0.m_zApOut = (EAS_U16) (pReverbData->m_sAp0.m_zApIn + temp);
238 pReverbData->m_sAp1.m_nApGain = pPreset->m_nAp1_ApGain;
243 pReverbData->m_sAp1.m_zApOut = (EAS_U16) (pReverbData->m_sAp1.m_zApIn + temp);
248 *pInstData = pReverbData;
277 S_REVERB_OBJECT *pReverbData;
279 pReverbData = (S_REVERB_OBJECT*) pInstData;
282 if (pReverbData->m_bBypass ||
283 (pReverbData->m_nWet == 0 && pReverbData->m_nDry == 32767))
290 if (pReverbData->m_nNextRoom != pReverbData->m_nCurrentRoom)
292 ReverbUpdateRoom(pReverbData);
295 ReverbUpdateXfade(pReverbData, numSamples);
297 Reverb(pReverbData, numSamples, pDst, pSrc);
300 if (pReverbData->m_nUpdateCounter >= REVERB_MODULO_UPDATE_PERIOD_IN_SAMPLES)
303 pReverbData->m_nUpdateCounter = 0;
307 pReverbData->m_nUpdateCounter += (EAS_I16)numSamples;
328 static EAS_RESULT ReverbUpdateXfade(S_REVERB_OBJECT *pReverbData, EAS_INT nNumSamplesToAdd)
334 if (pReverbData->m_nXfadeCounter >= pReverbData->m_nXfadeInterval)
337 pReverbData->m_nXfadeCounter = 0;
341 if (pReverbData->m_nPhaseIncrement > 0)
344 pReverbData->m_nSin = 32767;
345 pReverbData->m_nCos = 0;
348 pReverbData->m_nPhase = 32767;
351 nOffset = ReverbCalculateNoise( pReverbData->m_nMaxExcursion, &pReverbData->m_nNoise );
353 pReverbData->m_zD1Cross =
354 DELAY1_OUT - pReverbData->m_nMaxExcursion + nOffset;
356 nOffset = ReverbCalculateNoise( pReverbData->m_nMaxExcursion, &pReverbData->m_nNoise );
358 pReverbData->m_zD0Cross =
359 DELAY0_OUT - pReverbData->m_nMaxExcursion - nOffset;
364 pReverbData->m_nSin = 0;
365 pReverbData->m_nCos = 32767;
368 pReverbData->m_nPhase = -32768;
371 nOffset = ReverbCalculateNoise( pReverbData->m_nMaxExcursion, &pReverbData->m_nNoise );
373 pReverbData->m_zD0Self =
374 DELAY0_OUT - pReverbData->m_nMaxExcursion - nOffset;
376 nOffset = ReverbCalculateNoise( pReverbData->m_nMaxExcursion, &pReverbData->m_nNoise );
378 pReverbData->m_zD1Self =
379 DELAY1_OUT - pReverbData->m_nMaxExcursion + nOffset;
381 } // end if-else (pReverbData->m_nPhaseIncrement > 0)
386 pReverbData->m_nPhaseIncrement = -pReverbData->m_nPhaseIncrement;
391 pReverbData->m_nPhase += pReverbData->m_nPhaseIncrement;
394 ReverbCalculateSinCos(pReverbData->m_nPhase, &tempSin, &tempCos);
398 pReverbData->m_nSinIncrement =
399 (tempSin - pReverbData->m_nSin) >> REVERB_UPDATE_PERIOD_IN_BITS;
402 pReverbData->m_nCosIncrement =
403 (tempCos - pReverbData->m_nCos) >> REVERB_UPDATE_PERIOD_IN_BITS;
407 pReverbData->m_nXfadeCounter += (EAS_U16) nNumSamplesToAdd;
525 static EAS_RESULT Reverb(S_REVERB_OBJECT *pReverbData, EAS_INT nNumSamplesToAdd, EAS_PCM *pOutputBuffer, EAS_PCM *pInputBuffer)
544 nBase = pReverbData->m_nBaseIndex;
551 nApIn = ((*pInputBuffer++)>>2) + pReverbData->m_nRevOutFbkR;
556 nAddr = CIRCULAR(nBase, pReverbData->m_sAp0.m_zApOut, REVERB_BUFFER_MASK);
557 nDelayOut = pReverbData->m_nDelayLine[nAddr];
560 nTemp1 = MULT_EG1_EG1(nApIn, pReverbData->m_sAp0.m_nApGain);
564 nTemp1 = MULT_EG1_EG1(nApOut, pReverbData->m_sAp0.m_nApGain);
568 nAddr = CIRCULAR(nBase, pReverbData->m_sAp0.m_zApIn, REVERB_BUFFER_MASK);
569 pReverbData->m_nDelayLine[nAddr] = (EAS_PCM) nTemp1;
572 nAddr = CIRCULAR(nBase, pReverbData->m_zD0In, REVERB_BUFFER_MASK);
573 pReverbData->m_nDelayLine[nAddr] = (EAS_PCM) nApOut;
580 nApIn = ((*pInputBuffer++)>>2) + pReverbData->m_nRevOutFbkL;
584 nAddr = CIRCULAR(nBase, pReverbData->m_sAp1.m_zApOut, REVERB_BUFFER_MASK);
585 nDelayOut = pReverbData->m_nDelayLine[nAddr];
588 nTemp1 = MULT_EG1_EG1(nApIn, pReverbData->m_sAp1.m_nApGain);
592 nTemp1 = MULT_EG1_EG1(nApOut, pReverbData->m_sAp1.m_nApGain);
596 nAddr = CIRCULAR(nBase, pReverbData->m_sAp1.m_zApIn, REVERB_BUFFER_MASK);
597 pReverbData->m_nDelayLine[nAddr] = (EAS_PCM) nTemp1;
600 nAddr = CIRCULAR(nBase, pReverbData->m_zD1In, REVERB_BUFFER_MASK);
601 pReverbData->m_nDelayLine[nAddr] = (EAS_PCM) nApOut;
607 nAddr = CIRCULAR(nBase, pReverbData->m_zD0Self, REVERB_BUFFER_MASK);
608 nDelayOut = pReverbData->m_nDelayLine[nAddr];
611 nTemp1 = MULT_EG1_EG1(nDelayOut, pReverbData->m_nSin);
614 nAddr = CIRCULAR(nBase, pReverbData->m_zD1Cross, REVERB_BUFFER_MASK);
615 nDelayOut = pReverbData->m_nDelayLine[nAddr];
618 nTemp2 = MULT_EG1_EG1(nDelayOut, pReverbData->m_nCos);
624 nTemp1 = MULT_EG1_EG1(nDelayOut, pReverbData->m_nLpfFwd);
626 nTemp2 = MULT_EG1_EG1(pReverbData->m_zLpf0, pReverbData->m_nLpfFbk);
630 pReverbData->m_zLpf0 = (EAS_PCM) SATURATE(nTemp1 + nTemp2);
636 nAddr = CIRCULAR(nBase, pReverbData->m_zD1Self, REVERB_BUFFER_MASK);
637 nDelayOut = pReverbData->m_nDelayLine[nAddr];
640 nTemp1 = MULT_EG1_EG1(nDelayOut, pReverbData->m_nSin);
643 nAddr = CIRCULAR(nBase, pReverbData->m_zD0Cross, REVERB_BUFFER_MASK);
644 nDelayOut = pReverbData->m_nDelayLine[nAddr];
647 nTemp2 = MULT_EG1_EG1(nDelayOut, pReverbData->m_nCos);
653 nTemp1 = MULT_EG1_EG1(nDelayOut, pReverbData->m_nLpfFwd);
655 nTemp2 = MULT_EG1_EG1(pReverbData->m_zLpf1, pReverbData->m_nLpfFbk);
659 pReverbData->m_zLpf1 = (EAS_PCM)SATURATE(nTemp1 + nTemp2);
665 pReverbData->m_nRevOutFbkL =
666 (EAS_PCM)SATURATE((EAS_I32)pReverbData->m_zLpf1 + (EAS_I32)pReverbData->m_zLpf0);
670 pReverbData->m_nRevOutFbkR =
671 (EAS_PCM)SATURATE((EAS_I32)pReverbData->m_zLpf1 - (EAS_I32)pReverbData->m_zLpf0);
676 //psEarly = &(pReverbData->m_sEarlyL);
684 nAddr = CIRCULAR(nBase, pReverbData->m_sEarlyL.m_zDelay[j], REVERB_BUFFER_MASK);
686 nDelayOut = pReverbData->m_nDelayLine[nAddr];
690 nTemp1 = MULT_EG1_EG1(nDelayOut, pReverbData->m_sEarlyL.m_nGain[j]);
698 nTemp1 = MULT_EG1_EG1(nEarlyOut, pReverbData->m_sEarlyL.m_nLpfFwd);
701 nTemp2 = MULT_EG1_EG1(pReverbData->m_sEarlyL.m_zLpf, pReverbData->m_sEarlyL.m_nLpfFbk);
707 pReverbData->m_sEarlyL.m_zLpf = (EAS_PCM) SATURATE(nTemp1 + nTemp2);
711 //tempValue = SATURATE(psEarly->m_zLpf + pReverbData->m_nRevOutFbkL);
712 tempValue = SATURATE((EAS_I32)pReverbData->m_sEarlyL.m_zLpf + (EAS_I32)pReverbData->m_nRevOutFbkL);
715 tempValue = MULT_EG1_EG1(tempValue, (pReverbData->m_nWet<<1));
723 //psEarly = &(pReverbData->m_sEarlyR);
730 nAddr = CIRCULAR(nBase, pReverbData->m_sEarlyR.m_zDelay[j], REVERB_BUFFER_MASK);
731 nDelayOut = pReverbData->m_nDelayLine[nAddr];
734 nTemp1 = MULT_EG1_EG1(nDelayOut, pReverbData->m_sEarlyR.m_nGain[j]);
741 nTemp1 = MULT_EG1_EG1(nEarlyOut, pReverbData->m_sEarlyR.m_nLpfFwd);
743 nTemp2 = MULT_EG1_EG1(pReverbData->m_sEarlyR.m_zLpf, pReverbData->m_sEarlyR.m_nLpfFbk);
747 pReverbData->m_sEarlyR.m_zLpf = (EAS_PCM)SATURATE(nTemp1 + nTemp2);
751 tempValue = SATURATE((EAS_I32)pReverbData->m_sEarlyR.m_zLpf + (EAS_I32)pReverbData->m_nRevOutFbkR);
754 tempValue = MULT_EG1_EG1(tempValue, (pReverbData->m_nWet << 1));
764 pReverbData->m_nSin += pReverbData->m_nSinIncrement;
765 pReverbData->m_nCos += pReverbData->m_nCosIncrement;
770 pReverbData->m_nBaseIndex = nBase;
914 static EAS_RESULT ReverbUpdateRoom(S_REVERB_OBJECT *pReverbData)
918 S_REVERB_PRESET *pPreset = &pReverbData->m_sPreset.m_sPreset[pReverbData->m_nNextRoom];
920 pReverbData->m_nLpfFwd = pPreset->m_nLpfFwd;
921 pReverbData->m_nLpfFbk = pPreset->m_nLpfFbk;
923 pReverbData->m_nEarly = pPreset->m_nEarly;
924 pReverbData->m_nWet = pPreset->m_nWet;
925 pReverbData->m_nDry = pPreset->m_nDry;
928 pReverbData->m_nMaxExcursion = pPreset->m_nMaxExcursion;
933 pReverbData->m_nXfadeInterval = (EAS_U16) temp;
935 pReverbData->m_sAp0.m_nApGain = pPreset->m_nAp0_ApGain;
940 pReverbData->m_sAp0.m_zApOut = (EAS_U16) (pReverbData->m_sAp0.m_zApIn + temp);
942 pReverbData->m_sAp1.m_nApGain = pPreset->m_nAp1_ApGain;
947 pReverbData->m_sAp1.m_zApOut = (EAS_U16) (pReverbData->m_sAp1.m_zApIn + temp);
950 pReverbData->m_nCurrentRoom = pReverbData->m_nNextRoom;
968 static EAS_RESULT ReverbReadInPresets(S_REVERB_OBJECT *pReverbData)
977 S_REVERB_PRESET *pPreset = &pReverbData->m_sPreset.m_sPreset[defaultPreset];