Multiple audio track support added to command line and games.dat.

This commit is contained in:
Scott Duensing 2023-12-01 19:01:03 -06:00
parent b0a66bf4a4
commit edbad04ca6
6 changed files with 56 additions and 27 deletions

View file

@ -16,6 +16,10 @@ New Features
- Optional sprite anti-aliasing. - Optional sprite anti-aliasing.
- Multiple audio track support for videos. New command line options to select
which default audio track you want (-o or --audio). For games with multiple
languages, you can specify AUDIO_TRACK in the games.dat as well.
- SINGE_DEAD_ZONE global variable now available based on the DEAD_ZONE - SINGE_DEAD_ZONE global variable now available based on the DEAD_ZONE
controller configuration option. controller configuration option.
@ -55,6 +59,9 @@ Fixes
- Framework.singe was missing keyboard mode constants. MODE_NORMAL and - Framework.singe was missing keyboard mode constants. MODE_NORMAL and
MODE_FULL are now included. MODE_FULL are now included.
- SINGE 2.00 added two new input events but never had them in the framework.
SWITCH_BUTTON4 and SWITCH_TILT are now available.
- Taking screenshots could sometimes crash Singe. - Taking screenshots could sometimes crash Singe.
- PNG files no longer generate warnings on the console. - PNG files no longer generate warnings on the console.
@ -65,4 +72,4 @@ Fixes
- Building Singe depended on a lot of undocumented software cobbled together - Building Singe depended on a lot of undocumented software cobbled together
from other projects. This has been vastly improved and should be usable by from other projects. This has been vastly improved and should be usable by
actual humans now. actual humans now. Humans running Linux anyway.

View file

@ -55,6 +55,7 @@ Usage: Singe-v2.10-Windows-x86_64.exe [OPTIONS] scriptName{.singe}
-l, --volume_vldp=PERCENT specify laserdisc volume in percent -l, --volume_vldp=PERCENT specify laserdisc volume in percent
-m, --nomouse disable mouse -m, --nomouse disable mouse
-n, --nocrosshair request game not display gun crosshairs -n, --nocrosshair request game not display gun crosshairs
-o, --audio=TRACK select default track for audio output
-p, --program trace Singe execution to screen and file -p, --program trace Singe execution to screen and file
-s, --nosound, --mutesound mutes all sound -s, --nosound, --mutesound mutes all sound
-t, --trace trace script execution to screen and file -t, --trace trace script execution to screen and file

View file

@ -429,8 +429,8 @@ SWITCH_GRAB = 23
MOUSE_SINGLE = 100 MOUSE_SINGLE = 100
MOUSE_MANY = 200 MOUSE_MANY = 200
SPRITE_SMOOTH = 1 RENDER_SMOOTH = 1
SPRITE_PIXELATED = 0 RENDER_PIXELATED = 0
-- Singe 1.xx Features ------------------------------------------------------- -- Singe 1.xx Features -------------------------------------------------------
@ -460,6 +460,8 @@ SWITCH_SCREENSHOT = 17
SWITCH_QUIT = 18 SWITCH_QUIT = 18
SWITCH_PAUSE = 19 SWITCH_PAUSE = 19
SWITCH_CONSOLE = 20 SWITCH_CONSOLE = 20
SWITCH_BUTTON4 = 21 -- Added in Singe 2.00
SWITCH_TILT = 22 -- Added in Singe 2.00
FONT_QUALITY_SOLID = 1 FONT_QUALITY_SOLID = 1
FONT_QUALITY_SHADED = 2 FONT_QUALITY_SHADED = 2

View file

