gpt4 book ai didi

audio - 开放性:获取源的当前播放位置

转载 作者:行者123 更新时间:2023-12-02 22:28:33 24 4
gpt4 key购买 nike

您如何获得公开来源的当前位置?我想我的意思是,音频经过您的缓冲区,openal的缓冲区,硬件缓冲区等后,当前在硬件中的哪个位置播放。

我对api进行了简要介绍,但是我不确定AL_SAMPLE_OFFSET / AL_BYTE_OFFSET / AL_SEC_OFFSET代表什么。如果我正在播放流媒体源,那么我似乎并没有获得一个不断增加的数字,似乎我正在当前的播放缓冲区中排名第一? (或所有缓冲区?)

例如,在播放时,我循环运行以下代码:

alGetSourcef( sources[0], AL_SAMPLE_OFFSET, &secoffset );
printf(" - %f samples\n", secoffset);

并得到
 - 0.000000 samples
- 8192.000000 samples
- 9216.000000 samples
- 5632.000000 samples

似乎并没有增加。

这是在具有最新xcode 4.3的macOS 10.7上,但是我假设它在其他平台上应该是相似的。

更新:

我尝试增加缓冲区的大小,实际上它看起来像是当前正在播放的缓冲区中的唯一当前位置:
 - 0.000000 bytes
- 18432.000000 bytes
- 20480.000000 bytes
- 36864.000000 bytes
- 36864.000000 bytes
- 55296.000000 bytes
- 55296.000000 bytes
- 73728.000000 bytes
refilling buffer 2408
re-queued buffer 2408
- 16384.000000 bytes
- 34816.000000 bytes
- 34816.000000 bytes
- 51200.000000 bytes
- 51200.000000 bytes
- 69632.000000 bytes
refilling buffer 2409
re-queued buffer 2409

因此,鉴于公开赛通过多个不同的缓冲区进行比赛,是否存在一种不错的跟踪方式?

最佳答案

这些偏移量是从排队缓冲区的开头开始的。您需要手动计算已经不排队的缓冲区的大小,然后添加到该数字中。

在这里,如果您阅读documentation,它在第40页上说:

The position is relative to the beginning of all the queued buffers for the source, and any queued buffers traversed by a set call will be marked as processed.

关于audio - 开放性:获取源的当前播放位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10160401/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com