multivoc.h
1 /* 2 Copyright (C) 1994-1995 Apogee Software, Ltd. 3 4 This program is free software; you can redistribute it and/or 5 modify it under the terms of the GNU General Public License 6 as published by the Free Software Foundation; either version 2 7 of the License, or (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. 12 13 See the GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 19 */ 20 /********************************************************************** 21 file: MULTIVOC.H 22 23 author: James R. Dose 24 date: December 20, 1993 25 26 Public header for MULTIVOC.C 27 28 (c) Copyright 1993 James R. Dose. All Rights Reserved. 29 **********************************************************************/ 30 31 #ifndef MULTIVOC_H_ 32 #define MULTIVOC_H_ 33 34 #include "compat.h" 35 #include "log.h" 36 37 #ifdef __cplusplus 38 extern "C" { 39 #endif 40 41 typedef enum wavefmt_t : char 42 { 43 FMT_UNKNOWN, 44 FMT_RAW, 45 FMT_VOC, 46 FMT_WAV, 47 FMT_VORBIS, 48 FMT_FLAC, 49 FMT_XA, 50 FMT_XMP, 51 FMT_MAX 52 } wavefmt_t; 53 54 #define MV_MINVOICEHANDLE 1 55 56 extern int MV_ErrorCode; 57 58 enum MV_Errors 59 { 60 MV_Error = -1, 61 MV_Ok = 0, 62 MV_NotInstalled, 63 MV_DriverError, 64 MV_NoVoices, 65 MV_VoiceNotFound, 66 MV_InvalidFile, 67 }; 68 69 const char *MV_ErrorString(int ErrorNumber); 70 71 extern thread_local int MV_Locked; 72 static FORCE_INLINE void MV_Lock(void) 73 { 74 extern void SoundDriver_PCM_Lock(void); 75 if (!MV_Locked++) 76 SoundDriver_PCM_Lock(); 77 } 78 static FORCE_INLINE void MV_Unlock(void) 79 { 80 extern void SoundDriver_PCM_Unlock(void); 81 82 if (!--MV_Locked) 83 SoundDriver_PCM_Unlock(); 84 else if (MV_Locked < 0) 85 LOG_F(ERROR, "PCM lockdepth < 0!"); 86 } 87 88 int MV_VoicePlaying(int handle); 89 int MV_KillAllVoices(bool useCallBack = true); 90 int MV_Kill(int handle, bool useCallBack = true); 91 int MV_VoicesPlaying(void); 92 int MV_VoiceAvailable(int priority); 93 int MV_SetPitch(int handle, int pitchoffset); 94 int MV_SetFrequency(int handle, int frequency); 95 int MV_GetFrequency(int handle, int *frequency); 96 int MV_PauseVoice(int handle, int pause); 97 int MV_EndLooping(int handle); 98 int MV_SetPan(int handle, int vol, int left, int right); 99 int MV_Pan3D(int handle, int angle, int distance); 100 void MV_SetReverb(int reverb); 101 int MV_GetMaxReverbDelay(void); 102 int MV_GetReverbDelay(void); 103 void MV_SetReverbDelay(int delay); 104 105 int MV_PlayVOC3D(char *ptr, uint32_t length, int loophow, int pitchoffset, int angle, int distance, 106 int priority, fix16_t volume, intptr_t callbackval); 107 int MV_PlayVOC(char *ptr, uint32_t length, int loopstart, int loopend, int pitchoffset, int vol, 108 int left, int right, int priority, fix16_t volume, intptr_t callbackval); 109 110 int MV_StartDemandFeedPlayback(void (*function)(const char** ptr, uint32_t* length, void* userdata), int bitdepth, int channels, int rate, 111 int pitchoffset, int vol, int left, int right, int priority, fix16_t volume, intptr_t callbackval, void* userdata); 112 113 int MV_StartDemandFeedPlayback3D(void (*function)(const char** ptr, uint32_t* length, void* userdata), int bitdepth, int channels, int rate, 114 int pitchoffset, int angle, int distance, int priority, fix16_t volume, intptr_t callbackval, void* userdata); 115 116 decltype(MV_PlayVOC3D) MV_PlayWAV3D; 117 decltype(MV_PlayVOC) MV_PlayWAV; 118 decltype(MV_PlayVOC3D) MV_PlayVorbis3D; 119 decltype(MV_PlayVOC) MV_PlayVorbis; 120 decltype(MV_PlayVOC3D) MV_PlayFLAC3D; 121 decltype(MV_PlayVOC) MV_PlayFLAC; 122 decltype(MV_PlayVOC3D) MV_PlayXA3D; 123 decltype(MV_PlayVOC) MV_PlayXA; 124 decltype(MV_PlayVOC3D) MV_PlayXMP3D; 125 decltype(MV_PlayVOC) MV_PlayXMP; 126 127 int MV_PlayRAW(char *ptr, uint32_t length, int rate, char *loopstart, char *loopend, int pitchoffset, int vol, 128 int left, int right, int priority, fix16_t volume, intptr_t callbackval); 129 130 int MV_IdentifyXMP(char const *ptr, uint32_t length); 131 int MV_GetPosition(int handle, int *position); 132 int MV_SetPosition(int handle, int position); 133 void MV_SetVolume(int volume); 134 int MV_GetVolume(void); 135 void MV_SetCallBack(void (*function)(intptr_t)); 136 137 #ifdef __MSDOS__ 138 #define ASS_REVERSESTEREO 139 void MV_SetReverseStereo(int setting); 140 int MV_GetReverseStereo(void); 141 #endif 142 143 int MV_Init(int soundcard, int MixRate, int Voices, int numchannels, void *initdata); 144 int MV_Shutdown(void); 145 void MV_HookMusicRoutine(void (*callback)(void)); 146 void MV_UnhookMusicRoutine(void); 147 void MV_SetXMPInterpolation(int interp); 148 149 struct MV_MusicRoutineBuffer 150 { 151 char * buffer; 152 int32_t size; 153 }; 154 struct MV_MusicRoutineBuffer MV_GetMusicRoutineBuffer(void); 155 156 #ifdef __cplusplus 157 } 158 #endif 159 160 #endif