1

I have an application that feeds audio data to a FTDI device via the D2XX interface. It works perfectly while my application has focus, and uses very little CPU (5%). But when I hammer the CPU (by switching to other applications, or heavy drawing) sometimes I can produce a stutter in the audio.

I tried many things to prevent this (Process/Thread priorities to real-time, MMCSS scheduling, etc), but it still occurs sometimes.

Is there any other way left to raise priorities, or is it impossible without writing a kernel driver?

4

3 回答 3

0

增加为设备服务的线程的优先级,或增加(如果可能的话)与设备通信的缓冲区大小。

windows内任务切换的最短时间为10ms。如果您的线程没有按时处理来自设备的数据,您就会出现口吃和音频中断。

于 2012-02-28T21:10:39.660 回答
0

如果您将进程(不是线程)优先级设置为“实时”,则其线程应始终在来自其他非实时进程的线程之前运行。所以我认为这是你能做的最好的。

但是只有在绝对必要时才应该使用实时进程优先级,因为它会导致整个系统变得无响应。

于 2012-02-28T21:06:08.187 回答
-1

您可能需要考虑使用 .net 4.0 的并行编程可能性。当你创建一个任务工厂并让工作由多个并行线程完成时,分配的 cpu % 会更高。

于 2012-02-28T20:48:21.823 回答