mmatyas / pegasus-frontend

A cross platform, customizable graphical frontend for launching emulators and managing your game collection.
http://pegasus-frontend.org
Other
1.25k stars 113 forks source link

Gapless Audio Playback #853

Open Danhanado opened 3 years ago

Danhanado commented 3 years ago

I currently have a list of music tracks I want to play for the title screen/attract mode and for browsing the games list. Some of these contain sample-perfect loop points; so when they reach the end of the track, they don't loop from the beginning but instead midways through the song to create a seemless infinite music track. QT has no way of reading the loop samples in the music's metadata and thus loops all files from start to finish everytime.

While this should be easily remedied on my part by splitting the intro and the looping segment into separate files, the main issue with QT is that upon a track reaching the end, instead of seamlessly playing the song from the last sample to the first or instantly playing the next file, it contains a brief moment of silence before it does anything, which completley ruins the music.

I would like to request that you please integrate some form of library/ability to seemlessly play audio files back to back (and if possible, taking loop samples into account)

I'm in the process of making a theme to suit arcade cabinets and a big part of the arcade experience is the flashy attract mode with sounds and music designed to entice you into playing. Having looping audio means you can decrease audio file size as the file only needs to hold the first loop of a track to be played infinitely.

The main library I know about is vgmstream, which has support for many different audio file types and supports gapless playback and sample point looping. VGMStream Another potential benefit of VGMStream would be the ability to parse through a game's files and be able to play them right from the frontend.

Cheers, Dan

mmatyas commented 3 years ago

Yeah, I've run into the gapless audio issue too, apparently they implemented this for videos, but not yet for audio files. The best would be to fix this on the Qt side, but the devs there happen to be in a transitory period and there probably won't be updates until the end of summer.

The idea of of a custom Multimedia backend did come up before (#347), but that's quite a big topic to both implement and maintain for all platforms. Similarly, audio support could be done too with some library (there's a fork of SDL_mixer which I'm sure supports loop points), but that too has to be implemented and maintained to work on all platforms, with regards to dependencies and program size and all that. VGMStream seems to be a possible choice too, though I'm not sure I want a frontend to have heavyweight abilities like parsing through a game's files without consent.

mmatyas commented 3 years ago

Looking into VGMStream a bit more, it seems to depend on FFMPEG too.

Danhanado commented 3 years ago

VGMStream seems to be a possible choice too, though I'm not sure I want a frontend to have heavyweight abilities like parsing through a game's files without consent.

The parsing through game files was just a potential theme use case, I don't think I used the right terms, I just meant directly accessing any vgm type file manually for playing

mmatyas commented 3 years ago

Oh okay then, just opening should be fine.