CUzeBox - The new official Uzebox emulator

The Uzebox now have a fully functional emulator! Download and discuss it here.
CunningFellow
Posts: 1445
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: CUzeBox - The new official Uzebox emulator

Post by CunningFellow »

My speakers don't click. But my speakers are a bit strange and barely have any volume.
User avatar
Jubatian
Posts: 1561
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: CUzeBox - The new official Uzebox emulator

Post by Jubatian »

Artcfox wrote: Thu Aug 20, 2020 1:03 amBut right upon initial startup of cuzebox there are a couple loud popping noises, that sound almost like when you are plugging or unplugging a 3.5mm audio cable connected to powered speakers.
One additional thought... Does this definitely happen with any game? Some games have poor initialization, resulting in driving the speaker low for a short while, which the emulator of course mimics. It could be that different drivers initialize differently (taking different time for getting up and running, actually taking the samples), so they swallowed this earlier, and with WASAPI, they don't.
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: CUzeBox - The new official Uzebox emulator

Post by Artcfox »

Jubatian wrote: Sat Aug 22, 2020 2:38 pm
Artcfox wrote: Thu Aug 20, 2020 1:03 amBut right upon initial startup of cuzebox there are a couple loud popping noises, that sound almost like when you are plugging or unplugging a 3.5mm audio cable connected to powered speakers.
One additional thought... Does this definitely happen with any game? Some games have poor initialization, resulting in driving the speaker low for a short while, which the emulator of course mimics. It could be that different drivers initialize differently (taking different time for getting up and running, actually taking the samples), so they swallowed this earlier, and with WASAPI, they don't.
It doesn't matter which game: https://youtu.be/E3d_h7sELZA

The other fix I proposed with setting that environment variable doesn't create these loud popping sounds.
User avatar
Jubatian
Posts: 1561
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: CUzeBox - The new official Uzebox emulator

Post by Jubatian »

Artcfox wrote: Sat Aug 22, 2020 4:26 pmIt doesn't matter which game: https://youtu.be/E3d_h7sELZA

The other fix I proposed with setting that environment variable doesn't create these loud popping sounds.
OK, I see, that's definitely an initialization pop then. I asked since I have a few games, mostly things compiled with older kernels, which pop on startup, but which can not really be fixed as the Uzebox itself drives the PWM that way.

Did another attempt, trying to work around something which just shouldn't happen, but probably could, causing the pops. Really would like to get WASAPI working (if that's SDL / in the end, Microsoft actually wants to shove on us, eventually it has to be supported), if not possible, probably will go on a different route than injecting an environment variable (scan audio drivers, select the preferred one which gets sound to speakers and is not WASAPI, unless only WASAPI is available, then choosing that, a pop on startup is better than no sound at all).
Attachments
cuzebox_windows_x86.zip
Another WASAPI attempt
(416.54 KiB) Downloaded 596 times
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: CUzeBox - The new official Uzebox emulator

Post by Artcfox »

Jubatian wrote: Sun Aug 23, 2020 1:03 pm
Artcfox wrote: Sat Aug 22, 2020 4:26 pmIt doesn't matter which game: https://youtu.be/E3d_h7sELZA

The other fix I proposed with setting that environment variable doesn't create these loud popping sounds.
OK, I see, that's definitely an initialization pop then. I asked since I have a few games, mostly things compiled with older kernels, which pop on startup, but which can not really be fixed as the Uzebox itself drives the PWM that way.

Did another attempt, trying to work around something which just shouldn't happen, but probably could, causing the pops. Really would like to get WASAPI working (if that's SDL / in the end, Microsoft actually wants to shove on us, eventually it has to be supported), if not possible, probably will go on a different route than injecting an environment variable (scan audio drivers, select the preferred one which gets sound to speakers and is not WASAPI, unless only WASAPI is available, then choosing that, a pop on startup is better than no sound at all).
I just tested the new version and it still has the loud pops.

One of the biggest draws of SDL is because it abstracts away all of the platform differences. I think it's a huge bug in SDL that sound doesn't just work out of the box on Windows.
User avatar
Jubatian
Posts: 1561
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: CUzeBox - The new official Uzebox emulator

