Fast seeking

Started by Ingolf,

Ingolf

I managed to get a file playing in reverse, but my buffer is very small so my app does a lot of file seeking, which gives me a cpu usage of like 50% on my 2.04ghz computer.

What is the best way to solve this? I thought of creating an internal buffer to store the data and read it from there or something. I checked out Ian's reverse code, but it looks to me like there is just a large buffer. I could be wrong.

Ian @ un4seen

The process of playing in reverse involves decoding a bit, reversing it, and then seeking back to do the next block. Using a smaller buffer obviously increases the number of times it has to stop/seek/start - that's more CPU used on the overhead, and not the actual decoding/reversing of the stream data.

So, in conclusion, use a larger buffer :) ... 2 seconds should be ok.

Note that the decoding/reversing buffer is not the same thing as the playback buffer... you can use a large buffer for decoding/reversing the data, and still use a small buffer length for playback.

Ingolf

I understand, then I am doing the right thing. Thanks!

Richard_b

Is ians code for playing backwards available? Id love to see it and incorporate it in my code. Cheers


Richard_b

OK ..sadly Im a vb developer....soI dont get the code...can it be done in VB? Any ideas how I make it work?

Ingolf

Yeah I know how, but don't know VB, hehehe.

Richard_b

OK...does anyone else know how to make it work in VB????

Ian @ un4seen

You can use BASS_FX to do reversing... get it from the BASS page.

Richard_b

I could use Bass_fx....however....id love to be ablre to do it like the C code does in VB! Is there a VB example I could look at?