From aa165129392c83351180aaac48caf5421dc3f4ae Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Tue, 31 Dec 2019 17:51:57 -0600 Subject: [PATCH] Fixed right-channel missing bug in disc audio mixer. Fixed discAudio() command. --- singe/main.c | 4 ++-- singe/singe.c | 11 +++++++---- singe/singe.h | 2 +- singe/videoPlayer.c | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/singe/main.c b/singe/main.c index 85f07ba5b..858656e88 100644 --- a/singe/main.c +++ b/singe/main.c @@ -64,6 +64,8 @@ __attribute__((noreturn)) void showUsage(char *name, char *message) { int result = 0; + // 00000000011111111112222222222333333333344444444445555555555666666666677777777778 + // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 utilSay(" ___ ___ _ _ ___ ___"); utilSay("/ __|_ _| \\| |/ __| __| Somewhat Interactive Nostalgic Game Emulator %s", VERSION_STRING); utilSay("\\__ \\| || .` | (_ | _| Copyright (c) 2006-%s Scott C. Duensing", COPYRIGHT_END_YEAR); @@ -80,8 +82,6 @@ void showUsage(char *name, char *message) { utilSay(" -w, --fullscreen_window run in windowed full screen mode"); utilSay(" -l, --volume_vldp=PERCENT specify laserdisc volume in percent"); utilSay(" -e, --volume_nonvldp=PERCENT specify sound effects volume in percent"); - // 00000000011111111112222222222333333333344444444445555555555666666666677777777778 - // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 utilSay(" -z, --scalefactor=PERCENT reduce screen size for overscan compensation"); utilSay(" -a, --aspect=N:D force aspect ratio"); utilSay(" -u, --stretch use ugly stretched video"); diff --git a/singe/singe.c b/singe/singe.c index dfb3498b7..6226dde91 100644 --- a/singe/singe.c +++ b/singe/singe.c @@ -458,9 +458,10 @@ int apiDiscAudio(lua_State *L) { if (lua_isnumber(L, 1)) { if (lua_isboolean(L, 2)) { d = lua_tonumber(L, 1); channel = (int)d; - d = lua_tonumber(L, 2); onOff = (bool)d; - if ((channel == 1) && onOff) left = _confVolumeVldp; - if ((channel == 2) && onOff) right = _confVolumeVldp; + d = lua_toboolean(L, 2); onOff = (bool)d; + videoGetVolume(_videoHandle, &left, &right); + if (channel == 1) left = (onOff ? _confVolumeVldp : 0); + if (channel == 2) right = (onOff ? _confVolumeVldp : 0); videoSetVolume(_videoHandle, left, right); result = true; } @@ -663,6 +664,8 @@ int apiDiscSkipToFrame(lua_State *L) { } else { luaTrace(L, "discSkipToFrame", "Failed!"); } + + return 0; } @@ -934,7 +937,7 @@ int apiOverlayPrint(lua_State *L) { if (n == 3) { if (lua_isnumber(L, 1)) { if (lua_isnumber(L, 2)) { - if (lua_isnumber(L, 3)) { + if (lua_isstring(L, 3)) { //***TODO*** g_pSingeIn->draw_string((char *)lua_tostring(L, 3), lua_tonumber(L, 1), lua_tonumber(L, 2), g_se_surface); } } diff --git a/singe/singe.h b/singe/singe.h index 9cd4f31f3..7cc10063e 100644 --- a/singe/singe.h +++ b/singe/singe.h @@ -30,7 +30,7 @@ #define SINGE_VERSION 2.00 -#define VERSION_STRING "v2.00" +#define VERSION_STRING "v2.00b4" #define COPYRIGHT_END_YEAR "2020" diff --git a/singe/videoPlayer.c b/singe/videoPlayer.c index 85020f8d7..6319d092e 100644 --- a/singe/videoPlayer.c +++ b/singe/videoPlayer.c @@ -121,7 +121,7 @@ void _dequeueVideoAudio(int channel, void *stream, int bytes, void *udata) { Mix_Volume(channel, MIX_MAX_VOLUME); for (i=0; ivolumeLeft * (float)0.01); - data[i + 1] = (Sint16)((float)data[i] * (float)v->volumeRight * (float)0.01); + data[i + 1] = (Sint16)((float)data[i + 1] * (float)v->volumeRight * (float)0.01); } } }