home *** CD-ROM | disk | FTP | other *** search
- /* Emacs style mode select -*- C++ -*- */
- /* ----------------------------------------------------------------------------- */
- /* */
- /* $Id:$ */
- /* */
- /* Copyright (C) 1993-1996 by id Software, Inc. */
- /* */
- /* This source is available for distribution and/or modification */
- /* only under the terms of the DOOM Source Code License as */
- /* published by id Software. All rights reserved. */
- /* */
- /* The source is distributed in the hope that it will be useful, */
- /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
- /* FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License */
- /* for more details. */
- /* */
- /* $Log:$ */
- /* */
- /* DESCRIPTION: */
- /* System interface for sound. */
- /* */
- /* ----------------------------------------------------------------------------- */
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdarg.h>
- #include <string.h>
- #include <unistd.h>
-
- /* Separate sound server process. */
- FILE* sndserver=0;
- char* sndserver_filename = "./sndserver ";
-
- /* */
- /* Starting a sound means adding it */
- /* to the current list of active sounds */
- /* in the internal channels. */
- /* As the SFX info struct contains */
- /* e.g. a pointer to the raw data, */
- /* it is ignored. */
- /* As our sound handling does not handle */
- /* priority, it is ignored. */
- /* Pitching (that is, increased speed of playback) */
- /* is set, but currently not used by mixing. */
- /* */
- int
- I_StartSound_sndserver
- ( int id,
- int vol,
- int sep,
- int pitch,
- int priority )
- {
- if (sndserver)
- {
- fprintf(sndserver, "p%2.2x%2.2x%2.2x%2.2x\n", id, pitch, vol, sep);
- fflush(sndserver);
- }
- /* warning: control reaches end of non-void function. */
- return id;
- }
-
- void I_ShutdownSound_sndserver(void)
- {
- if (sndserver)
- {
- /* Send a "quit" command. */
- fprintf(sndserver, "q\n");
- fflush(sndserver);
- }
- }
-
- void I_InitSound_sndserver()
- {
- char buffer[256];
-
- if (getenv("DOOMWADDIR"))
- sprintf(buffer, "%s/%s",getenv("DOOMWADDIR"),sndserver_filename);
- else
- sprintf(buffer, "%s", sndserver_filename);
-
- /* start sound process */
- if ( !access(buffer, X_OK) )
- {
- strcat(buffer, " -quiet");
- sndserver = popen(buffer, "w");
- }
- else
- fprintf(stderr, "Could not start sound server [%s]\n", buffer);
- }
-