本文整理汇总了C++中AudioBuffer::size方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioBuffer::size方法的具体用法?C++ AudioBuffer::size怎么用?C++ AudioBuffer::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioBuffer
的用法示例。
在下文中一共展示了AudioBuffer::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
vagg_start(vagg_display_success);
RingBuffer<AudioBuffer, 2> buffer;
AudioBuffer a = {0.1, 0.2, 0.3, 0.4};
AudioBuffer b = {0.2, 1.2, 1.3, 2.4};
AudioBuffer c = {3.1, 8.2, 3.3, 3.4};
AudioBuffer d;
for(int i = 0; i < 10; i++) {
vagg_ok(! buffer.full(), "Not full.");
vagg_ok(buffer.empty(), "Empty.");
float raw[4] = {0.1, 0.3, 1.8, 4.2};
vagg_ok(buffer.push_raw(raw, 4), "Add a buffer on a not full RingBuffer.");
vagg_ok(! buffer.empty(), "Not full.");
vagg_ok(! buffer.full(), "Not empty.");
vagg_ok(buffer.push(b), "Add a buffer on a not full RingBuffer.");
vagg_ok(buffer.full(), "Should be full");
vagg_ok(! buffer.empty(), "Should not be empty");
vagg_ok(! buffer.push(c), "Add a buffer on a full RingBuffer.");
vagg_ok(buffer.full(), "Should be full");
vagg_ok(! buffer.empty(), "Should not be empty");
vagg_ok(buffer.pop(d), "Get a buffer back.");
vagg_bufeq((void*)&a.front(), a.size(),(void*)&d.front(), d.size(), "First buffer out should be equal to first buffer in.");
vagg_ok(! buffer.empty(), "Should not be empty");
vagg_ok(! buffer.full(), "Should not be full");
vagg_ok(buffer.pop(d), "Get another buffer back.");
vagg_ok(buffer.empty(), "Should be empty.");
vagg_ok(! buffer.full(), "Should not be full.");
vagg_bufeq((void*)&b.front(), b.size(),(void*)&d.front(), d.size(), "Second buffer out should be equal to second buffer in.");
vagg_ok(! buffer.pop(d), "Get a buffer back on an empty RingBuffer should not be possible.");
vagg_ok(buffer.empty(), "Should be empty.");
vagg_ok(! buffer.full(), "Should not be full.");
}
vagg_end();
return 0;
}
示例2: audioPlaybackFillWithVoice
size_t OpenSLLayer::audioPlaybackFillWithVoice(AudioBuffer &buffer)
{
RingBufferPool &mainBuffer = Manager::instance().getRingBufferPool();
size_t got = mainBuffer.getAvailableData(buffer, RingBufferPool::DEFAULT_ID);
buffer.resize(got);
buffer.applyGain(isPlaybackMuted_ ? 0.0 : playbackGain_);
if (audioFormat_.sample_rate != mainBuffer.getInternalSamplingRate()) {
DEBUG("OpenSLLayer::audioPlaybackFillWithVoice sample_rate != mainBuffer.getInternalSamplingRate() \n");
AudioBuffer out(buffer, false);
out.setSampleRate(audioFormat_.sample_rate);
resampler_->resample(buffer, out);
buffer = out;
}
return buffer.size();
}