Post by Jubatian »

Artcfox wrote: Mon Aug 24, 2020 3:36 amI just tested the new version and it still has the loud pops.

One of the biggest draws of SDL is because it abstracts away all of the platform differences. I think it's a huge bug in SDL that sound doesn't just work out of the box on Windows.
Pfff... No idea then, feels like something beyond whatever I can do when using WASAPI. Yes, I completely agree on that, this thing feels really rushed, many projects having numerous problems with it beyond the initial hurdle that it is suddenly an API which is only content when fed with floating point samples. I think I will give it some further thought and design in the weekend, trying to work around the native prioritization in SDL so the fallbacks still work, but WASAPI is de-prioritized as a last resort if nothing else is available.

With Microsoft, it is impossible to do anything, they are just like that, but SDL shouldn't be just following suit screwing things up. Well, frankly at least in this regard Linux isn't much better with the mess of audio options (Alsa, Pulse, Jack, Esound, probably even some OSS still lingering about, and who knows what else...).
User avatar
Jubatian
Posts: 1561
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: CUzeBox - The new official Uzebox emulator

Post by Jubatian »

Did another attempt at it.

This version does the following on SDL2, Windows (SDL1 builds are unaffected, including Emscripten. Linux builds are minimally affected in that they are now using the SDL2 Audio API instead of the legacy SDL1 API on SDL2 builds):

- If the SDL_AUDIODRIVER environment variable is set, then whatever driver is specified there will be used (it is so possible to select wasapi intentionally).
- Otherwise if in the list of drivers known to SDL, "directsound" exists, then it will be used.
- Otherwise whatever default SDL provides will be used (could be wasapi).

On a system with buggy wasapi (but working directsound), there shouldn't be any problem exhibited related to wasapi (audio should be initialized only once, there is no temporary transitional state where wasapi could be brought up). If this works, I will commit it, and would say, let's forget about this problem, sitting snugly under the carpet, until something breaks again :P
Attachments
cuzebox_windows_x86.zip
Another attempt, directsound prioritization
(416.69 KiB) Downloaded 585 times
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: CUzeBox - The new official Uzebox emulator

Post by Artcfox »

Jubatian wrote: Sat Aug 29, 2020 12:16 pm Did another attempt at it.

This version does the following on SDL2, Windows (SDL1 builds are unaffected, including Emscripten. Linux builds are minimally affected in that they are now using the SDL2 Audio API instead of the legacy SDL1 API on SDL2 builds):

- If the SDL_AUDIODRIVER environment variable is set, then whatever driver is specified there will be used (it is so possible to select wasapi intentionally).
- Otherwise if in the list of drivers known to SDL, "directsound" exists, then it will be used.
- Otherwise whatever default SDL provides will be used (could be wasapi).

On a system with buggy wasapi (but working directsound), there shouldn't be any problem exhibited related to wasapi (audio should be initialized only once, there is no temporary transitional state where wasapi could be brought up). If this works, I will commit it, and would say, let's forget about this problem, sitting snugly under the carpet, until something breaks again :P
I can confirm that the popping sounds are gone on Windows when I swap the packaged DLL with the latest version! :D
User avatar
Jubatian
Posts: 1561
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: CUzeBox - The new official Uzebox emulator

Post by Jubatian »

Artcfox wrote: Sat Aug 29, 2020 2:47 pmI can confirm that the popping sounds are gone on Windows when I swap the packaged DLL with the latest version! :D
Done committed it to the main repo, also replacing the downloads on the top post (the WASAPI workaround doesn't affect them much, though, unless you replaced the SDL library in the package).
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: CUzeBox - The new official Uzebox emulator

Post by Artcfox »

Jubatian wrote: Sun Aug 30, 2020 10:51 am
Artcfox wrote: Sat Aug 29, 2020 2:47 pmI can confirm that the popping sounds are gone on Windows when I swap the packaged DLL with the latest version! :D
Done committed it to the main repo, also replacing the downloads on the top post (the WASAPI workaround doesn't affect them much, though, unless you replaced the SDL library in the package).
Awesome!

Can you package it with the latest SDL libraries? Without them the USB game controllers don't work out of the box on Windows.
Post Reply