コード例 #1
0
ファイル: stream.cpp プロジェクト: dyfet/ccaudio2
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;
}
コード例 #2
0
ファイル: stream.cpp プロジェクト: dyfet/ccaudio2
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;
}
コード例 #3
0
ファイル: pa-writer.cpp プロジェクト: JvanKatwijk/sdr-j-sw
int32_t	paWriter::putSample	(DSPCOMPLEX v) {
	return putSamples (&v, 1);
}