Hello dear All,
Now I'm writing an app that have to react on some user's actions in real time and redraw a big form according to this activity and a timer's firing. Also, when redrawing the form, the app must emit some short sounds. For the last purpose I used SoundPlayer class with its method Play(), that (due to the MSDN) must play a sound asynchronously. But the result seems as if SoundPlayer plays its sound just synchronously instead, so the user interface isn't updated until the sound is over. After numerous anguished experiments I have found out that the behavior depends on the form's DoubleBuffered property, and if I turn off double buffering, the problem disappears. But (as expected) then a problem of form flickering has appeared. So it seems that facilitation of graphic performance affects negatively sound performance, and vice versa. Possibly it because both double buffering and async sound playing apply to the thread pool simultaneously, that deteriorates general performance. But actually the form redrawing is a rather quick operation, and if I could wait the form being completely redrawn and then play sound it would be cool. Problem is that I haven't found any way how can I organize such waiting in my code. Does anybody have an idea about?