Cleanup headers in sndlib

Moving common macros into ssl_lib.h
This commit is contained in:
Azamat H. Hackimov 2024-05-20 11:19:24 +03:00
parent 3bd07d1f7e
commit 45ac1cc78a
13 changed files with 62 additions and 180 deletions

View File

@ -76,6 +76,8 @@
#ifndef __SPEW_H_
#define __SPEW_H_
#include "vecmat.h"
#define SF_FORCEUPDATE 0x01 // this spew needs to do an update no matter what next time it spews (gunpoint)
#define SF_UPDATEDFORFRAME 0x02 // thie spew has already updated it's position for this frame, no need to do it again
#define SF_UPDATEEVERYFRAME 0x04

View File

@ -19,7 +19,6 @@
#ifndef GAMEDLL_HEADER_H
#define GAMEDLL_HEADER_H
#include "hlsoundlib.h" //for MAX_GAME_VOLUME
#include "spew.h"
#include "gamefont.h"
#include "hud.h"
@ -54,6 +53,9 @@
#define CEXTERN(a) extern a
#endif
// From ssl_lib.h
#define MAX_GAME_VOLUME 1.0f
#if defined(__LINUX__)
#define DMFCDLLOUT(x) extern "C" x
#else

View File

@ -1,72 +0,0 @@
/*
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __LNX__DD_SOUND_H_
#define __LNX__DD_SOUND_H_
// #include <pthread.h>
#include "SDL_thread.h"
// Sound Library Internal Error Codes
#define SSL_OK 0
#define SSL_ERROR_GENERIC -1
#define SSL_ERROR_SAMPLE_NODATA -2
#define SSL_ERROR_STREAMMIXER -3
// Sound Status
#define SSF_UNUSED 0
#define SSF_PLAY_NORMAL 1
#define SSF_PLAY_LOOPING 2
#define SSF_PAUSED 4
#define SSF_PLAY_STREAMING 8
#define SSF_BUFFERED_LOOP 64
#define SSF_BUFFERED_STRM 128
#define SBT_PRIMARY 0
#define SBT_2D 1
#define SBT_3D 2
// looping methods
#define DSLOOP_SMART_METHOD 0
#define DSLOOP_BUFFER_METHOD 1
#define DSLOOP_STREAM_METHOD 2
#define DSBUFLOOP_INIT_STEP -1
#define DSBUFLOOP_LOOP_STEP 0
#define DSBUFLOOP_FINISH_STEP 1
// used to time threads.
#define DSPB_TICK_INTERVAL .01 // Primary buffer update rate (in seconds)
#define DSPB_TICK_MILLISECONDS (DSPB_TICK_INTERVAL * 1000)
typedef struct LNXSTREAMTAG {
// pthread_t thread_id;
SDL_Thread *thread_id;
unsigned int thread_handle;
volatile bool thread_request_kill;
volatile bool thread_alive;
volatile bool thread_waiting_for_death;
int *sound_device;
void (*fp_SetError)(int code);
void (*fp_ErrorText)(const char *fmt, ...);
int *p_error_code;
} LNXSTREAM;
#endif

View File

@ -65,41 +65,9 @@
#include <windows.h>
#include <mmsystem.h>
#include "win\directx\dsound.h"
#include "win/directx/dsound.h"
#include "ssl_lib.h"
// Sound Library Internal Error Codes
#define SSL_OK 0
#define SSL_ERROR_GENERIC -1
#define SSL_ERROR_SAMPLE_NODATA -2
#define SSL_ERROR_STREAMMIXER -3
// Sound Status
#define SSF_UNUSED 0
#define SSF_PLAY_NORMAL 1
#define SSF_PLAY_LOOPING 2
#define SSF_PAUSED 4
#define SSF_PLAY_STREAMING 8
#define SSF_BUFFERED_LOOP 64
#define SSF_BUFFERED_STRM 128
#define SBT_PRIMARY 0
#define SBT_2D 1
#define SBT_3D 2
// looping methods
#define DSLOOP_SMART_METHOD 0
#define DSLOOP_BUFFER_METHOD 1
#define DSLOOP_STREAM_METHOD 2
#define DSBUFLOOP_INIT_STEP -1
#define DSBUFLOOP_LOOP_STEP 0
#define DSBUFLOOP_FINISH_STEP 1
// used to time threads.
#define DSPB_TICK_INTERVAL .01 // Primary buffer update rate (in seconds)
#define DSPB_TICK_MILLISECONDS (DSPB_TICK_INTERVAL * 1000)
class win_llsSystem;
typedef struct DSLOOPSTREAM {

View File

@ -444,11 +444,11 @@
*/
// High level sound object. This code is 100% machine independant and
// completely encapsulates the lowel-level machine-dependant sound code.
#include "soundload.h"
#include <cstring>
#include "hlsoundlib.h"
#include "ssl_lib.h"
#include <stdio.h>
#include <stdlib.h>
#include "mono.h"
#include "pserror.h"
#include "vecmat.h"
@ -457,7 +457,6 @@
#include "game.h"
#include "room.h"
#include "BOA.h"
#include "mem.h"
#include "streamaudio.h"
#include "doorway.h"
#include "dedicated_server.h"
@ -468,9 +467,9 @@
#if defined(WIN32)
#include "ds3dlib.h"
#elif defined(__LINUX__)
#include "lnxsound.h"
#include "sdlsound.h"
#endif
#include <string.h>
hlsSystem Sound_system;
char Sound_quality = SQT_NORMAL;
char Sound_mixer = SOUND_MIXER_SOFTWARE_16;

View File

@ -16,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cstdlib>
#include <memory.h>
#include <stdlib.h>
#include <stdio.h>
#include "mono.h"
#include "ssl_lib.h"
#include "mixer.h"

