loading songs in to memory for playback

Discuss Play, an open source multi-format audio player.
Post Reply
bmckenney
Posts: 4
Joined: Tue Jan 19, 2010 4:06 am

loading songs in to memory for playback

Post by bmckenney » Thu Jan 28, 2010 8:55 pm

Is there a way to have a music file be completely loaded in to memory for starting playback? I know there is advanced settings for buffer slice settings but I have no idea what the values actually change. Could not find any content in the help either.

Bryan

dkagedal
Posts: 18
Joined: Tue Oct 28, 2008 3:13 pm

Re: loading songs in to memory for playback

Post by dkagedal » Fri Jan 29, 2010 12:02 am

Can you tell us what you actually want. What is the problem you are trying to solve? And why do you think that loading a file into memory would help?

And exactly what to you mean by loading a file into memory?

bmckenney
Posts: 4
Joined: Tue Jan 19, 2010 4:06 am

Re: loading songs in to memory for playback

Post by bmckenney » Fri Jan 29, 2010 12:18 am

I was using an evaluation of Pure Vinyl which has a feature that loads each song in to memory before starting playback so it does not read from disk while playing, does not have I/O conflicts etc. I thought PV sounded better this way and I'd like to try it with Play. Its not an issue I'm trying to address, its a possible audio playback performance tweak.

User avatar
sbooth
Site Admin
Posts: 2445
Joined: Fri Dec 23, 2005 7:45 am
Location: USA
Contact:

Re: loading songs in to memory for playback

Post by sbooth » Fri Jan 29, 2010 2:00 am

This isn't something that you can really accomplish in the current version without a ton of source hacking.

In the future this may be possible, though.

bmckenney
Posts: 4
Joined: Tue Jan 19, 2010 4:06 am

Re: loading songs in to memory for playback

Post by bmckenney » Fri Jan 29, 2010 2:08 am

sbooth wrote:This isn't something that you can really accomplish in the current version without a ton of source hacking.

In the future this may be possible, though.
What are the advanced settings for then? I'm curious.

Bryan

User avatar
sbooth
Site Admin
Posts: 2445
Joined: Fri Dec 23, 2005 7:45 am
Location: USA
Contact:

Re: loading songs in to memory for playback

Post by sbooth » Fri Jan 29, 2010 5:31 am

The advanced settings affect how much of a song is buffered into memory. However, the typical buffer sizes are on the size of msec. Attempting to set them to a size that would contain an entire track's worth of audio would probably cause some issues.

A much better approach would be to mmap() the file in the decoder and just have reads from the decoder copy from memory to memory. This would preserve some of the architecture and be very fast (this is the hacking I was referring to).

dkagedal
Posts: 18
Joined: Tue Oct 28, 2008 3:13 pm

Re: loading songs in to memory for playback

Post by dkagedal » Sat Jan 30, 2010 11:29 am

You would need an mlock() as well, otherwise it would work basically just like a read, but with a more convenient API.

But I still don't know what the difference is supposed to be. How would "I/O conflicts" affect the sound? If you get audio dropouts (buffer underruns) t is of course a problem, but I saw no indication of that from the OP. As long as the data is available when it is needed, it shouldn't make any difference how and when it got there.

Or is it the noise from the disk drive that is the problem?

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests