unsigned AudioDevice::bufStereo(Linear samples, unsigned count) { unsigned fill, index; Sample mbuf[80]; unsigned total = 0; if(is_stereo(info.encoding)) return putSamples(samples, count); while(count) { if(count < 80) fill = count; else fill = 80; for(index = 0; index < fill; ++ index) mbuf[index] = samples[index * 2] / 2 + samples[index * 2 + 1] / 2; total += putSamples(mbuf, fill); count -= fill; samples += (fill * 2); } return total; }
unsigned AudioDevice::bufMono(Linear samples, unsigned count) { unsigned fill, index; Sample sbuf[160]; unsigned total = 0; if(!is_stereo(info.encoding)) return putSamples(samples, count); while(count) { if(count < 80) fill = count; else fill = 80; for(index = 0; index < fill; ++ index) sbuf[index * 2] = sbuf[index * 2 + 1] = samples[index]; total += putSamples(sbuf, fill * 2); count -= fill; samples += fill; } return total; }
int32_t paWriter::putSample (DSPCOMPLEX v) { return putSamples (&v, 1); }