-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addition of the Jukebox #20418
Addition of the Jukebox #20418
Conversation
license of the music?? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, i have always wanted the jukebox, it gives a vibe to the bar y'know?, tho the implementation has some issues, but before that i got two questions for ya:
- Is this ported from some other fork? If so, do mention em
- Did you use AI to help you out in some places?
using Robust.Shared.Timing; | ||
namespace Content.Client.Jukebox; | ||
|
||
|
||
public sealed class JukeboxSystem : SharedJukeboxSystem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
using Robust.Shared.Timing; | ||
using Range = Robust.Client.UserInterface.Controls.Range; | ||
|
||
namespace Content.Client.Jukebox.UI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filescope your namespaces (this applies to the other files as well)
namespace Content.Client.Jukebox.UI | ||
{ | ||
[GenerateTypedNameReferences] | ||
public sealed partial class JukeboxMenu : DefaultWindow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it a FancyWindow
{ | ||
SendMessage(new JukeboxComponent.JukeboxPlayingMessage()); | ||
|
||
//var playing = !jukeboxComp.Playing; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
} | ||
|
||
[DataDefinition] | ||
public sealed partial class MusicListDefinition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont think this is really necessary? name can perfectly be a field in the component, path needs to be of ResPath
type, copyright is never used and cant you get the song lenght directly from the file or something?
Not only that, the prototype doenst seem necessary either, just use a SoundCollectionPrototype instead
video no load |
Nice |
This is not ported from any other fork. Working on the requested changes now. |
Does it work fine when you walk away so you wouldn't hear a sound and then return back? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm pretty sure we already have every song you added to the jukebox. in any case, just use the lobby music and the space ambience instead of adding new tracks
The lobby music and ambience are stereo audio files. Trying to play a stereo audio file as a location-based audio causes a crash. |
Also, I learned fairly recently that there are going to be changes to how audio is handled. I'm going to wait for those changes to be implemented and then redo the jukebox to make use of that instead. |
I implemented pretty much this exact thing ages ago for Parkstation, but it's unmerged :P My implementation includes cover art for the images, some additional functionality, EMAGged songs, signals for the Jukebox, upgradable parts (which is just funny :P), lots of public functions, and Timestamp markers instead of accumulators, that kinda stuff. |
@iNV3RT3D hey, the audio rework is finally done, telling you in case you are still interested in doing this |
About the PR
Added the jukebox, a machine capable of playing any music added to its music list.
Why / Balance
After a suggestion, I tried my hand at creating a Jukebox for use in the bar. This would likely see more use when there is no musician in the game to fill the role. The Jukebox can only play files defined in the Standard.yml file, so additional songs have to be added there.
Being able to drag around a Jukebox playing music to all who would rather not listen would be quite annoying. So, the Jukebox has a power requirement to prevent such an issue.
Technical details
The Jukebox component makes use of a new prototype, the musicList. The musicList stores several MusicListDefinitions. MusicListDefinitions store a string display name, a string file path, a string for copyright, and a float for song length in seconds.
The Jukebox by default uses the Standard.yml file for its list of music, but additional .yml files could be created for separate and unique song lists. When a song is selected, a message storing the list ID of the song is sent to the server. Pausing and resuming a song is handled by storing the time the song was played. When instructed to play, the Jukebox will check and store the current time, subtracted by any existing offset, in the components SongStartTime variable. Then, when told to pause, it will compare the current time to the stored SongStartTime. This will get the offset for the next time it plays, stored in the SongTime variable. Setting the time via the slider updates the SongTime, recalculates SongStartTime based on the offset, and then restarts the audio stream at the new time.
The current list of songs has a size of 14.3 MB combined.
Media
2023-09-22.16-48-15-1.mp4
Breaking changes
None
Changelog
🆑