本文整理汇总了C++中AudioBuffer::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioBuffer::reset方法的具体用法?C++ AudioBuffer::reset怎么用?C++ AudioBuffer::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioBuffer
的用法示例。
在下文中一共展示了AudioBuffer::reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mixBuffer
size_t
RingBufferPool::getData(AudioBuffer& buffer, const std::string& call_id)
{
std::lock_guard<std::recursive_mutex> lk(stateLock_);
const auto bindings = getReadBindings(call_id);
if (not bindings)
return 0;
// No mixing
if (bindings->size() == 1)
return (*bindings->cbegin())->get(buffer, call_id);
buffer.reset();
buffer.setFormat(internalAudioFormat_);
size_t size = 0;
AudioBuffer mixBuffer(buffer);
for (const auto& rbuf : *bindings) {
// XXX: is it normal to only return the last positive size?
size = rbuf->get(mixBuffer, call_id);
if (size > 0)
buffer.mix(mixBuffer);
}
return size;
}
示例2: fillWithToneOrRingtone
void JackLayer::fillWithToneOrRingtone(AudioBuffer &buffer)
{
buffer.resize(hardwareBufferSize_);
AudioLoop *tone = Manager::instance().getTelephoneTone();
AudioLoop *file_tone = Manager::instance().getTelephoneFile();
// In case of a dtmf, the pointers will be set to nullptr once the dtmf length is
// reached. For this reason we need to fill audio buffer with zeros if pointer is nullptr
if (tone) {
tone->getNext(buffer, playbackGain_);
} else if (file_tone) {
file_tone->getNext(buffer, playbackGain_);
} else {
buffer.reset();
}
}