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

Main menu missing sounds #2002

Open
2 of 7 tasks
burner1024 opened this issue Feb 20, 2024 · 16 comments
Open
2 of 7 tasks

Main menu missing sounds #2002

burner1024 opened this issue Feb 20, 2024 · 16 comments

Comments

@burner1024
Copy link
Contributor

burner1024 commented Feb 20, 2024

Bug description

Main menu only has button click sounds, not menu state change sounds.

Steps to reproduce

  1. Launch game.
  2. Click Quit.
  3. Click Cancel.
  4. Listen to the sound.

Expected behavior

There's 2 additional sounds on menu changes in BG2. Sounds like stone move back and forth.

They are not present on all buttons. I couldn't find any sound references in relevant data files, so maybe hardcoded?
"Quit", "Options", "Cancel", "Tutorial", "Return" have the sounds. Also all buttons in Options.

To be more precise, they are not tied to buttons themselves, but to corresponding menu changes. If you press Quit in main menu, then hit Escape (same as clicking Cancel), you'll hear the menu sound without button click.

Screenshots

GemRB version (check as many as you know apply)

  • master as of this issue
  • 0.9.2
  • 0.9.1
  • 0.9.0

Video Driver (check as many as you know apply)

  • SDL1.2
  • SDL2 built with USE_OPENGL_BACKEND
  • SDL2 without USE_OPENGL_BACKEND
@lynxlynxlynx
Copy link
Member

They are easy to add to our individual button callbacks, but can you figure out which audio files are used? There is a window closing sound we already have, I think, that might be the same.

@burner1024
Copy link
Contributor Author

I'll try to figure it out.
Although, just to be clear, these aren't button sounds, they are menu screen change sounds. Not the same.

@lynxlynxlynx
Copy link
Member

If they are all the same, then the window callback can be used, but you said there are two types, so ?? Maybe one for a window opening?

@burner1024
Copy link
Contributor Author

burner1024 commented Feb 20, 2024

One for opening, and one for reverting (back/cancel).
But I don't understand why some transitions have it, and others don't...

@lynxlynxlynx
Copy link
Member

Some may not cause a window change.

@bradallred
Copy link
Member

bradallred commented Feb 20, 2024

WindowManager is what plays these sounds when it opens/closes a window. if the window has Window::NoSounds set then no sound is played. So that would be the first thing to check.

It also appears the open sound is only played for modal windows (PresentModalWindow), so that may be incorrect too.

@burner1024
Copy link
Contributor Author

burner1024 commented Feb 22, 2024

Looks like nosounds flags is not even defined on gui side, let alone set anywhere.

enum WindowFlags {
Draggable = 1, // window can be dragged (by clicking anywhere in its frame) a la PST radial menu
Borderless = 2, // window will not draw the ornate borders (see WindowManager::DrawWindows)
DestroyOnClose = 4, // window will be deleted on close rather then hidden and sent to the back
AlphaChannel = 8, // Create window with RGBA buffer suitable for creating non rectangular windows
Modal = 16,
NoSounds = 32 // doesn't play the open/close sounds
};

# Window position anchors/alignments
# !!! Keep these synchronized with Window.h !!!
WF_DRAGGABLE = 0x01
WF_BORDERLESS = 0x02
WF_DESTROY_ON_CLOSE = 0x04
WF_ALPHA_CHANNEL = 0x08

It also appears the open sound is only played for modal windows (PresentModalWindow), so that may be incorrect too.

It seems so.

And the sounds are already figured out:

BUTTON2 GAM_03
BUTTON3 GAM_04

@bradallred
Copy link
Member

I guess its only set by the MoviePlayer.

Looking at the code, we ignore sounds for "bordered" windows, so thats the issue. I'm not sure why we do that, so my guess is that it must be different in one of the games.

if (win->Flags() & Window::Borderless && !(win->Flags() & Window::NoSounds)) {
	core->PlaySound(DS_WINDOW_OPEN, SFX_CHAN_GUI);
}

@burner1024
Copy link
Contributor Author

burner1024 commented Feb 22, 2024

I tried other games, and well, they don't really have extensive menus. Unlike BG2, almost everything is 1 click away.

I don't know. Maybe keep this as is for consistent UX.

@bradallred
Copy link
Member

its not a question of menus, but windows in general. If we are just going to keep things simple and consistent across games the question is do we prefer sound or no sound. We can also just create a setting for UI sounds.

@lynxlynxlynx
Copy link
Member

There's no need for a setting — if other games don't have window open/close sounds, those entries will just be empty. Currently it's unset only in pst and even there it might just be from it using a different sound.

@bradallred
Copy link
Member

I'm speculating that either all games have that sound, even if the originals didn't use it, or that not all windows are supposed to produce it. I don't know why else we would be checking Window::Borderless.

If we care about being nit picky about it then applying Window::NoSounds in the GUIScripts is probably the only option. Otherwise just always play it I guess.

@lynxlynxlynx
Copy link
Member

Nothing useful on the why in the commit message: c571c22. Perhaps for GUISTORE switching, since two windows are involved?

If a game doesn't use them at all, we can just reset the 2da entry. For any special casing, setting the flag manually seems fine to me. But let's understand the behaviour first — it just requires more testing.

We should at minimum rename the button2/3 constants; it was done in 2005 already, just not synchronized to the python ones:

-#define DS_BUTTON1    4
-#define DS_BUTTON2    5
-#define DS_BUTTON3    6
+#define DS_BUTTON_PRESSED    4
+#define DS_WINDOW_OPEN       5
+#define DS_WINDOW_CLOSE      6

@burner1024
Copy link
Contributor Author

What else do you want to test?

@lynxlynxlynx
Copy link
Member

One of your initial messages is still unclear — how do other games behave? It's something that's easier to test with let's say opening the journal or inventory.

@burner1024
Copy link
Contributor Author

Other games don't have same CHU non-modal window switches like BG2 does. For them, it goes from main menu straight to modals, so there's no direct comparison.

But there are still discrepancies. Even BG1 Quit modal plays the sounds in the original, and doesn't in GemRB.
Captura desde 2024-02-24 13-01-18

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

No branches or pull requests

3 participants