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

Play bootSound.btsnd while shaders/pipelines are compiling #1047

Merged
merged 43 commits into from
Dec 18, 2024

Conversation

goeiecool9999
Copy link
Collaborator

@goeiecool9999 goeiecool9999 commented Dec 17, 2023

implementation of the suggestion in issue #1045
In the process I also ended up removing some duplicate code in the way that audio initialises.

@goeiecool9999 goeiecool9999 marked this pull request as ready for review December 17, 2023 19:56
@Adamillo
Copy link

Adamillo commented Dec 23, 2023

Tested on Windows but I hear nothing from bootSound.btsnd, is this option enabled by default?
Edit: Ah I see the problem, bootSound.btsnd will not be played when the latency of the audio is set to 0ms

@Adamillo
Copy link

And I found another bug. XAudio2 does not work properly with this PR no matter what latency you set it to

@goeiecool9999
Copy link
Collaborator Author

goeiecool9999 commented Dec 24, 2023

Latest version should work on all API's and latency settings.
Unrelated but I think before merging these changes it's probably a good idea to make this functionality disabled by default. I think it would be startling for users who update to suddenly hear audio when loading a game. When someone has short loading times it will play just a little bit of the audio and then abruptly cut out which also isn't very polished. I also heard that audio dropouts like that can blow up speakers in exceptional cases.

@Adamillo
Copy link

The audio drop out is definitely a problem that could make your PR get blocked from merging (I say could, because I am not a maintainer). Is there a way to make the audio fade out smoothly without complicating the code?

@goeiecool9999
Copy link
Collaborator Author

goeiecool9999 commented Dec 24, 2023

I may have overstated how bad of an issue it is. Going from sound to silence like that happens every time you pause a YouTube video. So I recon anyone dealing with audio systems that could actually be damaged from that knows to be extra careful when hooking up computer software to it. Main concerns are the fact that it's unexpected and unpolished.

@Adamillo
Copy link

I see, makes sense. I was a little worried with the issue but I see what you mean now

@Adamillo
Copy link

Any plans about reviews/merges for this PR?

Comment on lines +36 to +37
m_wfx.Format.nBlockAlign = (m_wfx.Format.nChannels * m_wfx.Format.wBitsPerSample) / 8; // must equal (nChannels × wBitsPerSample) / 8
m_wfx.Format.nAvgBytesPerSec = m_wfx.Format.nSamplesPerSec * m_wfx.Format.nBlockAlign; // must equal nSamplesPerSec × nBlockAlign.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed these characters to UTF-8. These were the only non-UTF8 characters in the file but GitHub doesn't detect encoding changes.

@GabIsAwesome
Copy link

is this ever getting merged?? 🫤

@Adamillo
Copy link

Any updates on this PR?

@goeiecool9999 goeiecool9999 requested a review from Exzap October 14, 2024 19:01
@Exzap
Copy link
Member

Exzap commented Nov 11, 2024

Can you add a fade-out effect instead of abruptly stopping the audio? Similar to how it is on console:
TWW_Intro.webm

@goeiecool9999
Copy link
Collaborator Author

I didn't see your comment until now. I had that idea but didn't implement it because I thought it would be too complicated. I'll look into it.

@goeiecool9999
Copy link
Collaborator Author

goeiecool9999 commented Dec 9, 2024

Latest commit has a 10 second linear fadeout. 10 seconds is likely too long and I'm also curious what type of curve the Wii U uses for it's fadeout. (e.g. linear, logarithmic, exponential, s-curve)
Because the lifetime of the playback thread now extends beyond the duration of the cache loading screen I've changed the structure of the code to use an extra class which manages the thread. This gives a guarantee that when main returns and the global is destroyed the thread joins properly/timely.

@goeiecool9999
Copy link
Collaborator Author

goeiecool9999 commented Dec 9, 2024

I've done my best to approximate the fade-out. To get more accurate someone would need to make a homebrew that uses a pure tone as a bootsnd or reverse engineer that part of the system software. But I think this is good for now.
I also wonder if titles expect a certain syscall to trigger the end the bootscreen and start the fade-out. The new structure allows us to trigger the fadeout anywhere so if we figure that out we could move it there instead.

@goeiecool9999 goeiecool9999 merged commit 3738ccd into cemu-project:main Dec 18, 2024
5 checks passed
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