EmulationStation icon indicating copy to clipboard operation
EmulationStation copied to clipboard

[Feature Request] Add background music to ES

Open 5schatten opened this issue 7 years ago • 13 comments

Well I was wondering if it's possible to adopt this commit to the RetroPie fork of ES?

https://github.com/recalbox/recalbox-emulationstation/commit/f149f34430c86158372d4e2d85ae4f0485ac49ab "added ogg and mp3 bg music support with sdlmixer"

It would be nice if we could set some sort of bgm while browsing the games.

5schatten avatar Sep 08 '18 13:09 5schatten

Isn't BGM already supported on RetroPie now or no?

slappymcphee avatar Sep 25 '18 15:09 slappymcphee

I don't use RetroPie but the ES fork. I thought if the screensaver can play some music the normal game browser could do this as well

5schatten avatar Sep 25 '18 15:09 5schatten

the only way to invoke BGM is to have a standalone application installed to do so like mpg123 and then invoke it via code that you write. for example modifying the autostart.sh script used with RetroPie. one of the issues with this is that you can install RetroPie or ES on various platforms and the different platforms might need a different audio application to be able to execute the process. There are a couple of popular ways that it is being done on Linux which is a manual install/configuration of code and then there is a python script package that someone devised. My suggest is you YouTube Floob and watch his video on how to add it the "old fashioned" way so that you get a better understanding and could possibly do it for your own personal build.

slappymcphee avatar Sep 25 '18 16:09 slappymcphee

Well thats not what I mean. Since ES has meanwhile a "full" featured audio section and plays background music while showing some screensaver pictures IMHO it should be possible to play some music too while browsing the games without any additional script. Of course it would make sense to add mpg123 support or ogg or flac to play some compressed music files too.

I don't think about some crazy music player options just chose one file and play it in the background.

5schatten avatar Sep 26 '18 21:09 5schatten

I have a patch for this fully programmed in a new build that I'm writing for the rock64 / rockbox. The code should work on any platform, as nothing in it is specific to that platform. It uses sdl2mixer.

The master branch has an error that kills ES anytime the user tries to exit the audio settings menu so I can't properly test the new music volume slider, so I've re-written my patch to apply to the stable branch instead. Everything works really well. If someone fixes the master branch I'll actually be able to submit a pull request for it.

I've embedded all the new features directly into AudioManager, rather than introducing new files. It pauses the music and releases the resources when games start and then resumes playback where it left off when the games are exited. I've got a default path for mp3s in the code but have added the ability to override the path in the settings file or pull it from the theme's xml as well.

mrfixit2001 avatar Oct 09 '18 03:10 mrfixit2001

@mrfixit2001

I had the same problem -> it crashed when no AudioCard was set. After setting it to default it worked for me. Of course it does not fix the underlaying problem.

https://github.com/5schatten/LibreELEC.tv/commit/d70b1700c4e7999ade67e883c76b3b8e7e7c891c

5schatten avatar Oct 11 '18 00:10 5schatten

@5schatten - thanks for that! I hope it helps the devs over here at emulationstation get to the bottom of what's happening. Hopefully one of them comments back on this thread that it's fixed so I can submit a proper pull request. For now, my build is happy with the stable branch + background music :) I also changed it so the system volume and music volume are saved to es_settings so the user doesn't need to keep resetting them after a reset.

mrfixit2001 avatar Oct 11 '18 00:10 mrfixit2001

@mrfixit2001 Do you have a branch where we could have a look at your PR? Or can you rebase it for upstream code?

5schatten avatar Oct 14 '18 09:10 5schatten

Absolutely, I will work thru a rebase on this particular patch against master branch and submit a pull request when I have some time. I've got other fixes and enhancements in my environment as well, such as making the menu loop (hitting up on the top menu option goes to the bottom and vice versa) so I don't want to accidentally end up with any of those other changes in the background music PR.

mrfixit2001 avatar Oct 17 '18 20:10 mrfixit2001

Looping would be pretty neat too! It's annoying to scroll up & down every time :)

5schatten avatar Oct 21 '18 12:10 5schatten

@mrfixit2001 Any progress about adding your features to upstream code? :-)

5schatten avatar Nov 15 '18 12:11 5schatten

Please have it tested with PowerSaver modes. If you are using ES's mixer elements then PowerSaver modes will cause the music to halt. Set PS mode to disabled if music is enabled.

hex007 avatar Nov 15 '18 15:11 hex007

On the board I've written the patch for, it doesn't currently suspend/resume (yet), so I can't test that. I am using SDL2Mixer, which I've had to add to cmake, and I've updated the way SDL audio is initialized. I can at least confirm that when sitting idle, the default screensaver dims the display and the music continues. I have not yet had a chance to rebase against master. When will we be expecting an update to the stable branch?

mrfixit2001 avatar Nov 20 '18 02:11 mrfixit2001