1 //-------------------------------------------------------------------------
2 /*
3 Copyright (C) 2010 EDuke32 developers and contributors
4 
5 This file is part of EDuke32.
6 
7 EDuke32 is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License version 2
9 as published by the Free Software Foundation.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 
15 See the GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 */
21 //-------------------------------------------------------------------------
22 
23 //****************************************************************************
24 //
25 // sounds.h
26 //
27 //****************************************************************************
28 
29 #ifndef sounds_public_h_
30 #define sounds_public_h_
31 
32 #include "sounds_common.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 // KEEPINSYNC lunatic/con_lang.lua
39 #define MAXSOUNDS           4096
40 #define MAXSOUNDINSTANCES   8
41 #define LOUDESTVOLUME       111
42 #define MUSIC_ID            -65536
43 
44 typedef struct
45 {
46     int16_t  owner;
47     int16_t  id;
48     uint16_t dist;
49     uint16_t clock;
50 } assvoice_t;
51 
52 typedef struct
53 {
54     char *    ptr, *filename;                // 8b/16b
55     int32_t   length, num, siz;              // 12b
56     fix16_t   volume;                        // 4b
57     assvoice_t voices[MAXSOUNDINSTANCES];  // 64b
58     int16_t   ps, pe, vo;                    // 6b
59     char      pr, m;                         // 2b
60 } sound_t;
61 
62 extern char g_soundlocks[MAXSOUNDS];
63 extern sound_t g_sounds[MAXSOUNDS];
64 extern int32_t g_skillSoundVoice;
65 extern int32_t g_numEnvSoundsPlaying,g_highestSoundIdx;
66 
67 bool A_CheckSoundPlaying(int spriteNum,int soundNum);
68 int A_PlaySound(int soundNum, int spriteNum);
69 void S_Callback(intptr_t num);
70 bool A_CheckAnySoundPlaying(int spriteNum);
71 bool S_CheckSoundPlaying(int spriteNum,int soundNum);
72 void S_Cleanup(void);
73 void S_ClearSoundLocks(void);
74 int32_t S_LoadSound(uint32_t num);
75 void S_PrecacheSounds(void);
76 void S_MenuSound(void);
77 void S_MusicShutdown(void);
78 void S_MusicStartup(void);
79 void S_MusicVolume(int32_t volume);
80 void S_RestartMusic(void);
81 void S_PauseMusic(bool paused);
82 void S_PauseSounds(bool paused);
83 void S_PlayRRMusic(int newTrack = -1);
84 bool S_TryPlayLevelMusic(unsigned int m);
85 void S_PlayLevelMusicOrNothing(unsigned int);
86 int S_TryPlaySpecialMusic(unsigned int);
87 void S_PlaySpecialMusicOrNothing(unsigned int);
88 int S_PlaySound(int num);
89 int S_PlaySound3D(int num, int spriteNum, const vec3_t *pos);
90 void S_SoundShutdown(void);
91 void S_SoundStartup(void);
92 void S_StopEnvSound(int32_t num,int32_t i);
93 void S_StopAllSounds(void);
94 void S_StopMusic(void);
95 void S_Update(void);
96 void S_ChangeSoundPitch(int soundNum, int spriteNum, int pitchoffset);
97 int32_t S_GetMusicPosition(void);
98 void S_SetMusicPosition(int32_t position);
99 
S_IsAmbientSFX(int spriteNum)100 static inline bool S_IsAmbientSFX(int spriteNum)
101 {
102     return (sprite[spriteNum].picnum == MUSICANDSFX && sprite[spriteNum].lotag < 999);
103 }
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif
110