2015-05-19 21:54:34 +00:00
//-------------------------------------------------------------------------
/*
Copyright ( C ) 1997 , 2005 - 3 D Realms Entertainment
This file is part of Shadow Warrior version 1.2
Shadow Warrior 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 2
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 , write to the Free Software
Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 , USA .
Original Source : 1997 - Frank Maddin and Jim Norwood
Prepared for public release : 03 / 28 / 2005 - Charlie Wiederhold , 3 D Realms
*/
//-------------------------------------------------------------------------
//****************************************************************************
//
// sounds.h
//
//****************************************************************************
# include "mytypes.h"
2019-10-09 17:58:09 +00:00
# ifndef sw_sounds_public_
# define sw_sounds_public_
2015-05-19 21:54:34 +00:00
2019-10-09 16:09:05 +00:00
BEGIN_SW_NS
2015-05-19 21:54:34 +00:00
void SoundStartup ( void ) ;
void SoundShutdown ( void ) ;
void MusicStartup ( void ) ;
void MusicShutdown ( void ) ;
// 3D sound engine declarations //////////////////////////////////////////////
// Flag settings used to turn on and off 3d sound options
2019-04-08 06:26:03 +00:00
enum
2015-05-19 21:54:34 +00:00
{
v3df_none = 0 , // Default, take no action, use all defaults
v3df_follow = 1 , // 1 = Do coordinate updates on sound
// Use this only if the sprite won't be deleted soon
v3df_kill = 2 , // 1 = Sound is to be deleted
v3df_doppler = 4 , // 1 = Don't use doppler pitch variance
v3df_dontpan = 8 , // 1 = Don't do panning of sound
v3df_ambient = 16 , // 1 = Sound is ambient, use ambient struct info.
v3df_intermit = 32 , // 1 = Intermittant sound
v3df_init = 64 , // 1 = First pass of sound, don't play it.
// This is mainly used for intermittent sounds
2019-12-18 10:09:01 +00:00
v3df_nolookup = 128 , // don't use ambient table lookup
2019-04-08 06:26:03 +00:00
} ;
typedef int Voc3D_Flags ;
2015-05-19 21:54:34 +00:00
struct VOCstruct ;
typedef struct VOCstruct VOC_INFO , * VOC_INFOp ;
2019-12-18 21:13:19 +00:00
#if 0
2015-05-19 21:54:34 +00:00
struct VOC3Dstruct ;
typedef struct VOC3Dstruct VOC3D_INFO , * VOC3D_INFOp ;
2019-12-18 21:13:19 +00:00
# endif
2015-05-19 21:54:34 +00:00
struct ambientstruct ;
typedef struct ambientstruct AMB_INFO , * AMB_INFOp ;
void Terminate3DSounds ( void ) ;
void Set3DSoundOwner ( short spritenum ) ;
void PlaySpriteSound ( short spritenum , int attrib_ndx , Voc3D_Flags flags ) ;
void DeleteNoSoundOwner ( short spritenum ) ;
void DeleteNoFollowSoundOwner ( short spritenum ) ;
2019-12-18 10:09:01 +00:00
inline SWBOOL CacheSound ( int num , int type ) { return false ; }
2015-05-19 21:54:34 +00:00
void COVER_SetReverb ( int amt ) ;
2015-05-19 21:58:29 +00:00
void UnInitSound ( void ) ;
2015-05-19 21:54:34 +00:00
void InitFX ( void ) ;
2015-05-19 21:58:29 +00:00
void StopFX ( void ) ;
2015-05-19 21:54:34 +00:00
void StopSound ( void ) ;
void StartAmbientSound ( void ) ;
void StopAmbientSound ( void ) ;
2019-12-07 18:57:19 +00:00
SWBOOL PlaySong ( const char * mapname , const char * song_file_name , int cdaudio_track , bool isThemeTrack = false ) ; //(nullptr, nullptr, -1, false) starts the normal level music.
2015-05-19 21:58:29 +00:00
void PlaySoundRTS ( int rts_num ) ;
2015-05-19 21:54:34 +00:00
//
// Standard VOC format information - generally don't need this
//
typedef struct
{
2015-05-19 21:58:29 +00:00
uint8_t filler [ 0x1a ] ;
uint8_t type ;
uint32_t length ;
uint8_t filler2 ;
uint8_t freq ;
uint8_t pack ;
uint8_t data [ 1 ] ;
2015-05-19 21:54:34 +00:00
} * VOC_HDRp ;
// Ambient Sound Structure
struct ambientstruct
{
2015-05-19 21:58:29 +00:00
int16_t name ;
int16_t diginame ;
2015-05-19 21:54:34 +00:00
Voc3D_Flags ambient_flags ;
int maxtics ; // When tics reaches this number next
// sound happens
} ;
// VOC File flag settings for digi_entries.
2019-04-08 06:26:03 +00:00
enum
2015-05-19 21:54:34 +00:00
{
vf_normal = 0 ,
vf_loop = 1
2019-04-08 06:26:03 +00:00
} ;
typedef int Voc_Flags ;
2015-05-19 21:54:34 +00:00
//
// Table that describes the voc file and how it will be played
// Can be easily extended, but you may need to change digi.h
//
//struct STATEstruct;
//typedef struct VOCstruct VOC_INFO, *VOC_INFOp;
struct VOCstruct
{
char name [ 14 ] ; // name of voc file on disk
2015-05-19 21:58:29 +00:00
uint8_t * data ; // pointer to voc data
2015-05-19 21:54:34 +00:00
int datalen ; // length of voc data
2015-05-19 21:58:29 +00:00
int16_t pitch_lo ; // lo pitch value
int16_t pitch_hi ; // hi pitch value
uint8_t priority ; // priority at which vocs are played
int16_t voc_num ; // Backward reference to parent sound
2015-05-19 21:54:34 +00:00
int voc_distance ; // Sound's distance effectiveness
Voc_Flags voc_flags ; // Various allowable flag settings for voc
2019-12-17 22:25:07 +00:00
uint16_t lock ; // locking byte for caching
2015-05-19 21:58:29 +00:00
uint8_t playing ; // number of this type of sound currently playing
2015-05-19 21:54:34 +00:00
} ;
// JIMSOUND3D(tm) variables section //////////////////////////////////////////
2019-12-18 21:13:19 +00:00
#if 0
2015-05-19 21:54:34 +00:00
struct VOC3Dstruct
{
VOC_INFOp vp ; // Pointer to the sound
int * x ; // Pointer to x coordinate
int * y ; // Pointer to y coordinate
int * z ; // Pointer to z coordinate
int fx , fy , fz ; // Non-Follow literal values
Voc3D_Flags flags ; // 3d voc sound flags
int handle ; // Current handle to the voc
short doplr_delta ; // Change in distance since last call
VOC3D_INFOp prev , next ; // Linked voc list
short owner ; // Hold index into user array to
// delete looping sounds
int num ; // Digital Entry number used for
// callback of looping sounds
// If sound is active but user == 0, stop the sound
short dist ; // Current distance of sound from player
2015-05-19 21:58:29 +00:00
uint8_t priority ; // Used to force a higher priority based on distance
2015-05-19 21:54:34 +00:00
int tics ; // Tics used to count to next sound occurance
int maxtics ; // Tics until next sound occurance
// for intermittent sounds
2015-05-19 21:58:29 +00:00
SWBOOL deleted ; // Has sound been marked for deletion?
SWBOOL FX_Ok ; // Did this sound play ok?
2015-05-19 21:54:34 +00:00
} ;
2019-12-18 21:13:19 +00:00
# endif
2015-05-19 21:54:34 +00:00
extern VOC_INFO voc [ ] ;
2019-10-09 16:09:05 +00:00
END_SW_NS
2015-05-19 21:54:34 +00:00
# endif