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 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 typedef enum wavefmt_t : char
41 {
42     FMT_UNKNOWN,
43     FMT_RAW,
44     FMT_VOC,
45     FMT_WAV,
46     FMT_VORBIS,
47     FMT_FLAC,
48     FMT_XA,
49     FMT_XMP,
50     FMT_MAX
51 } wavefmt_t;
52 
53 #define MV_MINVOICEHANDLE 1
54 
55 extern int MV_ErrorCode;
56 
57 enum MV_Errors
58 {
59     MV_Error = -1,
60     MV_Ok = 0,
61     MV_NotInstalled,
62     MV_DriverError,
63     MV_NoVoices,
64     MV_VoiceNotFound,
65     MV_InvalidFile,
66 };
67 
68 extern int (*MV_Printf)(const char *fmt, ...);
69 
70 const char *MV_ErrorString(int ErrorNumber);
71 
72 extern int MV_Locked;
MV_Lock(void)73 static inline void MV_Lock(void)
74 {
75     extern void SoundDriver_PCM_Lock(void);
76 
77     if (!MV_Locked++)
78         SoundDriver_PCM_Lock();
79 }
MV_Unlock(void)80 static inline void MV_Unlock(void)
81 {
82     extern void SoundDriver_PCM_Unlock(void);
83 
84     if (!--MV_Locked)
85         SoundDriver_PCM_Unlock();
86     else if (MV_Locked < 0)
87         MV_Printf("MV_Unlock(): lockdepth < 0!\n");
88 }
89 
90 int  MV_VoicePlaying(int handle);
91 int  MV_KillAllVoices(void);
92 int  MV_Kill(int handle);
93 int  MV_VoicesPlaying(void);
94 int  MV_VoiceAvailable(int priority);
95 int  MV_SetPitch(int handle, int pitchoffset);
96 int  MV_SetFrequency(int handle, int frequency);
97 int  MV_GetFrequency(int handle, int *frequency);
98 int  MV_PauseVoice(int handle, int pause);
99 int  MV_EndLooping(int handle);
100 int  MV_SetPan(int handle, int vol, int left, int right);
101 int  MV_Pan3D(int handle, int angle, int distance);
102 void MV_SetReverb(int reverb);
103 int  MV_GetMaxReverbDelay(void);
104 int  MV_GetReverbDelay(void);
105 void MV_SetReverbDelay(int delay);
106 
107 int MV_PlayVOC3D(char *ptr, uint32_t length, int loophow, int pitchoffset, int angle, int distance,
108                  int priority, fix16_t volume, intptr_t callbackval);
109 int MV_PlayVOC(char *ptr, uint32_t length, int loopstart, int loopend, int pitchoffset, int vol,
110                int left, int right, int priority, fix16_t volume, intptr_t callbackval);
111 
112 int MV_StartDemandFeedPlayback(void (*function)(const char** ptr, uint32_t* length, void* userdata), int bitdepth, int channels, int rate,
113     int pitchoffset, int vol, int left, int right, int priority, fix16_t volume, intptr_t callbackval, void* userdata);
114 
115 int MV_StartDemandFeedPlayback3D(void (*function)(const char** ptr, uint32_t* length, void* userdata), int bitdepth, int channels, int rate,
116     int pitchoffset, int angle, int distance, int priority, fix16_t volume, intptr_t callbackval, void* userdata);
117 
118 decltype(MV_PlayVOC3D) MV_PlayWAV3D;
119 decltype(MV_PlayVOC)   MV_PlayWAV;
120 decltype(MV_PlayVOC3D) MV_PlayVorbis3D;
121 decltype(MV_PlayVOC)   MV_PlayVorbis;
122 decltype(MV_PlayVOC3D) MV_PlayFLAC3D;
123 decltype(MV_PlayVOC)   MV_PlayFLAC;
124 decltype(MV_PlayVOC3D) MV_PlayXA3D;
125 decltype(MV_PlayVOC)   MV_PlayXA;
126 decltype(MV_PlayVOC3D) MV_PlayXMP3D;
127 decltype(MV_PlayVOC)   MV_PlayXMP;
128 
129 int MV_PlayRAW(char *ptr, uint32_t length, int rate, char *loopstart, char *loopend, int pitchoffset, int vol,
130                int left, int right, int priority, fix16_t volume, intptr_t callbackval);
131 
132 int  MV_IdentifyXMP(char const *ptr, uint32_t length);
133 int  MV_GetPosition(int handle, int *position);
134 int  MV_SetPosition(int handle, int position);
135 void MV_SetVolume(int volume);
136 int  MV_GetVolume(void);
137 void MV_SetCallBack(void (*function)(intptr_t));
138 
139 #ifdef __MSDOS__
140 #define ASS_REVERSESTEREO
141 void MV_SetReverseStereo(int setting);
142 int  MV_GetReverseStereo(void);
143 #endif
144 
145 int  MV_Init(int soundcard, int MixRate, int Voices, int numchannels, void *initdata);
146 int  MV_Shutdown(void);
147 void MV_HookMusicRoutine(void (*callback)(void));
148 void MV_UnhookMusicRoutine(void);
149 void MV_SetXMPInterpolation(void);
150 
151 struct MV_MusicRoutineBuffer
152 {
153     char * buffer;
154     int32_t size;
155 };
156 struct MV_MusicRoutineBuffer MV_GetMusicRoutineBuffer(void);
157 
MV_SetPrintf(int (* function)(const char *,...))158 static inline void MV_SetPrintf(int (*function)(const char *, ...)) { if (function) MV_Printf = function; }
159 
160 #ifdef __cplusplus
161 }
162 #endif
163 
164 #endif
165