Please help me make up my mind.
- Allocate at the start of the application, free at the exit.
- Allocate when streaming starts, free as soon as streaming stops.
Which one? Why?
In case it matters: it's a voice communication application like Ekiga. I'm allocating the buffers with DSSCL_N开发者_StackOverflow中文版ORMAL (the 8bit 22KHz limitation is false as far as I've tested).
Since sound is CRITICAL to your application you should initialise it as soon as you are capable of displaying errors to the user. Otherwise you're making people wait through a startup sequence for an application they can't use.
On the other hand, if the ability to allocate is dependent on user settings then you should obviously allow them to reach the settings prior to doing something that could crash the application.
精彩评论