View File

@ -21,38 +21,6 @@
#include "ssl_lib.h"
// Sound Library Internal Error Codes
#define SSL_OK 0
#define SSL_ERROR_GENERIC -1
#define SSL_ERROR_SAMPLE_NODATA -2
#define SSL_ERROR_STREAMMIXER -3
// Sound Status
#define SSF_UNUSED 0
#define SSF_PLAY_NORMAL 1
#define SSF_PLAY_LOOPING 2
#define SSF_PAUSED 4
#define SSF_PLAY_STREAMING 8
#define SSF_BUFFERED_LOOP 64
#define SSF_BUFFERED_STRM 128
#define SBT_PRIMARY 0
#define SBT_2D 1
#define SBT_3D 2
// looping methods
#define DSLOOP_SMART_METHOD 0
#define DSLOOP_BUFFER_METHOD 1
#define DSLOOP_STREAM_METHOD 2
#define DSBUFLOOP_INIT_STEP -1
#define DSBUFLOOP_LOOP_STEP 0
#define DSBUFLOOP_FINISH_STEP 1
// This is the update rate at which to call sound_mixer::DoFrame()
// (sleep this amount each frame of the thread)
#define MIXER_TICK_INTERVAL 0.01f
class sound_buffer {
public:
virtual int GetNumBufferBytes(void) = 0;

View File

@ -16,28 +16,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <unistd.h>
#include <fcntl.h>
#include <sys/time.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <errno.h>
#include "cfile.h"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cstdarg>
#include <SDL.h>
#include "pserror.h"
#include "mono.h"
#include "soundload.h"
#include "ssl_lib.h"
#include "mem.h"
#include "application.h"
#include "lnxsound.h"
#include "ddlnxsound.h"
#include "sdlsound.h"
#include "mixer.h"
#include "ddio.h"
#include "SDL.h"
#include "SDL_thread.h"
#include "args.h"
#define SOUNDLIB_SAMPLE_RATE 22050
@ -50,7 +42,6 @@
static sound_buffer_info sound_cache[MAX_SOUNDS_PLAYING_AT_ONCE];
static int sound_buffer_size = MAX_SOUNDS_PLAYING_AT_ONCE;
LNXSTREAM m_sb_info;
lnxsound *ll_sound_ptr;
// A peroidic mixer that uses the primary buffer as a stream buffer

View File

@ -19,7 +19,6 @@
#ifndef __LINUX_DD_SOUND_H_
#define __LINUX_DD_SOUND_H_
#include <pthread.h>
#include "ssl_lib.h"
#include "mixer.h"

View File

@ -49,20 +49,19 @@
*
*/
#ifdef LINUX
#include <cstring>
#endif
#include "hlsoundlib.h"
#include "ddsndgeometry.h"
#include "sndrender.h"
#include "room.h"
#include "object.h"
#include "descent.h"
#include "application.h"
#include "ddio.h"
#include "soundload.h"
#include "gametexture.h"
#ifdef LINUX
#include <string.h>
#endif
static llsGeometry *Geometry = NULL;
static short Sound_room_list[SOUND_RENDER_ROOM_LIMIT + 1];

View File

@ -227,20 +227,15 @@
* $NoKeywords: $
*/
#include "pstypes.h"
#include <cstring>
#include "pserror.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "ssl_lib.h"
#include "object.h"
#include "cfile.h"
#include "ddio.h"
#include "soundload.h"
#include "weapon.h"
#include "ship.h"
#include "pstypes.h"
#include "mem.h"
#include "door.h"
#include "room.h"
#include "doorway.h"

View File

@ -39,11 +39,9 @@
#include <cstdarg>
#include <cstdio>
#include <cstring>
#include "ssl_lib.h"
#include "pserror.h"
#include <string.h>
llsSystem::llsSystem() {
m_lib_error_code = SSL_OK;

View File

@ -262,7 +262,7 @@
class oeApplication; // reference to oeApplication class.
#define MAX_GAME_VOLUME (float)1.0 // helps against clipping
#define MAX_GAME_VOLUME 1.0f // helps against clipping
// Size of streaming buffers
#define STREAM_BUFFER_SIZE 4096 //(4 * 1024)
@ -408,6 +408,39 @@ typedef struct sound_info {
// Sound Library Internal Error Codes
#define SSL_OK 0
#define SSL_ERROR_GENERIC (-1)
#define SSL_ERROR_SAMPLE_NODATA (-2)
#define SSL_ERROR_STREAMMIXER (-3)
// Sound Status
#define SSF_UNUSED 0
#define SSF_PLAY_NORMAL 1
#define SSF_PLAY_LOOPING 2
#define SSF_PAUSED 4
#define SSF_PLAY_STREAMING 8
#define SSF_BUFFERED_LOOP 64
#define SSF_BUFFERED_STRM 128
#define SBT_PRIMARY 0
#define SBT_2D 1
#define SBT_3D 2
// looping methods
#define DSLOOP_SMART_METHOD 0
#define DSLOOP_BUFFER_METHOD 1
#define DSLOOP_STREAM_METHOD 2
#define DSBUFLOOP_INIT_STEP (-1)
#define DSBUFLOOP_LOOP_STEP 0
#define DSBUFLOOP_FINISH_STEP 1
// used to time threads.
// This is the update rate at which to call sound_mixer::DoFrame()
// (sleep this amount each frame of the thread)
#define DSPB_TICK_INTERVAL .01 // Primary buffer update rate (in seconds)
#define DSPB_TICK_MILLISECONDS (DSPB_TICK_INTERVAL * 1000)
// structure to get and set environment values
#define ENV3DVALF_DOPPLER 1