コード例 #1
0
ファイル: Equ.cpp プロジェクト: BackupTheBerlios/musik
static REAL hn(int n,paramlist &param2,REAL fs)
{
  paramlistelm *e;
  REAL ret,lhn;

  lhn = hn_lpf(n,param2.elm->upper,fs);
  ret = param2.elm->gain*lhn;

  for(e=param2.elm->next;e->next != NULL && e->upper < fs/2;e = e->next)
    {
      REAL lhn2 = hn_lpf(n,e->upper,fs);
      ret += e->gain*(lhn2-lhn);
      lhn = lhn2;
    }

  ret += e->gain*(hn_imp(n)-lhn);
  
  return ret;
}
コード例 #2
0
ファイル: weqprocessor.cpp プロジェクト: ChurroV2/ElDorito
void WEqProcessor::_MakeEqTables(WEqProcessor *instance)
{

	int i;
	int j;
	int cires = instance->cur_ires;
	REAL *nires;

	REAL sum;
	REAL lhn1 ;
	REAL lhn2;
	REAL fs = (REAL) instance->c_nSampleRate;
	REAL fs2 = fs / 2.0;

	for(i = 0; i < instance->c_nNumberOfBands; i++)
		instance->c_eqParam[i].gain = pow(10.0 , (double) ((double) instance->c_nPreampGain / 1000.0 + (double) instance->c_eqParam[i].nGain / 1000.0) / 20.0);
	

	instance->c_eqParam[instance->c_nNumberOfBands - 1].upper = instance->c_nSampleRate;

	int fs2index;
	for(fs2index = 0; fs2index <  instance->c_nNumberOfBands;  fs2index++)
	{
		if(instance->c_eqParam[fs2index].upper >= fs2)
			break;
	}	



	// LEFT CHANNEL
	int n;
	for(i = 0; i < WinLen; i++)
	{
	
		n = i - WinLen / 2;
		sum = 0;
		lhn1 = 0;
		for(j = 0; j < fs2index; j++)
		{
			lhn2 = hn_lpf(n, instance->c_eqParam[j].upper, fs);
			sum += instance->c_eqParam[j].gain * (lhn2 - lhn1);
			lhn1 = lhn2;
		}

		sum += instance->c_eqParam[j].gain * (hn_imp(n) - lhn1);
		instance->irest[i] = sum * WinTable[i];
		
	}


	for( ; i < TabSize; i++)
		instance->irest[i] = 0;

	rdft(TabSize, 1, instance->irest, instance->c_bit_reversal, instance->c_cos_sin_table);
	nires = cires == 1 ? instance->lires2 : instance->lires1;

	for(i = 0; i < TabSize; i++)
		nires[i] = instance->irest[i];

	// USE SAME PARAMETERS FOR RIGHT CHANNEL, WE WILL NOT PROVIDE SEPARATE CHANNEL ADJUSTMENT

	nires = cires == 1 ? instance->rires2 : instance->rires1;

	for(i = 0; i < TabSize; i++)
		nires[i] = instance->irest[i];
 
	instance->chg_ires = cires == 1 ? 2 : 1;

}