add an interface for sound libraries
Groundwork for a more versatile interface for using sound libraries. A lot of sound libraries work across multiple platforms. The current NetHack sound stuff is quite limited. Binaries can have a variety of window ports linked into them, and it makes sense to have something similar for sound. This tries to set things up in a more soundlib-centric way, rather than inserting things in a platform-centric way. It establishes a new top-level directory sound (akin to win for the window interface routines, or "window-port") where sound-related additions and sndprocs and support files can be added and used across platforms. The default interface is nosound and the 'nosound' interface is in src/sounds.c The interface for 'windsound', which contains the same minimal USER_SOUNDS support using built-in routines that has been in the windows port for a long time is added to sound/windsound/windsound.c. For now, the sound interface support for 'qtsound' has been added to the existing Qt files win/Qt/qt_bind.h and win/Qt/qt_bind.cpp, and a note has been placed in sound/qtsound/README.md to avoid confusion. New header file added: include/sndprocs.h.
This commit is contained in:
@@ -3399,6 +3399,43 @@ optfn_scroll_margin(
|
||||
return optn_ok;
|
||||
}
|
||||
|
||||
static int
|
||||
optfn_soundlib(int optidx, int req, boolean negated UNUSED,
|
||||
char *opts, char *op)
|
||||
{
|
||||
char soundlibbuf[WINTYPELEN];
|
||||
|
||||
if (req == do_init) {
|
||||
return optn_ok;
|
||||
}
|
||||
if (req == do_set) {
|
||||
/*
|
||||
* soundlib: option to choose the interface for binaries built
|
||||
* with support for more than the default interface (nosound).
|
||||
*
|
||||
* Option processing sets gc.chosen_soundlib. A later call
|
||||
* to activate_chosen_soundlib() actually activates it, and
|
||||
* sets gc.active_soundlib.
|
||||
*/
|
||||
if ((op = string_for_env_opt(allopt[optidx].name, opts, FALSE))
|
||||
!= empty_optstr) {
|
||||
|
||||
get_soundlib_name(soundlibbuf, WINTYPELEN);
|
||||
assign_soundlib(gc.chosen_soundlib);
|
||||
} else
|
||||
return optn_err;
|
||||
return optn_ok;
|
||||
}
|
||||
if (req == get_val || req == get_cnf_val) {
|
||||
if (!opts)
|
||||
return optn_err;
|
||||
get_soundlib_name(soundlibbuf, WINTYPELEN);
|
||||
Sprintf(opts, "%s", soundlibbuf);
|
||||
return optn_ok;
|
||||
}
|
||||
return optn_ok;
|
||||
}
|
||||
|
||||
static int
|
||||
optfn_sortdiscoveries(
|
||||
int optidx, int req, boolean negated,
|
||||
|
||||
Reference in New Issue
Block a user