Descent3/dd_lnxsound/ddlnxsound.h

73 lines
1.9 KiB
C
Raw Normal View History

/*
* 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/>.
*/
2024-04-16 03:43:29 +00:00
#ifndef __LNX__DD_SOUND_H_
#define __LNX__DD_SOUND_H_
2024-04-16 20:59:11 +00:00
// #include <pthread.h>
2024-04-16 03:43:29 +00:00
#include "SDL_thread.h"
// Sound Library Internal Error Codes
2024-04-16 18:56:40 +00:00
#define SSL_OK 0
#define SSL_ERROR_GENERIC -1
#define SSL_ERROR_SAMPLE_NODATA -2
#define SSL_ERROR_STREAMMIXER -3
2024-04-16 03:43:29 +00:00
// Sound Status
2024-04-16 18:56:40 +00:00
#define SSF_UNUSED 0
#define SSF_PLAY_NORMAL 1
#define SSF_PLAY_LOOPING 2
#define SSF_PAUSED 4
2024-04-16 03:43:29 +00:00
#define SSF_PLAY_STREAMING 8
2024-04-16 18:56:40 +00:00
#define SSF_BUFFERED_LOOP 64
#define SSF_BUFFERED_STRM 128
2024-04-16 03:43:29 +00:00
2024-04-16 18:56:40 +00:00
#define SBT_PRIMARY 0
#define SBT_2D 1
#define SBT_3D 2
2024-04-16 03:43:29 +00:00
// looping methods
2024-04-16 18:56:40 +00:00
#define DSLOOP_SMART_METHOD 0
#define DSLOOP_BUFFER_METHOD 1
#define DSLOOP_STREAM_METHOD 2
2024-04-16 03:43:29 +00:00
2024-04-16 18:56:40 +00:00
#define DSBUFLOOP_INIT_STEP -1
#define DSBUFLOOP_LOOP_STEP 0
#define DSBUFLOOP_FINISH_STEP 1
2024-04-16 03:43:29 +00:00
// used to time threads.
2024-04-16 18:56:40 +00:00
#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;
2024-04-16 18:56:40 +00:00
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, ...);
2024-04-16 18:56:40 +00:00
int *p_error_code;
2024-04-16 03:43:29 +00:00
} LNXSTREAM;
#endif