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

Function TelcomStartSound

Descent3/TelCom.cpp:3312–3335  ·  view source on GitHub ↗

Starts a sound playing (if it isn't already)

Source from the content-addressed store, hash-verified

3310
3311// Starts a sound playing (if it isn't already)
3312void TelcomStartSound(int sid) {
3313 ASSERT(sid >= 0 && sid < TCSND_SOUNDCOUNT);
3314
3315 // make sure the handle is there
3316 if (TelcomSounds[sid].handle == -1) {
3317 mprintf(0, "TelCom Sound Warning: '%s' hasn't been loaded yet, trying to load\n", TCSoundFiles[sid]);
3318 TelcomSounds[sid].handle = FindSoundName(IGNORE_TABLE(TCSoundFiles[sid]));
3319
3320 if (TelcomSounds[sid].handle == -1) {
3321 mprintf(0, "TelCom Sound Warning: 2nd try failed, bailing\n");
3322 return;
3323 }
3324 }
3325
3326 // see if the sound is already playing
3327 if (TelcomSounds[sid].hlhandle != -1) {
3328 if (Sound_system.IsSoundPlaying(TelcomSounds[sid].hlhandle)) {
3329 // the sound is still playing, we don't need to play again
3330 return;
3331 }
3332 }
3333
3334 TelcomSounds[sid].hlhandle = Sound_system.Play2dSound(TelcomSounds[sid].handle, MAX_GAME_VOLUME);
3335}
3336
3337// Stops a sound playing
3338void TelcomStopSound(int sid) {

Callers 4

TelComMainFunction · 0.85
TelcomDrawScreenFunction · 0.85
TCSSButtonCallbackFunction · 0.85
RenderTextTypeFunction · 0.85

Calls 3

FindSoundNameFunction · 0.85
Play2dSoundMethod · 0.80
IsSoundPlayingMethod · 0.45

Tested by

no test coverage detected