Changeset 386:372958bba38d in roaraudio
- Timestamp:
- 08/06/08 14:55:54 (16 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroardsp/convert.h
r383 r386 27 27 28 28 29 int roar_conv_poly4_16 (int16_t * out, int16_t * in, size_t olen, size_t ilen); 29 int roar_conv_poly4_16 (int16_t * out, int16_t * in, size_t olen, size_t ilen); 30 int roar_conv_poly4_16s (int16_t * out, int16_t * in, size_t olen, size_t ilen, float step); 30 31 31 32 #endif -
libroardsp/convert.c
r385 r386 97 97 98 98 int roar_conv_rate_16 (void * out, void * in, int samples, int from, int to, int channels) { 99 if ( channels == 1 ) { 100 printf("roar_conv_rate_16(): samples=%i -> %i, rate=%i -> %i\n", samples*from/to, samples, from, to); 101 return roar_conv_poly4_16s((int16_t*) out, (int16_t*) in, samples, samples*from/to, (float)from/to); 102 // return roar_conv_poly4_16((int16_t*) out, (int16_t*) in, samples*to/from, samples); 103 } 104 99 105 return -1; 100 106 } … … 148 154 } 149 155 156 if ( from->rate != to->rate ) { 157 if ( roar_conv_rate(out, ip, samples, from->rate, to->rate, to->bits, from->channels) == -1 ) 158 return -1; 159 else 160 ip = out; 161 } 162 150 163 if ( from->channels != to->channels ) { 151 164 if ( roar_conv_chans(out, ip, samples, from->channels, to->channels, to->bits) == -1 ) … … 155 168 } 156 169 157 if ( from->rate != to->rate ) {158 if ( roar_conv_rate(out, ip, samples, from->rate, to->rate, to->bits, to->channels) == -1 )159 return -1;160 else161 ip = out;162 }163 164 170 if ( from->codec != to->codec ) 165 171 return -1; … … 171 177 172 178 int roar_conv_poly4_16 (int16_t * out, int16_t * in, size_t olen, size_t ilen) { 179 return roar_conv_poly4_16s(out, in, olen, ilen, (float)ilen/olen); 180 } 181 182 int roar_conv_poly4_16s (int16_t * out, int16_t * in, size_t olen, size_t ilen, float step) { 173 183 float poly[4]; 174 184 float data[4]; 175 185 float t = 0; 176 float step = (float)ilen/olen;177 186 int16_t * ci = in; 178 187 int io, ii = 0; 179 188 int i; 189 190 printf("step=%f\n", step); 180 191 181 192 // we can not make a poly4 with less than 4 points ;) … … 219 230 } 220 231 232 printf("io=%i\n", io); 233 221 234 return 0; 222 235 }
Note: See TracChangeset
for help on using the changeset viewer.