Is it normal to take up to 2 seconds to run this function? It takes about 0.5 to 2.5 seconds, rarely more than 1 second though, usually around 开发者_Go百科0.6 to 0.9 seconds.
Just wondering, if i could speed this up somehow, perhaps remembering the device name from the first run or something?
These methods are usually slow since they're probably handling the initialization of the device, etc.
My guess is that this method is slow mostly because of the operating system.
The usual workarounds these types of methods is doing them asynchronously (in a background thread) and displaying a "Loading" text/image. You should also cache the pointer that alcOpenDevice() returns too so you don't pay the price of calling it over and over again.
精彩评论