コード例 #1
0
ファイル: BASE.cpp プロジェクト: RTcmix/RTcmix
/* Computes the lengths for the 2x6 delays used in reverb, and determines
   the max number of elements needed for allocation, and computes a
   length for the tap delay line (m_tapsize).
*/
void BASE::get_lengths(long m_length)
{
   int i, j, max = 0;
   static const float delfac[2][6] = {		/* These determine the distribution */
	  {0.819, 0.918, 1.0, 1.11, 1.18, 1.279},
	  {0.811, 0.933, 0.987, 1.13, 1.21, 1.247}
   };

   for (i = 0; i < 2; ++i) {
	  for (j = 0; j < 6; ++j) {
		 int val = (int)(m_length * delfac[i][j] + 0.5); /* 2x6 diff. lengths */
		 int pval = close_prime(val, NPRIMES, primes);  /* all lengths primes */
		 Nsdelay[i][j] = pval;

		 /* the number of elements (max) for allocation */
		 max = (pval > max) ? pval : max;
	  }
   }
   /* extra to allow for varying taps dur to random tap */
   rvbdelsize = (int)(max * 1.2);

   double diag, maxdim, mindim, d1, d0;

   /* get the length for the main tape delay */

   d0 = Dimensions[0] - Dimensions[2];
   d1 = Dimensions[1] - Dimensions[3];
   maxdim = (d0 > d1) ? d0 : d1;
   mindim = (d0 > d1) ? d1 : d0;
   diag = hypot((3 * maxdim), mindim);
   m_tapsize = (int)(diag / MACH1 * SR + 32);
#ifdef DELAY_DEBUG
   printf("tap delay has length %d\n", (m_tapsize + 8));
#endif
}
コード例 #2
0
ファイル: RVB.cpp プロジェクト: eriser/rtcmix-android
/* Computes the lengths for the 2x6 delays used in reverb, and determines
   the max number of elements needed for allocation.
*/
void
RVB::get_lengths(long m_length)
{
   int i, j, max = 0;
   static float delfac[2][6] = {        /* These determine the distribution */
      {0.819, 0.918, 1.0, 1.11, 1.18, 1.279},
      {0.811, 0.933, 0.987, 1.13, 1.21, 1.247}
   };

   for (i = 0; i < 2; ++i) {
      for (j = 0; j < 6; ++j) {
         int val = (int)(m_length * delfac[i][j] + 0.5); /* 2x6 diff. lengths */
         int pval = close_prime(val, NPRIMES, primes);  /* all lengths primes */
         Nsdelay[i][j] = pval;

         /* the number of elements (max) for allocation */
         max = (pval > max) ? pval : max;
      }
   }
   /* extra to allow for varying taps dur to random tap */
   rvbdelsize = (int)(max * 1.2);

}