MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / StartVoice

Function StartVoice

Descent3/voice.cpp:136–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136void StartVoice(char *filename, int flags) {
137#ifdef DEMO
138 return;
139#endif
140 if ((!PlayVoices) && (!(flags & VF_FORCE)))
141 return;
142
143 if (flags & VF_PLAYTABLE) {
144 CurrentVoiceHandle.flags = flags;
145 CurrentVoiceHandle.inuse = true;
146 CurrentVoiceHandle.chandle = -1;
147 int index = FindSoundName(IGNORE_TABLE(filename));
148 CurrentVoiceHandle.handle = Sound_system.Play2dSound(index);
149 return;
150 }
151
152 bool compressed = (flags & VF_COMPRESSED) ? true : false;
153 bool bit8 = (flags & VF_8BIT) ? true : false;
154 bool stereo = (flags & VF_STEREO) ? true : false;
155
156 int vf = 0;
157
158 // if(bit8){
159 // if(stereo)
160 // vf = SAF_8BIT_S;
161 // else
162 // vf = SAF_8BIT_M;
163 // }else{
164 // if(stereo)
165 // vf = SAF_16BIT_S;
166 // else
167 // vf = SAF_16BIT_M;
168 // }
169 // if(compressed)
170 // vf |= SAF_COMPRESSED;
171
172 CurrentVoiceHandle.chandle = StreamPlay(filename, (MAX_GAME_VOLUME / 2.0), vf);
173 if (CurrentVoiceHandle.chandle != -1)
174 CurrentVoiceHandle.handle = StreamGetSoundHandle(CurrentVoiceHandle.chandle);
175
176 CurrentVoiceHandle.flags = flags;
177 CurrentVoiceHandle.inuse = true;
178}
179
180void StopVoice(void) {
181 if (CurrentVoiceHandle.inuse) {

Callers 1

UpdateVoicesFunction · 0.85

Calls 4

FindSoundNameFunction · 0.85
StreamPlayFunction · 0.85
StreamGetSoundHandleFunction · 0.85
Play2dSoundMethod · 0.80

Tested by

no test coverage detected