基于对话框的应用程序中的DirectSound [英] DirectSound in a Dialog Based Application

查看:139
本文介绍了基于对话框的应用程序中的DirectSound的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我有一个简短的问题. (好吧,希望答案能像我的问题一样迅速,因为我确定自己在做蠢事.)

我有一个直接的声音应用程序,其运行效果与Windows控制台应用程序一样好,感觉,因为没有其他事情了.

我正在研究软件合成器,现在我已经厌倦了将值打入文本文件的烦恼.它是从头开始构建的减法器合成器.现在,我需要支持旋钮,滑块等来修改声音.

这是下坡的地方.

在控制台应用程序中等待通知效果很好,但是在线程应用程序,它将永远等待.我知道MsgWaitForMultipleObjects,但它只是失败了,我没有正确地更新流缓冲区.

我''是基于对话框的Windows编程的完整菜鸟,所以如果有人有一些等待DirectSound缓冲区通知的示例代码使用基于对话框的应用程序,我将非常感激.

如果您想要源代码,我不介意提供它,我只是想知道是否有人可以共享给我的主循环会触发

先谢谢.

Hi,
I have a quick question. (well, hopefully the answer is as quick as my question as I''m sure I''m doing something dumb.)

I have a direct sound application that runs just fine as a windows console app which makes sense because there is nothing else going on.

I''m working on a software synth and have gotten to the point where I grow weary of punching in values to a text file. It''s a subtractor synth built from scratch. I now need to support knobs, sliders, etc.. to modify my sounds.

This is where things go downhill.

Waiting on notifications in my console app works just fine, but in the threaded app it waits forever. I know about MsgWaitForMultipleObjects but it just falls through and I dont'' update my streaming buffers correctly.

I''m a complete noob at dialog based windows programming so if someone has some example code of waiting for directsound buffer notifications with dialog based apps I''ll be very thankful.

If you want source code I don''t mind providing it, I just figured if someone had a main loop that they could share with me it would trigger a spark in my mind.

Thanks in advance.

推荐答案

calducciano写道:
calducciano wrote:

我知道MsgWaitForMultipleObjects,但是它只是掉入了

I know about MsgWaitForMultipleObjects but it just falls through



但是返回什么代码?这就是告诉您是否a)有消息要处理,或者b)您的一个句柄已发出信号!

对于诸如音频之类的东西,我本以为您会想要处理音频的专用线程,并使用PostMessage(音频线程-> UI线程)和事件与UI线程通信? (UI线程->音频线程).但是我可能完全错了-我从没真正看过DirectSound :)

BTW-这样做



But with what return code? That''s what tells you if you a) have a message to process, or b) one of your handles has been signalled!

For something like audio, I''d have thought you''d want a dedicated thread handling the audio, communicating with the UI thread using PostMessage (audio thread -> UI thread) and events? (UI thread -> audio thread). But I could be completely wrong - I''ve never really looked at DirectSound :)

BTW - does this CP article help[^] any? It''s got a dialog with sliders and it talks about DirectSound :)


这篇关于基于对话框的应用程序中的DirectSound的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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