IAudioClient - 播放结束时收到通知? [英] IAudioClient - get notified when playback ends?

查看:79
本文介绍了IAudioClient - 播放结束时收到通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不断向IAudioClient发送数据(GetBufferSize / GetCurrentPadding / GetBuffer / ReleaseBuffer),但我想知道音频设备何时播放我发送的最后一个数据。我不想假设播放器停止只是因为我将最后的
数据块发送到设备:它可能仍在播放缓冲数据。

I continuously send data to IAudioClient (GetBufferSize / GetCurrentPadding / GetBuffer / ReleaseBuffer), but I want to know when the audio device finishes playing the last data I sent. I do not want to assume the player stopped just because I sent the last chunk of data to the device: it might still be playing the buffered data.

我尝试使用IAudioClock / IAudioClock2检查硬件缓冲区位置,但从发送最后一个块的那一刻起它保持不变。

I tried using IAudioClock / IAudioClock2 to check the hardware buffer position, but it stays the same from the moment I send the last chunk.

我也没有在IMMNotificationClient和IAudioSessionNotification接口中看到任何相关信息......

I also don't see anything relevant in the IMMNotificationClient and IAudioSessionNotification interfaces...

我缺少什么?

谢谢!











Dmitry Streblechenko(MVP)

Dmitry Streblechenko (MVP)
http://www.dimastr.com/redemption
Redemption - what the Outlook
Object Model should have been
Version 5.5 is now available!

推荐答案

获得"最后一滴"的方法超出有限的流是要执行以下操作:

The way to get the "last drop" out of a finite stream is to do the following:


  1. 正常使用IAudioRenderClient :: GetBuffer / ReleaseBuffer来播放所有真实内容
  2. 当你的实际内容用完时,继续使用IAudioRenderClient :: GetBuffer / ReleaseBuffer,但是传递

    AUDCLNT_BUFFERFLAGS_SILENT
    标志在ReleaseBuffer调用上观看IAudioClock :: GetPosition以查看扬声器的内容
  3. 当IAudioClock :: GetPosition显示所有真实内容都已播放,并且Windows已经转移到静音时,现在可以安全使用调用IAudioClient :: Stop。
  1. Use IAudioRenderClient::GetBuffer/ReleaseBuffer as normal to play all of the real content
  2. When you run out of real content, continue to use IAudioRenderClient::GetBuffer/ReleaseBuffer, but pass the AUDCLNT_BUFFERFLAGS_SILENT flag on the ReleaseBuffer call to tell the engine to insert silence
  3. Watch IAudioClock::GetPosition to see what is coming out of the speakers
  4. When IAudioClock::GetPosition shows that all of the real content has played, and Windows has moved on to the silence, it is now safe to call IAudioClient::Stop.


这篇关于IAudioClient - 播放结束时收到通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