如何处理声卡缓冲区
我正在尝试做一个屏幕闪烁应用程序,根据音频闪烁屏幕(就像音频可视化工具,但不是像条形图或类似的东西那样的可视化,只是闪烁屏幕)。
我已经制作了音乐播放器,并且知道如何使小部件全屏显示并更改颜色(它将闪烁),但我不知道如何检测(我认为它是声卡)缓冲区已满,因为当它已满时我会改变小部件的颜色,这会非常快,所以屏幕闪烁得非常快。 关于如何检测缓冲区是否已满的任何想法,或者我可能采取的任何其他方法来实现我的目标?
预先感谢。
Im trying to do a screen-flashing application that flashes the screen depending on the audio(like an audio visualizer, but instead of a visualization like bars or something like that, just flash the screen).
I already made the music player and know how to make the widget get full screen and change color(which will flash), but I dont know how to detect the (I think it's audio-card)buffer is full, because when it is full I would change the color of the widget, and this would be really super fast, so the screen flashes super quickly.
Any ideas on how to detect if the buffer is full, or any other approach I might pursue to achieve my goal?
Thanks beforehand.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您检查过 SoundMixer 类的computeSpectrum 方法吗?它不会为您提供缓冲区信息,而是返回有关正在播放的声音的信息,您可以使用这些信息以图形方式表示声音。
Have you checked the SoundMixer Class computeSpectrum method? It doesn't give you a buffer info rather it returns info about the sound being played that you can use in order to represent the sound graphically.