@ -171,6 +171,7 @@ ConfigT *createConf(char *exeName, int argc, char *argv[]) {
struct Arg_parser parser; struct Arg_parser parser;
static struct ap_Option options[] = { static struct ap_Option options[] = {
{ 'a', "aspect", ap_yes }, { 'a', "aspect", ap_yes },
// { 'b', "scalefactor", ap_yes },
{ 'c', "showcalculated", ap_no }, { 'c', "showcalculated", ap_no },
{ 'd', "datadir", ap_yes }, { 'd', "datadir", ap_yes },
{ 'e', "volume_nonlvdp", ap_yes }, { 'e', "volume_nonlvdp", ap_yes },
@ -181,7 +182,7 @@ ConfigT *createConf(char *exeName, int argc, char *argv[]) {
{ 'l', "volume_vldp", ap_yes }, { 'l', "volume_vldp", ap_yes },
{ 'm', "nomouse", ap_no }, { 'm', "nomouse", ap_no },
{ 'n', "nocrosshair", ap_no }, { 'n', "nocrosshair", ap_no },
// { 'o', "scalefactor", ap_yes }, { 'o', "audio", ap_yes },
{ 'p', "program", ap_no }, { 'p', "program", ap_no },
{ 's', "nosound", ap_no }, { 's', "nosound", ap_no },
{ 't', "trace", ap_no }, { 't', "trace", ap_no },
@ -229,6 +230,12 @@ ConfigT *createConf(char *exeName, int argc, char *argv[]) {
argCount++; argCount++;
break; break;
// Overscan Zoom
case 'b':
conf->scaleFactor = atoi(arg);
argCount++;
break;
// Show Calculated Frame File Values // Show Calculated Frame File Values
case 'c': case 'c':
conf->showCalculated = true; conf->showCalculated = true;
@ -285,9 +292,9 @@ ConfigT *createConf(char *exeName, int argc, char *argv[]) {
conf->noCrosshair = true; conf->noCrosshair = true;
break; break;
// Overscan Zoom // Audio Track Output
case 'o': case 'o':
conf->scaleFactor = atoi(arg); conf->audioOutputTrack = atoi(arg);
argCount++; argCount++;
break; break;
@ -733,6 +740,7 @@ void showUsage(char *name, char *message) {
utilSay("Usage: %s [OPTIONS] scriptName{.singe}", utilGetLastPathComponent(name)); utilSay("Usage: %s [OPTIONS] scriptName{.singe}", utilGetLastPathComponent(name));
utilSay(""); utilSay("");
utilSay(" -a, --aspect=N:D force aspect ratio"); utilSay(" -a, --aspect=N:D force aspect ratio");
// utilSay(" -b, --scalefactor=PERCENT reduce screen size for overscan compensation");
utilSay(" -c, --showcalculated show calculated framefile values for debugging"); utilSay(" -c, --showcalculated show calculated framefile values for debugging");
utilSay(" -d, --datadir=PATHNAME alternate location for written files"); utilSay(" -d, --datadir=PATHNAME alternate location for written files");
utilSay(" -e, --volume_nonvldp=PERCENT specify sound effects volume in percent"); utilSay(" -e, --volume_nonvldp=PERCENT specify sound effects volume in percent");
@ -743,7 +751,7 @@ void showUsage(char *name, char *message) {
utilSay(" -l, --volume_vldp=PERCENT specify laserdisc volume in percent"); utilSay(" -l, --volume_vldp=PERCENT specify laserdisc volume in percent");
utilSay(" -m, --nomouse disable mouse"); utilSay(" -m, --nomouse disable mouse");
utilSay(" -n, --nocrosshair request game not display gun crosshairs"); utilSay(" -n, --nocrosshair request game not display gun crosshairs");
// utilSay(" -o, --scalefactor=PERCENT reduce screen size for overscan compensation"); utilSay(" -o, --audio=TRACK select default track for audio output");
utilSay(" -p, --program trace Singe execution to screen and file"); utilSay(" -p, --program trace Singe execution to screen and file");
utilSay(" -s, --nosound, --mutesound mutes all sound"); utilSay(" -s, --nosound, --mutesound mutes all sound");
utilSay(" -t, --trace trace script execution to screen and file"); utilSay(" -t, --trace trace script execution to screen and file");

View file

@ -2607,6 +2607,10 @@ int32_t apiVideoLoad(lua_State *L) {
video->lastFrame = -1; video->lastFrame = -1;
result = _global.nextVideoId++; result = _global.nextVideoId++;
HASH_ADD_INT(_global.videoList, id, video); HASH_ADD_INT(_global.videoList, id, video);
// Select desired default audio track
if (_global.conf->audioOutputTrack < videoGetAudioTracks(video->id)) {
videoSetAudioTrack(video->id, _global.conf->audioOutputTrack);
}
} }
} }
@ -3336,6 +3340,8 @@ ConfigT *buildConfFromTable(lua_State *L) {
sindenString = strdup(valueString); sindenString = strdup(valueString);
if (!parseSindenString(&sindenString, c)) c->sindenArgc = 0; if (!parseSindenString(&sindenString, c)) c->sindenArgc = 0;
free(sindenString); free(sindenString);
} else if (strcmp(confKey, "AUDIO_TRACK") == 0) {
c->audioOutputTrack = valueNumber;
} }
// Clean up for next pair // Clean up for next pair
@ -4429,6 +4435,10 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
progTrace("Starting laserdisc video in stopped state"); progTrace("Starting laserdisc video in stopped state");
videoPlay(_global.videoHandle); videoPlay(_global.videoHandle);
_global.discStopped = false; _global.discStopped = false;
// Select desired default audio track
if (_global.conf->audioOutputTrack < videoGetAudioTracks(_global.videoHandle)) {
videoSetAudioTrack(_global.videoHandle, _global.conf->audioOutputTrack);
}
// Start script // Start script
progTrace("Compiling %s", _global.conf->scriptFile); progTrace("Compiling %s", _global.conf->scriptFile);

View file

@ -71,6 +71,7 @@ typedef struct ConfigS {
int32_t yResolution; int32_t yResolution;
int32_t sindenArgc; int32_t sindenArgc;
int32_t sindenArgv[SINDEN_OPTION_COUNT]; int32_t sindenArgv[SINDEN_OPTION_COUNT];
int32_t audioOutputTrack;
} ConfigT; } ConfigT;