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 #define MAXSOUNDS 4096
39 #define MAXSOUNDINSTANCES 8
40 #define LOUDESTVOLUME 111
41 #define MUSIC_ID -65536
42 #define MAXVOICES 128
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 float 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_numEnvSoundsPlaying,g_highestSoundIdx;
65
66 extern int32_t MusicIsWaveform;
67
68 int A_CheckSoundPlaying(int spriteNum,int soundNum);
69 int A_PlaySound(int soundNum, int spriteNum);
70 void S_Callback(intptr_t num);
71 int A_CheckAnySoundPlaying(int spriteNum);
72 int S_CheckSoundPlaying(int soundNum);
73 void S_Cleanup(void);
74 void S_ClearSoundLocks(void);
75 int32_t S_LoadSound(uint32_t num);
76 void cacheAllSounds(void);
77 void S_MenuSound(void);
78 void S_MusicShutdown(void);
79 void S_MusicStartup(void);
80 void S_MusicVolume(int32_t volume);
81 void S_RestartMusic(void);
82 void S_PauseMusic(bool paused);
83 void S_PauseSounds(bool paused);
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 void S_ContinueLevelMusic(void);
89 int S_PlaySound(int num);
90 int S_PlaySound3D(int num, int spriteNum, const vec3_t *pos);
91 void S_SoundShutdown(void);
92 void S_SoundStartup(void);
93 void S_StopEnvSound(int sndNum,int sprNum);
94 void S_StopAllSounds(void);
95 void S_StopMusic(void);
96 void S_Update(void);
97 void S_ChangeSoundPitch(int soundNum, int spriteNum, int pitchoffset);
98 int32_t S_GetMusicPosition(void);
99 void S_SetMusicPosition(int32_t position);
100
S_IsAmbientSFX(int spriteNum)101 static inline bool S_IsAmbientSFX(int spriteNum)
102 {
103 return (sprite[spriteNum].picnum == MUSICANDSFX && sprite[spriteNum].lotag < 999);
104 }
105
106 #ifdef __cplusplus
107 }
108 #endif
109
110 #endif
111