Changeset 626:f7076b318cdf in roaraudio


Ignore:
Timestamp:
08/20/08 13:09:58 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Added roar_conv_chans_nto18()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroardsp/convert.c

    r624 r626  
    5757 } else if ( to == 1 ) { 
    5858  if ( bits == 8 ) { 
    59    return -1; 
     59   return roar_conv_chans_nto18(out, in, samples, from); 
    6060  } else if ( bits == 16 ) { 
    6161   return roar_conv_chans_nto116(out, in, samples, from); 
     
    8888  for (c = to - 1; c >= 0; c--) 
    8989   op[i*to + c] = ip[i]; 
     90 
     91 return 0; 
     92} 
     93 
     94int roar_conv_chans_nto18  (void * out, void * in, int samples, int from) { 
     95 int8_t * ip = (int8_t*) in, * op = (int8_t*) out; 
     96 int i; 
     97 int c; 
     98 register int s; 
     99 
     100 samples /= from; 
     101 
     102 for (i = samples - 1; i >= 0; i--) { 
     103  s  = 0; 
     104 
     105  for (c = 0; c < from; c++) 
     106   s += ip[i*from + c]; 
     107 
     108  s /= from; 
     109  op[i] = s; 
     110 } 
    90111 
    91112 return 0; 
Note: See TracChangeset for help on using the changeset viewer.