Question

My issue is that I only hear sounds when I hit a breakpoint in debug and then resume. If I attempt otherwise I will not hear the sounds; even though everything appears to be playing. For example, onComplete callbacks get triggered at the correct time.

I have tried sprinkling Sleeps in the code to simulate the breakpoints, but it doesn't work.

This bug only occurs when I am using OpenGL for graphics. If I use GDI+ for graphics, then everything sounds fine.

DirectSound is the only sound implementation I have, so I have not tested with other sound packages.

I did find some info suggesting to disable Visual Studio Hosting Process, but I am using C++ which doesn't use the Visual Studio Hosting Process anyways.

Any help would be appreciated Thanks Les

Was it helpful?

Solution

The problem was the HWND used in DirectSound's SetCooperativeLevel(). I was fetching the HWND via GetForegroundWindow() right after finishing glutCreateWindow(). Instead, I had until the next tick to call GetForegroundWindow(), because until then the glut window was not actually created and the call to GetForegroundWindow() was actually referencing the shell window used in glut.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top