1 //Copyright Paul Reiche, Fred Ford. 1992-2002 2 3 /* 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 */ 18 19 #ifndef LIBS_SNDLIB_H_ 20 #define LIBS_SNDLIB_H_ 21 22 #include "port.h" 23 #include "libs/strlib.h" 24 25 #if defined(__cplusplus) 26 extern "C" { 27 #endif 28 29 typedef STRING_TABLE SOUND_REF; 30 typedef STRING SOUND; 31 // SOUNDPTR is really a TFB_SoundSample** 32 typedef void *SOUNDPTR; 33 34 typedef struct soundposition 35 { 36 BOOLEAN positional; 37 int x, y; 38 } SoundPosition; 39 40 #define InitSoundResources InitStringTableResources 41 #define CaptureSound CaptureStringTable 42 #define ReleaseSound ReleaseStringTable 43 #define GetSoundRef GetStringTable 44 #define GetSoundCount GetStringTableCount 45 #define GetSoundIndex GetStringTableIndex 46 #define SetAbsSoundIndex SetAbsStringTableIndex 47 #define SetRelSoundIndex SetRelStringTableIndex 48 49 extern SOUNDPTR GetSoundAddress (SOUND sound); 50 51 typedef struct tfb_soundsample TFB_SoundSample; 52 typedef TFB_SoundSample **MUSIC_REF; 53 54 extern BOOLEAN InitSound (int argc, char *argv[]); 55 extern void UninitSound (void); 56 extern SOUND_REF LoadSoundFile (const char *pStr); 57 extern MUSIC_REF LoadMusicFile (const char *pStr); 58 extern BOOLEAN InstallAudioResTypes (void); 59 extern SOUND_REF LoadSoundInstance (RESOURCE res); 60 extern MUSIC_REF LoadMusicInstance (RESOURCE res); 61 extern BOOLEAN DestroySound (SOUND_REF SoundRef); 62 extern BOOLEAN DestroyMusic (MUSIC_REF MusicRef); 63 64 #define MAX_CHANNELS 8 65 #define MAX_VOLUME 255 66 #define NORMAL_VOLUME 160 67 68 #define FIRST_SFX_CHANNEL 0 69 #define MIN_FX_CHANNEL 1 70 #define NUM_FX_CHANNELS 4 71 #define LAST_SFX_CHANNEL (MIN_FX_CHANNEL + NUM_FX_CHANNELS - 1) 72 #define NUM_SFX_CHANNELS (MIN_FX_CHANNEL + NUM_FX_CHANNELS) 73 74 extern void PLRPlaySong (MUSIC_REF MusicRef, BOOLEAN Continuous, BYTE 75 Priority); 76 extern void PLRStop (MUSIC_REF MusicRef); 77 extern BOOLEAN PLRPlaying (MUSIC_REF MusicRef); 78 extern void PLRSeek (MUSIC_REF MusicRef, DWORD pos); 79 extern void PLRPause (MUSIC_REF MusicRef); 80 extern void PLRResume (MUSIC_REF MusicRef); 81 extern void snd_PlaySpeech (MUSIC_REF SpeechRef); 82 extern void snd_StopSpeech (void); 83 extern void PlayChannel (COUNT channel, SOUND snd, SoundPosition pos, 84 void *positional_object, unsigned char priority); 85 extern BOOLEAN ChannelPlaying (COUNT Channel); 86 extern void * GetPositionalObject (COUNT channel); 87 extern void SetPositionalObject (COUNT channel, void *positional_object); 88 extern void UpdateSoundPosition (COUNT channel, SoundPosition pos); 89 extern void StopChannel (COUNT Channel, BYTE Priority); 90 extern void SetMusicVolume (COUNT Volume); 91 extern void SetChannelVolume (COUNT Channel, COUNT Volume, BYTE 92 Priority); 93 94 extern void StopSound (void); 95 extern BOOLEAN SoundPlaying (void); 96 97 extern void WaitForSoundEnd (COUNT Channel); 98 #define TFBSOUND_WAIT_ALL ((COUNT)~0) 99 100 extern DWORD FadeMusic (BYTE end_vol, SIZE TimeInterval); 101 102 #if defined(__cplusplus) 103 } 104 #endif 105 106 #endif /* LIBS_SNDLIB_H_ */ 107 108