Largest buffer size

Started by Ingolf,

Ingolf

Hi there.

Every time my StreamProc is called, I allocate Length bytes of memory, and after it is done, I free it, which (I guess) takes a lot of cpu time. Without it, cpu usage goes down by 10 percent (?!)

Now I saw that BASS returns at most 200ms of data, which is I guess 17640 bytes in 44.1khz stereo 16 bits? Is it better to allocate a 200ms buffer, then use it all the time and then free it?

Thanks.


Ian @ un4seen

Sure it's better to allocate and reuse a single buffer. Less allocating is always nice :)

Ingolf

But then: is 200ms really enough? all the time?

Ian @ un4seen

Yes. Of course, if you change the sample rate, then the number of samples in 200ms changes too.

Ingolf

What I meant was: does BASS returns at most 200ms, or: have I read that correctly? It was a useless question really, because you wrote it in another thread. I just wanted to be sure that my app will work in all cases, on all computers, etc.

I know 200ms of mono data is less than 200ms of stereo data, or at a different samplerate or bitdepth... Of course.

Thanks.