From 53519b85122fca16fbab1b6d5e9b723389c609f3 Mon Sep 17 00:00:00 2001 From: eukos Date: Fri, 31 Jul 2015 00:59:15 +0200 Subject: [PATCH] Better output to /dev/dsp --- WinQuake/model_common.c | 3 --- WinQuake/r_surf.c | 16 ++++++++++------ WinQuake/snd_linux.c | 4 ---- WinQuake/tracker.h | 2 ++ WinQuake/tracker_linux.c | 27 ++++++++++++++++++++------- 5 files changed, 32 insertions(+), 20 deletions(-) diff --git a/WinQuake/model_common.c b/WinQuake/model_common.c index 5c5d183..e6e5c22 100644 --- a/WinQuake/model_common.c +++ b/WinQuake/model_common.c @@ -1243,9 +1243,6 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer, loadedfile_t *brush_fileinf truecolor = (int)r_truecolor->value; // sanity check lowworld = (int)r_lowworld->value; // sanity check ditheredrend = (int)r_dither->value; // sanity checking also - - - // FogTableRefresh(); if (nolookups){ diff --git a/WinQuake/r_surf.c b/WinQuake/r_surf.c index 2b82467..4adf13d 100644 --- a/WinQuake/r_surf.c +++ b/WinQuake/r_surf.c @@ -1371,12 +1371,16 @@ void R_DrawSurface (void) { #ifndef EXPREND if (lowworld){ - if (coloredlights == 1) - if (coloredmethod) pblockdrawer = surfmiptable888RGB[r_drawsurf.surfmip]; // 18-bit lookups - else pblockdrawer = surfmiptable8RGBX[r_drawsurf.surfmip]; // 18-bit lookups - else if (coloredlights == 2) + if (coloredlights == 1) + { + if (coloredmethod) + pblockdrawer = surfmiptable888RGB[r_drawsurf.surfmip]; // 18-bit lookups + else + pblockdrawer = surfmiptable8RGBX[r_drawsurf.surfmip]; // 18-bit lookups + } + else if (coloredlights == 2) pblockdrawer = surfmiptable8RGBXD[r_drawsurf.surfmip]; // 18-bit lookups - else + else pblockdrawer = surfmiptablefast[r_drawsurf.surfmip]; // use old fashioned grays @@ -3891,4 +3895,4 @@ void R_BuildSurfaceDisplayList (msurface_t *fa) poly->numverts = lnumverts; -} \ No newline at end of file +} diff --git a/WinQuake/snd_linux.c b/WinQuake/snd_linux.c index e0e4edd..7345b70 100644 --- a/WinQuake/snd_linux.c +++ b/WinQuake/snd_linux.c @@ -423,10 +423,6 @@ qboolean SNDDMA_Init (void) if (snd_useoss) result = SNDDMA_InitOSS (); -#ifdef RQM_ALSA_TEST - else - result = SNDDMA_InitALSA (); -#endif if (result) { diff --git a/WinQuake/tracker.h b/WinQuake/tracker.h index b5b6e50..44e6f2b 100644 --- a/WinQuake/tracker.h +++ b/WinQuake/tracker.h @@ -17,6 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "dumb.h" + int Tracker_Init(void); void Tracker_Play(byte track, qboolean looping); void Tracker_Stop(void); diff --git a/WinQuake/tracker_linux.c b/WinQuake/tracker_linux.c index 2f8739d..41f0ae3 100644 --- a/WinQuake/tracker_linux.c +++ b/WinQuake/tracker_linux.c @@ -20,13 +20,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "quakedef.h" -#include "dumb.h" - +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // eukara - added in tracker playback using DUMB - UNIX ONLY! char name[256]; DUH *trackmod; // The music file ~eukara DUH_SIGRENDERER *sr; // The DUMB renderer -FILE *oss_device; // output device (by default /dev/dsp for OSS) +int oss_device; // output device (by default /dev/dsp for OSS) // Set up the renderer options static int depth = 16; // by default 16bit, only affects output not internal 32bit processing @@ -177,15 +186,19 @@ void Tracker_Update(void) } // TODO: Write this into the engine's soundbuffer instead for speed! - fwrite(buffer.s8, 1, l * n_channels * (depth >> 3), oss_device); // write it into OSS' device + write (oss_device, &buffer, 4096); } int Tracker_Init(void) { - oss_device = fopen("/dev/dsp", "wb"); // /dev/dsp is the standard OSS output + if((oss_device = open ("/dev/dsp", O_RDWR)) == -1){ + perror("/dev/dsp"); + return 0; + } +/* oss_device = open("/dev/dsp", "wb"); // /dev/dsp is the standard OSS output if(oss_device == NULL) // just get out if there's none return 0; - +*/ Cmd_AddCommand ("dumb", Tracker_f); // link DUMB Con_Printf("DUMB Initialized\n"); // Tell them we are ready return 1; // return that we have successfully initialised @@ -194,6 +207,6 @@ int Tracker_Init(void) void Tracker_Shutdown(void) { Tracker_Stop(); // First stop the track - fclose(oss_device); // Close the device + close(oss_device); // Close the device dumb_exit(); // Kill DUMB }