Re: [AD] Optimizing slice_fclose()

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


al_fopen_slice has a mode argument that could be used to avoid this behavior. I filed https://github.com/liballeg/allegro5/issues/1283 to not forget about this; pull requests welcome.

-SL

On 8/28/21 8:35 PM, Karl Robillard wrote:
I have a program that streams .OGG files which are embedded in a larger file
package.   This requires the use of al_fopen_slice().  Now
al_load_audio_stream_f() will take ownership of the slice handle, but I must
still manage (i.e. close) the original file handle returned by al_fopen().

It may be more convenient for some use cases like this to have a file slice be
'single use' and close it's parent handle when the slice is closed.  Just
something to consider for the future.

So my code currently handles the 'master' file handle used by slices.  What
concerns me more is the overhead incurred by the seek done by slice_fclose().
I switch music streams by calling al_destroy_audio_stream() followed by
al_load_audio_stream_f() using a new slice.  For both the 'single use' and
'switch stream' case this extra seek is unwanted.  It would be ideal if there
were some flag that could be set via al_fopen_slice() to prevent this
unnecessary seek.


-Karl







Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/