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

Allow audio support on ncurses builds #78841

Open
JodiJodington opened this issue Dec 29, 2024 · 10 comments · May be fixed by #78880
Open

Allow audio support on ncurses builds #78841

JodiJodington opened this issue Dec 29, 2024 · 10 comments · May be fixed by #78880
Labels
<Suggestion / Discussion> Talk it out before implementing

Comments

@JodiJodington
Copy link
Contributor

Is your feature request related to a problem? Please describe.

I would like to have sound effects and music within the ncurses version, just as it is on the tiles version

Solution you would like.

based on the Makefile the reason for not allowing SOUND=1 when TILES=0 is because sound requires SDL. I haven’t had the chance to read the source code thoroughly, but I don’t see why it wouldn’t be possible to initiate the audio subsystem of SDL while still using ncurses for graphics
I’d be happy to PR a fix for it if you don’t see any large obstacles, but I’ve never worked on a project this huge and I assume it’s a lot more complicated to fix this than I’d imagine

Describe alternatives you have considered.

Of course, I could use the tiles version of the app (and there are tons of minimalist tilesets) so this isn’t necessary at all, I just like being able to play from the terminal and have a minimal amount of visual distractions but do not want to miss out on the sound effects and music

Additional context

No response

@JodiJodington JodiJodington added the <Suggestion / Discussion> Talk it out before implementing label Dec 29, 2024
@ZhilkinSerg
Copy link
Contributor

I don't think it is possible at all.

@JodiJodington
Copy link
Contributor Author

I don't think it is possible at all.

what would prevent it? SDL’s audio subsystem seems to be completely independent of the video subsystem, and at least on linux/osx (maybe windows does something odd here?), you can absolutely play audio without a window handle or display server connection
I won’t have direct access to my home computer until next week, so unfortunately I can’t try it out right now but I can say that I made a demo of a purely TUI music player earlier this year so I know it’s possible (I used libpulse instead of SDL audio, but I can’t imagine SDL audio would have any extra restrictions like that)

@JodiJodington
Copy link
Contributor Author

I tried compiling it over ssh, just commenting out this line in the Makefile seemed to make it build with SOUND=1 TILES=0 and run fine (the settings menu is bugged and says tiles are enabled, but the actual game is definitely running with ncurses and works through ssh without any sort of X server pass through), I can't test if the sound works though since im not at the actual computer (I'm sure there's a way to forward sound I just don't think that's worth the complexity over just waiting a few days)
would anyone be willing to test it out on their computer?

@Procyonae
Copy link
Contributor

would anyone be willing to test it out on their computer?

src/sdlsound.cpp:20:14: fatal error: 'SDL_mixer.h' file not found
   20 | #    include <SDL_mixer.h>
      |              ^~~~~~~~~~~~~

I get this when trying to compile curses with SOUND=1 TILES=0 through WSL which could well be easily solvable but I have no clue

@JodiJodington
Copy link
Contributor Author

src/sdlsound.cpp:20:14: fatal error: 'SDL_mixer.h' file not found

I get this when trying to compile curses with SOUND=1 TILES=0 through WSL which could well be easily solvable but I have no clue

do you have sdl2_mixer and pkgconfig installed? (no clue how it works on WSL, id assume you can just use a package manager like on linux)
that's what the Makefile uses here to add the include path
I'd expect make to bail out if pkgconfig is not installed or if the sdl2_mixer pkgconfig manifest isn't found, but who knows, Makefiles tend to be pretty flakey 😅
you could also check what the arguments to your compiler are, there should be a -I/usr/include/SDL2 (that's how it is on my machine)

@Procyonae
Copy link
Contributor

do you have sdl2_mixer and pkgconfig installed?

Whoops that's embarrassing no ;D

you could also check what the arguments to your compiler are, there should be a -I/usr/include/SDL2

Having now installed them it is passing that and it is present at that location, now I'm getting this

error: POSIX thread support was disabled in PCH file but is currently enabled
1 error generated.
make: *** [Makefile:1103: obj/sdlsound.o] Error 1
make: *** Waiting for unfinished jobs....
error: POSIX thread support was disabled in PCH file but is currently enabled
1 error generated.
error: POSIX thread support was disabled in PCH file but is currently enabled
1 error generated.
make: *** [Makefile:1103: obj/speech.o] Error 1
make: *** [Makefile:1103: obj/stats_tracker.o] Error 1
error: POSIX thread support was disabled in PCH file but is currently enabled
1 error generated.
make: *** [Makefile:1103: obj/speed_description.o] Error 1
error: POSIX thread support was disabled in PCH file but is currently enabled
1 error generated.
make: *** [Makefile:1103: obj/smart_controller_ui.o] Error 1
error: POSIX thread support was disabled in PCH file but is currently enabled
1 error generated.
make: *** [Makefile:1103: obj/stomach.o] Error 1
error: POSIX thread support was disabled in PCH file but is currently enabled
1 error generated.
make: *** [Makefile:1103: obj/sleep.o] Error 1
error: POSIX thread support was disabled in PCH file but is currently enabled
1 error generated.
make: *** [Makefile:1103: obj/start_location.o] Error 1
error: POSIX thread support was disabled in PCH file but is currently enabled
1 error generated.
make: *** [Makefile:1103: obj/sounds.o] Error 1

@JodiJodington
Copy link
Contributor Author

Having now installed them it is passing that and it is present at that location, now I'm getting this

my guess is that now the pkgconfig call succeeded and added a flag that enables "POSIX thread support" that wasn't there before, so your old PCH files are compiled without "POSIX thread support" but now your new ones (that weren't built before since your compilation failed halfway through) do have it
a make clean should fix it hopefully
(I've personally always used PCH=0 since that's what most packages do for cataclysm, not sure if it matters or not)

@Procyonae
Copy link
Contributor

Oh right I'm tired and didn't parse that PCH was pre compiled headers '^^
I got it compiling with a couple more package installs but it segfaults when loading in with CC-Sounds selected

@JodiJodington
Copy link
Contributor Author

it segfaults when loading in with CC-Sounds selected

I just loaded into a new world just fine for me with CC-Sounds
image
does the game usually work for you within WSL without SOUND=1?

@JodiJodington
Copy link
Contributor Author

managed to get it to work, I'll PR it when I'm able to test it some more in a few days :)
cava visualizer output for proof of audio :p
if anyone wants to see the changes, it's pretty tiny
image

@JodiJodington JodiJodington linked a pull request Dec 31, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Suggestion / Discussion> Talk it out before implementing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants