本文整理汇总了C++中FixedSizeQueue::pushPointers方法的典型用法代码示例。如果您正苦于以下问题:C++ FixedSizeQueue::pushPointers方法的具体用法?C++ FixedSizeQueue::pushPointers怎么用?C++ FixedSizeQueue::pushPointers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FixedSizeQueue
的用法示例。
在下文中一共展示了FixedSizeQueue::pushPointers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __AudioUpdate
// Mix samples from the various audio channels into a single sample queue.
// This single sample queue is where __AudioMix should read from. If the sample queue is full, we should
// just sleep the main emulator thread a little.
void __AudioUpdate() {
// Audio throttle doesn't really work on the PSP since the mixing intervals are so closely tied
// to the CPU. Much better to throttle the frame rate on frame display and just throw away audio
// if the buffer somehow gets full.
bool firstChannel = true;
for (u32 i = 0; i < PSP_AUDIO_CHANNEL_MAX + 1; i++) {
if (!chans[i].reserved)
continue;
__AudioWakeThreads(chans[i], 0, hwBlockSize);
if (!chans[i].sampleQueue.size()) {
continue;
}
if (hwBlockSize * 2 > chans[i].sampleQueue.size()) {
ERROR_LOG(SCEAUDIO, "Channel %i buffer underrun at %i of %i", i, (int)chans[i].sampleQueue.size() / 2, hwBlockSize);
}
const s16 *buf1 = 0, *buf2 = 0;
size_t sz1, sz2;
chans[i].sampleQueue.popPointers(hwBlockSize * 2, &buf1, &sz1, &buf2, &sz2);
if (firstChannel) {
for (size_t s = 0; s < sz1; s++)
mixBuffer[s] = buf1[s];
if (buf2) {
for (size_t s = 0; s < sz2; s++)
mixBuffer[s + sz1] = buf2[s];
}
firstChannel = false;
} else {
for (size_t s = 0; s < sz1; s++)
mixBuffer[s] += buf1[s];
if (buf2) {
for (size_t s = 0; s < sz2; s++)
mixBuffer[s + sz1] += buf2[s];
}
}
}
if (firstChannel) {
memset(mixBuffer, 0, hwBlockSize * 2 * sizeof(s32));
}
if (g_Config.bEnableSound) {
lock_guard guard(section);
if (outAudioQueue.room() >= hwBlockSize * 2) {
s16 *buf1 = 0, *buf2 = 0;
size_t sz1, sz2;
outAudioQueue.pushPointers(hwBlockSize * 2, &buf1, &sz1, &buf2, &sz2);
for (size_t s = 0; s < sz1; s++)
buf1[s] = clamp_s16(mixBuffer[s]);
if (buf2) {
for (size_t s = 0; s < sz2; s++)
buf2[s] = clamp_s16(mixBuffer[s + sz1]);
}
} else {
// This happens quite a lot. There's still something slightly off
// about the amount of audio we produce.
}
}
}