#include "AudioIntResampler.h" AVM_BEGIN_NAMESPACE; template uint_t AudioIntResamplerMono::getBitsPerSample() const { return sizeof(T) * 8; } template uint_t AudioIntResamplerStereo::getBitsPerSample() const { return sizeof(T) * 8; } template void AudioIntResamplerMono::resample(void* out, const void* in, uint_t dest_len, uint_t src_len) { const T* src = (const T*) in; T* dest = (T*) out; double rate = src_len / (double) dest_len; double progress = 0; for (T* d = dest; d < &dest[dest_len * 2];) { *d++ = src[int(progress)]; progress += rate; } } template void AudioIntResamplerStereo::resample(void* out, const void* in, uint_t dest_len, uint_t src_len) { const T* src = (const T*) in; T* dest = (T*) out; double rate = src_len / (double) dest_len; double progress = 0; for (T* d = dest; d < &dest[dest_len * 2];) { *d++ = src[int(progress) * 2]; *d++ = src[int(progress) * 2 + 1]; progress += rate; } } // explicitly create implementation for these types // we have only one piece of the code for all these type template class AudioIntResamplerStereo; template class AudioIntResamplerStereo; template class AudioIntResamplerStereo; template class AudioIntResamplerMono; template class AudioIntResamplerMono; template class AudioIntResamplerMono; /* static int multiply(char* dest, const char* src, uint_t src_size, int rate, int samplesize); if this would be useful or there will be free time reimplement this here correctly int AudioQueue::multiply(char* dest, const char* src, uint_t src_size, int rate, int samplesize) { Debug cout << "AudioQueue: multiply" << endl; unsigned i; switch(rate*16+samplesize) { case 0x21: for(i=0; i