RetroPie / EmulationStation

A Fork of Emulation Station for RetroPie. Emulation Station is a flexible emulator front-end supporting keyboardless navigation and custom system themes.
Other
854 stars 344 forks source link

[Feature Request] Add background music to ES #481

Open 5schatten opened 6 years ago

5schatten commented 6 years ago

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.

slappymcphee commented 5 years ago

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

5schatten commented 5 years ago

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

slappymcphee commented 5 years ago

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.

5schatten commented 5 years ago

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.

mrfixit2001 commented 5 years ago

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.

5schatten commented 5 years ago

@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

mrfixit2001 commented 5 years ago

@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.

5schatten commented 5 years ago

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

mrfixit2001 commented 5 years ago

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.

5schatten commented 5 years ago

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

5schatten commented 5 years ago

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

hex007 commented 5 years ago

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.

mrfixit2001 commented 5 years ago

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?