Author Topic: Load audio file from archive always fully ?  (Read 128 times)

purenoise

  • Posts: 115
Load audio file from archive always fully ?
« on: 19 Aug '21 - 10:24 »
I see that XMPlay loads files in full before play, and
i expect it to to load only chunks needed for play,
like it does with direct/local file.

Looked for secret settings and not found needed option.

Thanks for suggestions.

Ian @ un4seen

  • Administrator
  • Posts: 23864
Re: Load audio file from archive always fully ?
« Reply #1 on: 19 Aug '21 - 14:15 »
Archived files are indeed fully decompressed into memory before playing. Unfortunately, there's no option to change that because the archive plugin system doesn't currently support random access/seeking, eg. seeking to the end requires fully decompressing. I don't think most archive formats allow random access anyway?
« Last Edit: 20 Aug '21 - 17:02 by Ian @ un4seen »

purenoise

  • Posts: 115
Re: Load audio file from archive always fully ?
« Reply #2 on: 20 Aug '21 - 08:04 »
Ok, now i'm looking into
theoretical solution with
BASS_StreamCreateFile using 'mem' combined
my app that will feed chunks into 'mem' vector:
 
 - will this work [ in theory] ?

Already tried "stdout pipe into XMPlay" - no go, but
plays partially written file[ my current workaround].

Thanks.

Ian @ un4seen

  • Administrator
  • Posts: 23864
Re: Load audio file from archive always fully ?
« Reply #3 on: 20 Aug '21 - 17:05 »
Are you trying to avoid pre-decompressing files to save memory or to same time? If it's to save memory then BASS_StreamCreateFile (with "mem") wouldn't help because you would still need to allocate memory for the entire file. You could perhaps only partially prefill that memory to save time but I'm not sure how you would know how much is needed (it will be different for different files/formats). BASS_StreamCreateFileUser (with STREAMFILE_BUFFER) is another option, which would allow streaming decompression (in the FILEREADPROC callback). Note you will need to implement the decompression yourself in both cases because XMPlay archive plugins don't support streaming. You also won't be able to use XMPlay/Winamp input plugins when using BASS to decode (you would use BASS plugins instead if needed).

purenoise

  • Posts: 115
Re: Load audio file from archive always fully ?
« Reply #4 on: 23 Aug '21 - 09:12 »
Are you trying to avoid pre-decompressing files to save memory or to same time? ...

Two things i want to achieve:

 1. Hear the sound as i press play
     [ Delay happens on each decompression, sometimes i have 150+mb .flac( s)
 2. Avoid unnecessary full decompression
     [ Sometimes 15seconds is enough, no need the rest]

I will experiment with BASS, and
using XMPlay for this cases as workaround.
Yes, i have a decompression workaround too, and
will try to feed this raw bytes as partially buffered file.

I have made a throttled decompression, so there is no rush
of data/speed, and can manage how much data is sufficient
to feed/play in small portions.

Thank you.
« Last Edit: 23 Aug '21 - 10:07 by purenoise »