Skip to content
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

add karaoke mode via #INSTRUMENTALS or #KARAOKE tag, key to toggle karaoke mode is K while playing. #850

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dgruss
Copy link

@dgruss dgruss commented May 20, 2024

add karaoke mode via #INSTRUMENTALS or #KARAOKE tag, key to toggle
karaoke mode is K while playing.

game/config.ini Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not commit your config.ini

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally config.ini never shows up in these commits at all (rewrite history/force push is fine on branches). I could allow it because this is a relatively small PR should it get merged with squashing enabled, but it would set precedent and now the Piano mode PR also wants in this way, and then someone submits a 1500-line net PR across 3 useful commits but it also changes+undoes line ending changes on everything in src/lib, and well, you can see where this is going.

In general I don't like squashing because it loses information, and I've had way too many times (not on USDX) where a big PR got squashed because "rewriting was too much effort" and then 5 years later it's pinpointed that "somewhere" in there a bug was introduced.

Ideally this PR gets reworked.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be added to all translation files.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is not translated in any language. If you press tab in German, for instance, it's all English.

@@ -935,6 +937,14 @@ function TSong.ReadTXTHeader(SongFile: TTextFileStream; ReadCustomTags: Boolean)
Log.LogError('Can''t find video file in song: ' + FullFileName);
end

// Karaoke Mp3
else if (Identifier = 'INSTRUMENTALS') or (Identifier = 'KARAOKE') then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The identifier is INSTRUMENTAL, see https://usdx.eu/format/.

@dgruss
Copy link
Author

dgruss commented May 20, 2024

I was not sure what counts on that page as it also lists

#INSTRUMENTALS: Artist - Title of the song [INSTR].mp3

@dgruss
Copy link
Author

dgruss commented May 20, 2024

changed it to #INSTRUMENTAL only @bohning, config is reset, language - the help is not translated for any language, so I'd keep that as is for now

@dgruss
Copy link
Author

dgruss commented Jun 9, 2024

anything still to do here?

@bohning
Copy link
Collaborator

bohning commented Jun 9, 2024

Not from my side. I think @barbeque-squared hasn't had time to review and merge it.

@dgruss
Copy link
Author

dgruss commented Jun 9, 2024

actually found one more subtle bug while testing this a bit more (mp3 tag after karaoke tag overwrote the karaoke tag), fixed with this commit

@dgruss
Copy link
Author

dgruss commented Jun 9, 2024

and another one found while playing 😇

@bohning
Copy link
Collaborator

bohning commented Jul 18, 2024

So this toggles the use of the normal audio (#MP3) and the instrumental version (#INSTRUMENTAL), right? I just learned that Melody Mania has implemented a slider where you can set the amount of vocals from 0 % (pure karaoke) to 100 % (pure sing-along. Of course that's quite a bit harder to implement, but that would be awesome.
image

@barbeque-squared
Copy link
Member

I was testing this branch but could not get it to work. I suspect it's due to a merge conflict from some other change, git is giving me

$ git apply 850.diff
error: patch failed: src/screens/UScreenEditSub.pas:4933
error: src/screens/UScreenEditSub.pas: patch does not apply

But before that (probably 46cf3f1) it did apply the diff but gave me EAccessViolation when starting a song. It just shows me the video or the background image for a fraction of a second, then crashes. Without this patch it works fine, so I've ruled out config.ini at this point.

what bohning mentions should probably be more of a stretch goal, though shorter-time we can do what we do with A: just cycle through a few predefined presets (ie full mp3, full karaoke, 50/50) (but as a follow-up PR please)?

@dgruss
Copy link
Author

dgruss commented Jul 21, 2024

That's quite odd. I've used this one on several occasions already over multiple hours without a crash. Not sure what might cause this? I can try to see what it does on the most recent version.

@DeinAlptraum
Copy link
Contributor

DeinAlptraum commented Jul 21, 2024

The crash was my fault, fix PR is open in #874. This only occurs after ./autogen.shing again
Edit: this was a different problem that may occur when starting the game, not when starting a song. Sorry for the confusion

@barbeque-squared
Copy link
Member

Took me a while to remember ./configure --enable-debug so it prints stacktraces instead of only "Access violation", but with that I get this output:

Exception class: EAccessViolation
Message: Access violation
  $00000000004E2C4E  APPEND,  line 796 of base/UPath.pas
  $0000000000519C93  ONSHOWFINISH,  line 865 of screens/controllers/UScreenSingController.pas
  $000000000045FF0F  DRAW,  line 448 of menu/UDisplay.pas
  $000000000047A3D2  MAINLOOP,  line 344 of base/UMain.pas
  $000000000047A166  MAIN,  line 269 of base/UMain.pas
  $0000000000407487  main,  line 414 of ultrastardx.dpr

This only happens on songs that DO NOT have the #INSTRUMENTAL tag! Songs that have it are indeed fine, but it's an optional tag. 865 is the AudioPlayback.Open call. I'm assuming CurrentSong.Karaoke is nil there (which it should be if the song doesn't have it!) but it's basically getting passed a folder now or something.

@dgruss
Copy link
Author

dgruss commented Jul 21, 2024 via email

@dgruss dgruss force-pushed the karaokefilemode branch from 19b09aa to 14d9f9a Compare July 25, 2024 00:40
@dgruss
Copy link
Author

dgruss commented Jul 25, 2024

alright. fixed the bug, rebased to new master and squashed the commits

@@ -860,7 +862,10 @@ function TSong.ReadTXTHeader(SongFile: TTextFileStream; ReadCustomTags: Boolean)
if (Self.Path.Append(EncFile).IsFile) then
begin
self.Mp3 := EncFile;

if (not Assigned(self.Karaoke)) or (self.Karaoke = PATH_NONE()) then
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bugfix was here to also check for not Assigned --> to make sure both .Mp3 and .Karaoke members are initialized to an actual audio file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants