Changeset 4261:0297d7c6a24c in roaraudio for libroardsp


Ignore:
Timestamp:
08/27/10 04:57:26 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

fixed 1->n, n->1 channels problem in 32 bit mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroardsp/convert.c

    r4129 r4261  
    237237   } 
    238238  break; 
     239  case 32: 
     240   switch (from) { 
     241    case 1: 
     242     switch (to) { 
     243      default: return roar_conv_chans_1ton32(out, in, samples, to); 
     244     } 
     245     break; 
     246    default: 
     247     switch (to) { 
     248      case  1: return roar_conv_chans_nto132(out, in, samples, from); 
     249      default: return -1; 
     250     } 
     251   } 
     252  break; 
    239253  default: return -1; 
    240254 } 
     
    281295} 
    282296 
     297int roar_conv_chans_1ton32 (void * out, void * in, int samples, int to) { 
     298 int32_t * ip = (int32_t*) in, * op = (int32_t*) out; 
     299 int i; 
     300 int c; 
     301 
     302 for (i = samples - 1; i >= 0; i--) 
     303  for (c = to - 1; c >= 0; c--) 
     304   op[i*to + c] = ip[i]; 
     305 
     306 return 0; 
     307} 
     308 
    283309int roar_conv_chans_1to216 (void * out, void * in, int samples) { 
    284310 int16_t * ip = (int16_t*) in, * op = (int16_t*) out; 
     
    328354int roar_conv_chans_nto116 (void * out, void * in, int samples, int from) { 
    329355 int16_t * ip = (int16_t*) in, * op = (int16_t*) out; 
     356 int i; 
     357 int c; 
     358 register int s; 
     359 
     360 samples /= from; 
     361 
     362 for (i = 0; i < samples; i++) { 
     363  s  = 0; 
     364 
     365  for (c = 0; c < from; c++) 
     366   s += ip[i*from + c]; 
     367 
     368  s /= from; 
     369  op[i] = s; 
     370 } 
     371 
     372 return 0; 
     373} 
     374 
     375int roar_conv_chans_nto132 (void * out, void * in, int samples, int from) { 
     376 int32_t * ip = (int32_t*) in, * op = (int32_t*) out; 
    330377 int i; 
    331378 int c; 
Note: See TracChangeset for help on using the changeset viewer.