OpenGL cripples soundput.

This is very very puzzling.

I have a complete engine, using gl. And recently added sounds to my game. The result was very crackly sound.
I pinpointed the culprit as being the call to glDrawArrays(Using vertex buffer objects on a g5)…I removed this single line and sound is perfect.

This is using the fmod sound system. Music too suffers really bad…slowing down and crackling when anything is rendered.
So I downloaded bass.dll, an entirely differant sound api. End result? Exactly the same. As soon as I uncomment the drawArrays line the sound crackles and distorts.

Both apis were I believe taking advantage of Direct3D sound. Except of course the music playback, which may have just been normal directSound.(In fmod)

The app manages well over 100fps with rendering on, and so shouldn’t be causing any cpu hit as vertexbuffer objects use agp/vid mem.
I have nvidia 60 series drivers, geforce 5-5600xt if that makes any difference, using a soundBlaster PCI 16 on windows XP. 800mhz cpu, 396mb ram.

Hiding the terrain, also cleans the sound up.
The terrain is just a static 17,000 poly mesh…
And it’s all silky smooth with it being rendered…so I don’t see how…it’s almost like the gpu is draining the sound card…

The plane mesh is still being rendered using an identical method to the above, so it appears to be another problem…

I have a 300watt psu, and have all my cd-drives/floppy drives removed, so it’s only powering the mobo/gpu/spu and a single usb modem, and 1 hard-drive.

The plot thickens.

I put in some code that let me scale how many triangles gldraw arrays(Using vertex buffer objects) actuall draws. And as I scale up, the crackle increases, as I scale down it decreases until it disappears.

I put the terrain through the display list pipeline, and the crackle again was gone(plus 44fps faster than vertex buffer objects)…so it appears it’s a definite bug…could buggy drivers do this? I’m using the latest beta drivers…it’s just such a wierd thing…

I have nvidia 60 series drivers
Well, the current official nVidia drivers are 56.72. Try them.

How do stand-alone music players behave?

Just installed official drives. 60.82 this time.(, and same deal.

Everything else runs fine. The exact same scene runs fine without sound distortions if I use a display list instead of vertex buffer objects. yet the problem scales with the amount of polys the vertex buffers are pushing…so it appears to be a definite bug in nvidia cards/drivers…or at the very least a hardware problem in mine.

Someone tried it on a ATI9800 and the problem wasn’t there, so it’s definitely either a nvidia problem or my machine, not the code imo.

It could be the drivers. Try version 53.03.

A few things could be going wrong.

You’re not saying what your sound hardware is. It could be some built-in thing that gets confused when bus traffic is high. It’s not very likely, but possible.

Second, it could be some device that is sensitive to how quickly it can get an interrupt through to the hardware, and a large vertex array may disable interrupts for a long-ish period of time. However, sound cards seldom need interrupts more often than every 10 milliseconds, so it doesn’t sound entirely likely.

It could be some assumption in the software that plays the sound, such as being able to fill a buffer from within an “empty” callback. If you can set the priority of the sound threads, the priority should be significantly higher than for regular graphics. Ideally, real time priority.

Last, it may be that the graphics card does fast synchronization on the bus by delaying a transaction until some event has completed, rather than doing asynchronous interrupt notification. Matrox cards used to be know for this, but I think all vendors do it, because it leads to better benchmarks. The problem is that sound cards with very small FIFOs (a few samples, say) that bus master data on an as-needed basis, will be starved of data, and crackle (as well as play slightly slower overall).

My guess is that it’s the last thing, which is hard to work around without a specific option in the graphics control panel to turn off this behavior, or installing a new sound card with better bus mastering FIFOs.

I have a soundblaster 16 pci.(true pci card, not on board) which although not new, does work perfectly well with anything I throw at it.

So although the last of your suggestions sounds like the most likely, I’m not entirely sure, as wouldn’t then any high-spec 3d game cause the same problems? Even games like Pandora’s tomorrow run fine(Both graphically and sound wise) even with details set to high…

And more to the point, the terrain is only 17,000 polys. The engine can manage scenes of 1.2 million polys at 15fps, so 17,000 is very very small.(1.2 million using vertex buffer objects…never had sound in those demos though)

Also, I was under the impression vertex buffer objects are created in agp/vid memory, which means other than the cpu telling the gpu to render ‘buffer’ so and so, there is no data to send over agp is there? (I preload mesh data, never updated ‘in game’)

And it seems to start to cracke at anything over 1000 tris(a rough guess going by what I can see on screen.)…

what makes me believe it’s not a simple soundapi error is because fmod and bass use entirely differant code, so it’s very unlikely(imo) a bug was reproduced indentically both times…unless I’m a natural born idiot…(Jury’s still out on that one. :slight_smile: )

Fmod and Bass may use different code but they are using the same driver. Try sticking a different sound card in your PC and see what happens. (Or upgrading the driver - if there are any upgrades…)

The games you have that run OK may not use the same mechanism to draw their geometry as what you are using, and there may be some issue with DrawArrays()/VBO’s and the SB16 card. One thing you could look at is if your sound card is sharing an Interrupt with anything else.