Rise
The Vieneo Province
Sound.cpp
Go to the documentation of this file.
1 #include "Sound.h"
2 #include "bass_fx.h"
3 #include "GameClass.h"
5 #include <algorithm>
6 #include "MathUtilities.h"
7 
8 char* Sound::sound_path[] = // this is causing compilation problems, where does it need to go?
9  //it can be private to the sound class
10 {
11  "", "", "", "", "", "", "", "", "", "", "", "", // COCKPIT
12  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", // GPWS
13  "", "", "", "", "", // TCAS
14  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", // OTHER
15 
16  "Sounds\\Weather\\c2thun1a.wav",
17  "Sounds\\Weather\\c2thun1b.wav",
18  "Sounds\\Weather\\c2thun1c.wav",
19  "Sounds\\Weather\\c2thun2a.wav",
20  "Sounds\\Weather\\c2thun2b.wav",
21  "Sounds\\Weather\\c2thun2c.wav",
22  "Sounds\\Weather\\c2thun3a.wav",
23  "Sounds\\Weather\\c2thun3b.wav",
24  "Sounds\\Weather\\c2thun3c.wav",
25  "Sounds\\Weather\\c2thun4a.wav",
26  "Sounds\\Weather\\c2thun4b.wav",
27  "Sounds\\Weather\\c2thun4c.wav",
28  "Sounds\\Weather\\c2thun5a.wav",
29  "Sounds\\Weather\\c2thun5b.wav",
30  "Sounds\\Weather\\c2thun5c.wav",
31  "Sounds\\Weather\\c2prec0.wav",
32  "Sounds\\Weather\\c2prec1.wav",
33  "Sounds\\Weather\\c2prec2.wav",
34  "Sounds\\Weather\\c2prec3.wav",
35  "Sounds\\Weather\\c2prec4.wav",
36  "Sounds\\Weather\\c5wind3.wav",
37  "Sounds\\Weather\\speakerpop.wav",
38 
39  "Sounds\\GUI\\mouseover.wav",
40  "Sounds\\GUI\\mouseclick.wav",
41  "Sounds\\GUI\\snapshot.wav",
42  "Sounds\\GUI\\chat.wav",
43  "Sounds\\GUI\\logon.wav",
44  "Sounds\\GUI\\logoff.wav",
45  "Sounds\\GUI\\newmsg.wav",
46  "Sounds\\GUI\\repair.wav",
47  "Sounds\\GUI\\cha-ching.wav",
48  "Sounds\\GUI\\information.wav",
49  "Sounds\\GUI\\construction.mp3",
50  "Sounds\\GUI\\success.mp3",
51  "Sounds\\GUI\\taxi.wav",
52  "Sounds\\GUI\\scanning.wav",
53  "Sounds\\GUI\\newsflash.mp3",
54  "Sounds\\Holidays\\christmas1.wav",
55  "Sounds\\Holidays\\halloween3.mp3",
56 
57  "Sounds\\Instruments\\coupleraltitude.wav",
58  "Sounds\\Instruments\\ky100 hi low tone.wav",
59  "Sounds\\Instruments\\napdisco.wav",
60  "Sounds\\Instruments\\naltcap.wav",
61  "Sounds\\Instruments\\cycletarget.wav",
62  "Sounds\\Instruments\\midway.wav",
63  "Sounds\\Instruments\\proximity.wav",
64  "Sounds\\Instruments\\outer-marker.wav",
65  "Sounds\\Instruments\\middle-marker.wav",
66  "Sounds\\Instruments\\inner-marker.wav",
67  "Sounds\\warning.wav",
68  "Sounds\\caution.wav",
69 
70  "Sounds\\Docks\\TURGRND0.wav",
71  "Sounds\\Docks\\TURGRND1.wav",
72  "Sounds\\Docks\\TURGRND2.wav",
73  "Sounds\\Docks\\TURGRND3.wav",
74  "Sounds\\Docks\\TURGRND4.wav",
75  "Sounds\\Docks\\TURGRND5.wav",
76  "Sounds\\Docks\\TURGRND6.wav",
77  "Sounds\\Docks\\TURGRND7.wav",
78  "Sounds\\Docks\\TURGRND8.wav",
79  "Sounds\\Docks\\TURGRND9.wav",
80  "Sounds\\Docks\\TURGRNDA.wav",
81  "Sounds\\Docks\\TURGRNDB.wav",
82  "Sounds\\Docks\\TURGEVAC.wav",
83  "Sounds\\Docks\\CHIME_A.wav",
84 
85  "Sounds\\Docks\\CPOC\\cpoc2.wav",
86  "Sounds\\Docks\\CPOC\\cpoc3.wav",
87  "Sounds\\Docks\\CPOC\\cpoc4.wav",
88  "Sounds\\Docks\\CPOC\\cpoc5.wav",
89  "Sounds\\Docks\\CPOC\\cpoc6.wav",
90  "Sounds\\Docks\\CPOC\\cpoc7.wav",
91  "Sounds\\Docks\\CPOC\\cpoc8.wav",
92  "Sounds\\Docks\\CPOC\\cpoc9.wav",
93  "Sounds\\Docks\\CPOC\\cpoc10.wav",
94  "Sounds\\Docks\\CPOC\\cpoc14.wav",
95  "Sounds\\Docks\\CPOC\\cpoc15.wav",
96  "Sounds\\Docks\\CPOC\\cpoc16.wav",
97  "Sounds\\Docks\\CPOC\\evac.wav",
98  "Sounds\\Docks\\CPOC\\chime.wav",
99 
100  "Sounds\\DOCK.wav",
101  "Sounds\\RELEASE.wav",
102 
104  "Sounds\\flap motor.wav", // internal only, not GV's
106  "Sounds\\cargo-open.wav",
108  "Sounds\\cargo-close.wav",
110  "Sounds\\GEARUP.wav", // internal only, not GV's
112  "Sounds\\GEARDOWN.wav", // internal only, not GV's
113  "Sounds\\dihv.wav",
114  "Sounds\\Ambient\\mining.wav",
115  "Sounds\\Ambient\\waveloop.wav",
116  "Sounds\\Ambient\\AlgaeFarmPumps.wav",
117  "Sounds\\Ambient\\IndustrialDistrict.wav",
118  "Sounds\\Fireworks\\launch1.wav",
119  "Sounds\\Fireworks\\launch2.wav",
120  "Sounds\\Fireworks\\launch3.wav",
121  "Sounds\\Fireworks\\explode1.wav",
122  "Sounds\\Fireworks\\explode2.wav",
123  "Sounds\\Fireworks\\explode3.wav",
124  "Sounds\\sonicboom.wav",
125  "Sounds\\bnsplas1.wav",
126  "Sounds\\bnsplas2.wav",
127  "Sounds\\bncrash1.wav",
128  "Sounds\\bncrash2.wav",
129  "Sounds\\int_wingbreak01.wav",
130  "Sounds\\int_wingbreak02.wav",
131  "Sounds\\int_tailbreak01.wav",
132  "Sounds\\int_tailbreak02.wav",
133  "Sounds\\collision.wav",
134  "Sounds\\smallcollide.wav",
135  "Sounds\\tireskid.wav",
136  "Sounds\\gearshift.wav", // internal only, only GVs
137  "Sounds\\geargrind.wav", // internal only, only GVs
138  "Sounds\\jsplash1.wav",
139  "Sounds\\jsplash2.wav",
140  "Sounds\\GEARAERO.wav", // internal only, not GV's
141  "Sounds\\flap aero.wav",
142  "Sounds\\doppler.wav",
143  "Sounds\\doppler2.wav",
144  "Sounds\\horn.wav",
145  "Sounds\\ecto1.wav",
146  "Sounds\\MammothHorn.wav",
147  "Sounds\\steerhead_horn.wav",
148  "Sounds\\steerhead_reverse.wav",
149  "Sounds\\steerhead_brakeon.wav",
150  "Sounds\\steerhead_brakeoff.wav",
151  "Sounds\\MammothBackup.wav",
152  "Sounds\\MammothBrakeOn.wav",
153  "Sounds\\MammothBrakeOff.wav",
154  "Sounds\\police-chirp.wav",
155  "Sounds\\rumble1.wav", // internal only? thrust, not GV's
156  "Sounds\\ground-scrape-loop.wav",
157  "Sounds\\ground-scrape-stop.wav",
158  "Sounds\\road-noise-loop.wav",
159 
160  "Sounds\\People\\bodyhit.wav", // internal only?
161 
162  // Seasonal
163  "Sounds\\Holidays\\halloween1.wav",
164  "Sounds\\Holidays\\halloween2.wav",
165 
166  "Sounds\\Explosions\\fuzerhit.wav",
167  "Sounds\\Explosions\\sinkerhit.wav",
168  "Sounds\\Explosions\\explode_planet_ground1.wav",
169  "Sounds\\Explosions\\explode_planet_ground2.wav",
170  "Sounds\\Explosions\\explode_planet_ground3.wav",
171  "Sounds\\Explosions\\Sputter.wav",
172  "Sounds\\Explosions\\sinkerint.wav",
173  "Sounds\\Explosions\\encrash1.wav",
174  "Sounds\\Explosions\\8000.wav",
175  "Sounds\\Explosions\\shockwave.mp3",
176 
177  "Sounds\\Weapons\\fuzerfire.wav",
178  "Sounds\\Weapons\\sinkerLaunch.wav",
179  "Sounds\\Weapons\\missile_launch2.wav",
180 
181  "Sounds\\Radio\\radiocut1.wav",
182  "Sounds\\Radio\\radiocut2.wav",
183  "Sounds\\Radio\\radiocut3.wav",
184  "Sounds\\Radio\\radiocut4.wav",
185  "Sounds\\Radio\\radiocut5.wav",
186  "Sounds\\Radio\\radiocut6.wav",
187 
188  "Sounds\\Radio\\carrier0.mp3", // ATC
189  "Sounds\\Radio\\carrier1.mp3",
190  "Sounds\\Radio\\carrier2.mp3",
191  "Sounds\\Radio\\carrier3.mp3",
192  "Sounds\\Radio\\carrier4.mp3",
193  "Sounds\\Radio\\carrier5.mp3",
194  "Sounds\\Radio\\carrier6.mp3",
195  "Sounds\\Radio\\carrier7.mp3",
196  "Sounds\\Radio\\carrier8.mp3",
197  "Sounds\\Radio\\carrier9.mp3",
198  "Sounds\\Radio\\carrier10.mp3",
199  "Sounds\\Radio\\carrier11.mp3",
200 
201  "Sounds\\Radio\\stationid2.mp3"
202 };
203 
205 {
206  game = gameptr;
207 
208  if (HIWORD(BASS_FX_GetVersion()) != BASSVERSION)
209  {
210  char msg[99];
211  sprintf_s(msg, 99, "FX version does not match BASS version: %i", BASSVERSION);
212  Trace(msg, Logger::Level::Error);
213  }
214 
215  Init();
216 }
217 
219 {
220  deviceNames.clear();
221  deviceGuids.clear();
222  int count = 0; // the device counter, 0 is no sound
223  BASS_DEVICEINFO info;
224  while (BASS_GetDeviceInfo(count, &info))
225  {
226  if (info.flags & BASS_DEVICE_ENABLED)
227  deviceNames.emplace_back(info.name);
228  else
229  deviceNames.emplace_back("DISCONNECTED");
230 
231  if (info.driver)
232  {
233  WCHAR guidText[64];
234  swprintf_s(guidText, 64, L"%S", &info.driver[17]);
235  CLSID clsid;
236  if (CLSIDFromString(guidText, &clsid) == NOERROR)
237  deviceGuids.emplace_back(clsid);
238  else
239  deviceGuids.emplace_back(MYGUID_NULL);
240  }
241  else
242  deviceGuids.emplace_back(MYGUID_NULL);
243 
244  count++;
245  }
246 }
247 
249 {
250  issuedWarning = false;
251 
252  radio = NULL;
253 
254  for (short t = 0; t < SOUND_ENUMERATION; t++)
255  {
256  sound_sample[t] = NULL;
257  sound_channel[t] = NULL;
258  sound_device[t] = 0;
259  sound_config[t] = nullptr;
260  }
261 
262  EnumDevices();
263 
264  Trace("Loading legacy sound driver...");
266  Trace("Loading comms sound driver...");
268  Trace("Loading VMU sound driver...");
270  Trace("Loading radio sound driver...");
272 }
273 
274 void Sound::InitDevice(SoundConfig* deviceConfig) // passed in -1
275 {
276  if (deviceConfig->guid == MYGUID_NULL)
277  return;
278 
279  // find the bassDevice from the list of deviceGuids
280  deviceConfig->bassDevice = -1;
281  for (UINT i = 1; i < deviceGuids.size(); i++) // first real device
282  {
283  if (deviceGuids.at(i) == deviceConfig->guid)
284  deviceConfig->bassDevice = i;
285  }
286 
287  // didn't find it, what do we do? kill it?
288  if (deviceConfig->bassDevice == -1)
289  {
290  if (deviceConfig->guid != MYGUID_DEFAULT)
291  {
292  WCHAR guidText[64];
293  StringFromGUID2(deviceConfig->guid, guidText, 64);
294  char msg[99];
295  sprintf_s(msg, 99, "Could not locate previous configuration: %S", guidText);
296  Trace(msg, Logger::Level::Error); // should be warn but we want it to send to server
297 
298  if (!issuedWarning)
299  {
300  game->ToggleFullScreen(false);
301  MessageBox(DXUTGetHWND(), L"Could not find one of your sound devices!", L"Initialize Sound Device", MB_ICONWARNING | MB_OK);
302  issuedWarning = true;
303  }
304 
305  deviceConfig->guid = MYGUID_NULL;
306  deviceConfig->bassDevice = 0;
307  return;
308  }
309  }
310 
311  if (!BASS_Init(deviceConfig->bassDevice, 44100, 0, DXUTGetHWND(), nullptr))
312  {
313  if (BASS_ErrorGetCode() != BASS_ERROR_ALREADY) // to handle the whole -1 as default vs. true device numbers > 0
314  {
315  char msg[199];
316  sprintf_s(msg, 199, "BASS_Init failed (%i) on device: %s", BASS_ErrorGetCode(), deviceNames.at(deviceConfig->bassDevice).c_str());
317  Trace(msg, Logger::Level::Error); // should be warn but we want it to send to the server
318 
319  sprintf_s(msg, 199, "Could not initialize your sound device: %s", deviceNames.at(deviceConfig->bassDevice).c_str());
320  game->ToggleFullScreen(false);
321  MessageBoxA(DXUTGetHWND(), msg, "Sound Device Failed", MB_ICONWARNING | MB_OK);
322 
323  deviceConfig->guid = MYGUID_NULL; // added this 05-26-2020 to keep it from trying to load sounds!
324  deviceConfig->bassDevice = 0; // added this 02-20-2020 to keep it from trying to load sounds!
325  return;
326  }
327  }
328 
329  if (deviceConfig->guid == MYGUID_DEFAULT)
330  {
331  deviceConfig->bassDevice = static_cast<char>(BASS_GetDevice());
332  if (deviceConfig->bassDevice == -1) // failed
333  {
334  Trace("Could not find a default sound device!", Logger::Level::Debug);
335 
336  game->ToggleFullScreen(false);
337  MessageBox(DXUTGetHWND(), L"Could not find a default sound device!", L"Initialize Sound Device", MB_ICONWARNING | MB_OK);
338 
339  deviceConfig->guid = MYGUID_NULL;
340  deviceConfig->bassDevice = 0;
341  }
342  else
343  {
344  deviceConfig->guid = deviceGuids.at(deviceConfig->bassDevice);
345  }
346  }
347 
348  /*BASS_INFO info;
349  if (!BASS_GetInfo(&info))
350  {
351  char msg[99];
352  sprintf_s(msg, sizeof(msg), "BASS_GetInfo: %i", BASS_ErrorGetCode());
353  game->logger->Log(msg, Logger::Level::Error);
354 
355  deviceConfig->minrate = 0.0f;
356  deviceConfig->maxrate = 0.0f;
357  }
358  else
359  {
360  deviceConfig->minrate = static_cast<float>(info.minrate);
361  if (deviceConfig->minrate < 100.0f)
362  {
363  deviceConfig->minrate = 100.0f;
364  game->logger->Log("WTF minrate was below published minimum, setting to 100", Logger::Level::Debug);
365  }
366  deviceConfig->maxrate = static_cast<float>(info.maxrate);
367  if (deviceConfig->minrate > 100000.0f)
368  {
369  deviceConfig->minrate = 100000.0f;
370  game->logger->Log("WTF maxrate was above published minimum, setting to 100000", Logger::Level::Debug);
371  }
372  }*/
373 }
374 
376 {
377  Trace("Shutting down BASS...");
378 
379  for (UINT i = 1; i < deviceGuids.size(); i++)
380  {
381  BASS_SetDevice(i);
382  if (!BASS_Free() && BASS_ErrorGetCode() != BASS_ERROR_INIT)
383  {
384  char msg[99];
385  sprintf_s(msg, 99, "BASS_Free(%i): %i", i, BASS_ErrorGetCode());
386  Trace(msg, Logger::Level::Error);
387  }
388  }
389 
390  deviceNames.clear();
391  deviceGuids.clear();
392  g_pSoundIntro = NULL;
393 }
394 
395 void Sound::Trace(const char* msg, Logger::Level level) const
396 {
397  char newmsg[999];
398  sprintf_s(newmsg, 999, "SOUND: %s", msg);
399  game->logger->Log(newmsg, level);
400 }
401 
402 void Sound::PlayAudioData(unsigned char* data, size_t length)
403 {
405  return;
406 
408  {
409  BASS_SetDevice(game->config.soundConfigComms.bassDevice);
411  }
412 
413  comms = BASS_StreamCreateFile(true, static_cast<const void*>(data), 0, length, 0);
414  if (comms == 0)
415  {
416  char msg[99];
417  sprintf_s(msg, 99, "BASS_StreamCreateFile: %i", BASS_ErrorGetCode());
418  Trace(msg, Logger::Level::Error);
419  }
420 
421  const float modVolume = game->viewscreen->outside ? 0.0f : 1.0f;
422  if (!BASS_ChannelSetAttribute(comms, BASS_ATTRIB_VOL, game->config.soundConfigComms.volume * globalAttenuate * modVolume))
423  {
424  char msg[99];
425  sprintf_s(msg, 99, "PlayAudioData BASS_ChannelSetAttribute() vol %.1f failed: %i", game->config.soundConfigComms.volume * globalAttenuate * modVolume, BASS_ErrorGetCode());
426  // BASS_ERROR_ILLPARAM is 20
427  Trace(msg, Logger::Level::Error);
428  return;
429  }
430 
431 
432 #pragma region Digital Signal Processing
433  const HFX setFx1 = BASS_ChannelSetFX(comms, BASS_FX_BFX_BQF, 1);
434  if (setFx1 == 0)
435  {
436  char msg[99];
437  sprintf_s(msg, 99, "BASS_ChannelSetFX1 error: %i", BASS_ErrorGetCode());
438  Trace(msg, Logger::Level::Error);
439  }
440 
441  BASS_BFX_BQF highPass;
442  highPass.lFilter = BASS_BFX_BQF_HIGHPASS;
443  highPass.fCenter = 400;
444  highPass.fGain = 0;
445  highPass.fBandwidth = 1;
446  highPass.fQ = 0;
447  highPass.fS = 0;
448  highPass.lChannel = BASS_BFX_CHANALL;
449  if (!BASS_FXSetParameters(setFx1, &highPass))
450  {
451  char msg[99];
452  sprintf_s(msg, 99, "BASS_FXSetParameters1 error: %i", BASS_ErrorGetCode());
453  Trace(msg, Logger::Level::Error);
454  }
455 
456  HFX setFx2 = BASS_ChannelSetFX(comms, BASS_FX_BFX_BQF, 2);
457  if (setFx2 == 0)
458  {
459  char msg[99];
460  sprintf_s(msg, 99, "BASS_ChannelSetFX2 error: %i", BASS_ErrorGetCode());
461  Trace(msg, Logger::Level::Error);
462  }
463 
464  BASS_BFX_BQF lowPass;
465  lowPass.lFilter = BASS_BFX_BQF_LOWPASS;
466  lowPass.fCenter = 2000;
467  lowPass.lChannel = BASS_BFX_CHANALL;
468  lowPass.fGain = 0;
469  lowPass.fBandwidth = 1;
470  lowPass.fQ = 0;
471  lowPass.fS = 0;
472  if (!BASS_FXSetParameters(setFx2, &lowPass))
473  {
474  char msg[99];
475  sprintf_s(msg, 99, "BASS_FXSetParameters2 error: %i", BASS_ErrorGetCode());
476  Trace(msg, Logger::Level::Error);
477  }
478 #pragma endregion
479 
480 
481  if (!BASS_ChannelPlay(comms, true))
482  {
483  char msg[99];
484  sprintf_s(msg, 99, "PlayAudioData BASS_ChannelPlay error: %i", BASS_ErrorGetCode());
485  Trace(msg, Logger::Level::Error);
486  }
487 }
488 
489 void Sound::GlobalAttenuate(float prmGaTimeToFadeOut, float prmGaTimeToHold, float prmGaTimeToFadeIn, int soundEnum, float prmExTimeToFadeIn, float prmExTimeToHold, float prmExTimeToFadeOut, float volumeAdj)
490 {
491  gaTimer = 0.0f;
492 
493  // time to fade out, time to hold, time to fade back in, sound to exclude, time to fade in, time to hold, time to fade out
494  gaTimeToFadeOut = prmGaTimeToFadeOut;
495  gaTimeToHold = prmGaTimeToHold;
496  gaTimeToFadeIn = prmGaTimeToFadeIn;
497  gaVolumeAdj = volumeAdj;
498  excludeFromGlobalAttenuate = soundEnum;
499  exTimeToFadeIn = prmExTimeToFadeIn;
500  exTimeToHold = prmExTimeToHold;
501  exTimeToFadeOut = prmExTimeToFadeOut;
502 }
503 
504 void Sound::ChangeVolume(SoundConfig* config, float modVolume)
505 {
506  for (int i = 0; i < SOUND_ENUMERATION; i++)
507  {
508  if (sound_config[i] == config)
509  {
510  ChangeVolume(i, modVolume);
511  }
512  }
513 
514  // intro music
515  if (config == &game->config.soundConfigLegacy && g_pSoundIntro && config->bassDevice)
516  {
517  if (!BASS_ChannelSetAttribute(g_pSoundIntro, BASS_ATTRIB_VOL, static_cast<float>(game->config.soundConfigLegacy.volume * globalAttenuate * modVolume)))
518  {
519  char msg[99];
520  sprintf_s(msg, 99, "ChangeVolume BASS_ChannelSetAttribute(g_pSoundIntro) vol %.1f failed: %i", game->config.soundConfigLegacy.volume * globalAttenuate * modVolume, BASS_ErrorGetCode());
521  Trace(msg, Logger::Level::Error);
522  }
523  }
524 
525  // comms
526  if (config == &game->config.soundConfigComms && comms && config->bassDevice)
527  {
528  if (!BASS_ChannelSetAttribute(comms, BASS_ATTRIB_VOL, static_cast<float>(game->config.soundConfigComms.volume * globalAttenuate * modVolume)))
529  {
530  char msg[99];
531  sprintf_s(msg, 99, "ChangeVolume BASS_ChannelSetAttribute(comms) vol %.1f failed: %i", game->config.soundConfigComms.volume * globalAttenuate * modVolume, BASS_ErrorGetCode());
532  Trace(msg, Logger::Level::Error);
533  }
534  }
535 
536  // radio
537  if (config == &game->config.soundConfigRadio && radio && config->bassDevice)
538  {
539  if (!BASS_ChannelSetAttribute(radio, BASS_ATTRIB_VOL, static_cast<float>(game->config.soundConfigRadio.volume * globalAttenuate * modVolume)))
540  {
541  char msg[99];
542  sprintf_s(msg, 99, "ChangeVolume BASS_ChannelSetAttribute(radio) vol %.1f failed: %i", game->config.soundConfigRadio.volume * globalAttenuate * modVolume, BASS_ErrorGetCode());
543  Trace(msg, Logger::Level::Error);
544  }
545  }
546 }
547 
548 void Sound::ChangeVolume(int soundEnum, float modVolume)
549 {
550  if (sound_channel[soundEnum])
551  {
552  float volume = sound_config[soundEnum]->volume * sound_volume[soundEnum] * modVolume;
553  if (soundEnum != excludeFromGlobalAttenuate)
554  volume *= globalAttenuate;
555  if (!BASS_ChannelSetAttribute(sound_channel[soundEnum], BASS_ATTRIB_VOL, volume))
556  {
557  char msg[99];
558  sprintf_s(msg, 99, "ChangeVolume BASS_ChannelSetAttribute(%i) vol %.1f failed: %i", soundEnum, volume, BASS_ErrorGetCode());
559  Trace(msg, Logger::Level::Error);
560  }
561  }
562 }
563 
565 {
570 }
571 
572 float Sound::GetLength(int soundEnum)
573 {
574  return sound_length[soundEnum];
575 }
576 
577 float Sound::Play(int soundEnum)
578 {
579  PlayEx(soundEnum, false);
580  return sound_length[soundEnum];
581 }
582 
584 {
585  Trace("Sound::Reset");
586 
587  game->sound->Close();
588  game->sound->Init();
590  {
591  for (int i = 0; i < SOUND_APALTITUDE; i++)
592  game->sound->LoadSounds(i);
593  }
594  else
595  {
596  for (int i = 0; i < SOUND_ENUMERATION; i++)
597  game->sound->LoadSounds(i);
598  game->sound->ChangeCockpit(false);
599  g_bRadioPlaying = false;
600  }
601 }
602 
603 // <param>volume</param>0 (silent) to 1 (full)
604 // <param>frequencyMod</param>0 = original rate (when the channel was created) to X times
605 // <param>pan</param>-1 (full left) to +1 (full right), 0 = centre
606 void Sound::PlayEx(int soundEnum, bool loop, float volume, float frequencyMod, float pan, bool restart)
607 {
608  if (!sound_device[soundEnum] || !sound_sample[soundEnum])
609  return;
610 
611  char msg[256];
612 
613  if (currentSoundDevice != sound_device[soundEnum])
614  {
615  if (!BASS_SetDevice(sound_device[soundEnum]))
616  {
617  sprintf_s(msg, sizeof msg, "PlayEx BASS_SetDevice(%i): %i", soundEnum, BASS_ErrorGetCode());
618  Trace(msg, Logger::Level::Error);
619  }
620  currentSoundDevice = sound_device[soundEnum];
621  }
622 
623  if (!sound_channel[soundEnum])
624  {
625  sound_channel[soundEnum] = BASS_SampleGetChannel(sound_sample[soundEnum], false); // get a sample channel, recycle old
626  if (!sound_channel[soundEnum])
627  {
628  sprintf_s(msg, sizeof msg, "PlayEx BASS_SampleGetChannel(%i) failed: %i", soundEnum, BASS_ErrorGetCode());
629  Trace(msg, Logger::Level::Error);
630  return;
631  }
632  const QWORD length = BASS_ChannelGetLength(sound_channel[soundEnum], BASS_POS_BYTE);
633  sound_length[soundEnum] = static_cast<float>(BASS_ChannelBytes2Seconds(sound_channel[soundEnum], length));
634  }
635 
636  if (loop)
637  {
638  if (BASS_ChannelFlags(sound_channel[soundEnum], BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP) == -1)
639  {
640  sprintf_s(msg, sizeof msg, "PlayEx BASS_ChannelFlags(%i) failed: %i", soundEnum, BASS_ErrorGetCode());
641  Trace(msg, Logger::Level::Error);
642  return;
643  }
644  }
645 
646 #pragma region Volume
647  if (volume > 1.0f)
648  {
649  sprintf_s(msg, sizeof msg, "PlayEx BASS_ChannelSetAttribute(%i) clamped volume: %.1f", soundEnum, volume);
650  Trace(msg, Logger::Level::Warn);
651  volume = 1.0f;
652  }
653  else if (volume < 0.0f)
654  {
655  sprintf_s(msg, sizeof msg, "PlayEx BASS_ChannelSetAttribute(%i) clamped volume: %.1f", soundEnum, volume);
656  Trace(msg, Logger::Level::Warn);
657  volume = 0.0f;
658  }
659 
661  volume = 0.0f;
662  sound_volume[soundEnum] = volume;
663 
664  if (sound_config[soundEnum]->volume < 0)
665  {
666  sprintf_s(msg, sizeof msg, "PlayEx sound_config[%i]->volume clamped volume: %.1f", soundEnum, sound_config[soundEnum]->volume);
667  Trace(msg, Logger::Level::Warn);
668  sound_config[soundEnum]->volume = 0.0f;
669  }
670  if (globalAttenuate < 0)
671  {
672  sprintf_s(msg, sizeof msg, "PlayEx globalAttenuate clamped volume: %.1f", globalAttenuate);
673  Trace(msg, Logger::Level::Warn);
674  globalAttenuate = 0.0f;
675  }
676 
677  volume *= sound_config[soundEnum]->volume;
678  if (soundEnum != excludeFromGlobalAttenuate)
679  volume *= globalAttenuate;
680 
681  // somehow we had a negative sign on 0
682  if (volume <= 0)
683  volume = 0;
684  if (!BASS_ChannelSetAttribute(sound_channel[soundEnum], BASS_ATTRIB_VOL, volume))
685  {
686  sprintf_s(msg, sizeof msg, "PlayEx BASS_ChannelSetAttribute(%i) vol %.1f soundConfigVol %.1f globalAtt %.1f failed: %i", soundEnum, volume, sound_config[soundEnum]->volume, globalAttenuate, BASS_ErrorGetCode());
687  // BASS_ERROR_ILLPARAM is 20
688  Trace(msg, Logger::Level::Error);
689  return;
690  }
691 #pragma endregion
692 
693 #pragma region Frequency
694  if (frequencyMod != 1.0f)
695  {
696  const float frequency = Clamp(sound_rate[soundEnum] * frequencyMod, minrate, maxrate);
697  if (!BASS_ChannelSetAttribute(sound_channel[soundEnum], BASS_ATTRIB_FREQ, frequency))
698  {
699  sprintf_s(msg, sizeof msg, "PlayEx BASS_ChannelSetAttribute(%i) freq %.1f failed: %i", soundEnum, frequency, BASS_ErrorGetCode());
700  Trace(msg, Logger::Level::Error);
701  sprintf_s(msg, sizeof msg, "--- minrate %.1f original %.1f maxrate %.1f mod %.1f", minrate, sound_rate[soundEnum], maxrate, frequencyMod);
702  Trace(msg, Logger::Level::Debug);
703  return;
704  }
705  }
706  else
707  {
708  if (!BASS_ChannelSetAttribute(sound_channel[soundEnum], BASS_ATTRIB_FREQ, 0))
709  {
710  sprintf_s(msg, sizeof msg, "PlayEx BASS_ChannelSetAttribute(%i) freq ORIG failed: %i", soundEnum, BASS_ErrorGetCode());
711  Trace(msg, Logger::Level::Error);
712  sprintf_s(msg, sizeof msg, "--- minrate %.1f original %.1f maxrate %.1f", minrate, sound_rate[soundEnum], maxrate);
713  Trace(msg, Logger::Level::Debug);
714  return;
715  }
716  }
717 #pragma endregion
718 
719 #pragma region Pan
720  if (pan > 1.0f)
722  pan = 1.0f;
723  else if (pan < -1.0f)
724  pan = -1.0f;
725 
726  if (!BASS_ChannelSetAttribute(sound_channel[soundEnum], BASS_ATTRIB_PAN, pan))
727  {
728  sprintf_s(msg, sizeof msg, "PlayEx BASS_ChannelSetAttribute(%i) pan %.1f failed: %i", soundEnum, pan, BASS_ErrorGetCode());
729  Trace(msg, Logger::Level::Error);
730  return;
731  }
732 #pragma endregion
733 
734  if (!BASS_ChannelPlay(sound_channel[soundEnum], !loop && restart))
735  {
736  const int error = BASS_ErrorGetCode();
737  sprintf_s(msg, sizeof msg, "PlayEx BASS_ChannelPlay (%i) error %i!", soundEnum, error);
738  Trace(msg, Logger::Level::Error);
739  if (error == BASS_ERROR_UNKNOWN || error == BASS_ERROR_BUFLOST)
740  {
742  // I think at least in that case it was the thunder ... downgrading from FATAL
743  Trace("Resetting...", Logger::Level::Error);
744  Reset();
745  Trace("Playing again...", Logger::Level::Error);
746  PlayEx(soundEnum, loop, volume, frequencyMod, pan, restart);
747  }
748  else if (error == BASS_ERROR_START)
749  {
750  BASS_Start();
751  BASS_ChannelPlay(sound_channel[soundEnum], !loop && restart);
752  }
753  }
754 }
755 
756 void CALLBACK Sound::MetaData(HSYNC, DWORD, DWORD, void* user)
757 {
758  Sound* s = static_cast<Sound*>(user);
759 
760  s->Trace("Sound::MetaData received!");
761  s->game->logger->AddToCallStack("Sound::MetaData");
762 
763  // get the broadcast name and bitrate
764  char icy[999];
765  strcpy_s(icy, 999, BASS_ChannelGetTags(s->radio, BASS_TAG_META));
766  if (icy[0])
767  {
768  if (strcmp(s->metadata, icy) != 0)
769  {
770  strcpy_s(s->metadata, sizeof(metadata), icy);
771  char msg[999];
772  sscanf_s(s->metadata, "StreamTitle='%[^']", msg, sizeof(msg));
773  if (strlen(msg) > 76)
774  {
775  msg[74] = msg[75] = msg[76] = '.';
776  msg[77] = 0;
777  }
778  if (strcmp(msg, s->oldtitle) != 0)
779  {
780  strcpy_s(ourcockpit.radioplaying, sizeof(ourcockpit.radioplaying), msg);
782 
783  strcpy_s(s->oldtitle, sizeof(oldtitle), msg);
784 
785  if (s->stationIdentification >= 2)
786  {
788  s->stationIdentification = 0;
789  }
790  else
792  }
793  }
794  }
795 }
796 
797 void CALLBACK Sound::AdvanceStage(HSYNC, DWORD, DWORD, void* user)
798 {
799  Sound* s = static_cast<Sound*>(user);
800 
801  if (s->loopintro && s->g_pSoundIntro) // got to sync position, set back to loop
802  {
803  // reset position
804  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
805  switch (s->musicstage)
806  {
808  if (!BASS_ChannelSetPosition(s->g_pSoundIntro, BASS_ChannelSeconds2Bytes(s->g_pSoundIntro, 12.034f), BASS_POS_BYTE)) // back to start of stage 1 18.090
809  {
810  char msg[99];
811  sprintf_s(msg, 99, "Sound::AdvanceStage BASS_ChannelSetPos %i: %i", s->musicstage, BASS_ErrorGetCode());
812  s->game->logger->Log(msg, Logger::Level::Error);
813  }
814  break;
816  if (!BASS_ChannelSetPosition(s->g_pSoundIntro, BASS_ChannelSeconds2Bytes(s->g_pSoundIntro, 36.068f), BASS_POS_BYTE)) // 42.103
817  {
818  char msg[99];
819  sprintf_s(msg, 99, "Sound::AdvanceStage BASS_ChannelSetPos %i: %i", s->musicstage, BASS_ErrorGetCode());
820  s->game->logger->Log(msg, Logger::Level::Error);
821  }
822  break;
824  if (!BASS_ChannelSetPosition(s->g_pSoundIntro, BASS_ChannelSeconds2Bytes(s->g_pSoundIntro, 126.437f), BASS_POS_BYTE)) // 63.109 57.074 126.437
825  {
826  char msg[99];
827  sprintf_s(msg, 99, "Sound::AdvanceStage BASS_ChannelSetPos %i: %i", s->musicstage, BASS_ErrorGetCode());
828  s->game->logger->Log(msg, Logger::Level::Error);
829  }
830  break;
832  if (!BASS_ChannelRemoveSync(s->g_pSoundIntro, s->hsync))
833  {
834  char msg[99];
835  sprintf_s(msg, 99, "Sound::AdvanceStage BASS_ChannelRemoveSync %i: %i", s->musicstage, BASS_ErrorGetCode());
836  s->game->logger->Log(msg, Logger::Level::Error);
837  }
838  if (!BASS_StreamFree(s->g_pSoundIntro))
839  {
840  char msg[99];
841  sprintf_s(msg, 99, "Sound::AdvanceStage BASS_StreamFree %i: %i", s->musicstage, BASS_ErrorGetCode());
842  s->game->logger->Log(msg, Logger::Level::Error);
843  break;
844  }
845  s->g_pSoundIntro = NULL; // BASS_StreamFree does NOT NULL the g_pSoundIntro!
846  break;
847  }
848  }
849  else // got to sync position, continuing (set new sync position)
850  {
851  if (s->g_pSoundIntro && !BASS_ChannelRemoveSync(s->g_pSoundIntro, s->hsync))
852  {
853  char msg[99];
854  sprintf_s(msg, sizeof(msg), "BASS_ChannelRemoveSync %i: %i", s->musicstage, BASS_ErrorGetCode());
855  s->game->logger->Log(msg, Logger::Level::Error);
856  }
858  {
859  if (s->g_pSoundIntro)
860  {
861  if (!BASS_StreamFree(s->g_pSoundIntro))
862  {
863  char msg[99];
864  sprintf_s(msg, 99, "Sound::AdvanceStage BASS_StreamFree %i: %i", s->musicstage, BASS_ErrorGetCode());
865  s->game->logger->Log(msg, Logger::Level::Error);
866  return;
867  }
868  s->g_pSoundIntro = NULL; // BASS_StreamFree does NOT NULL the g_pSoundIntro!
869  }
870  return;
871  }
872  s->musicstage = static_cast<GameState>(s->musicstage + 1); // was 1, now 2
873  if (s->musicstage == GameState::STATUS_CREATE) // music doesn't change here
874  s->musicstage = static_cast<GameState>(s->musicstage + 1);
875  // set sync on next loopable part
876  s->loopintro = true;
877  // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
878  switch (s->musicstage)
879  {
881  if (s->g_pSoundIntro)
882  s->hsync = BASS_ChannelSetSync(s->g_pSoundIntro,
883  BASS_SYNC_POS | BASS_SYNC_MIXTIME,
884  BASS_ChannelSeconds2Bytes(s->g_pSoundIntro, 48.074f),
885  &Sound::AdvanceStage, s); // 54.109
886  break;
888  if (s->g_pSoundIntro)
889  s->hsync = BASS_ChannelSetSync(s->g_pSoundIntro,
890  BASS_SYNC_POS | BASS_SYNC_MIXTIME,
891  BASS_ChannelSeconds2Bytes(s->g_pSoundIntro, 138.437f),
892  &Sound::AdvanceStage, s); // 111.106 105.071 138.437
893  break;
895  if (s->g_pSoundIntro)
896  s->hsync = BASS_ChannelSetSync(s->g_pSoundIntro,
897  BASS_SYNC_END,
898  0,
899  &Sound::AdvanceStage, s);
900  }
901 
902  if (s->g_pSoundIntro && !s->hsync)
903  {
904  char msg[99];
905  sprintf_s(msg, sizeof(msg), "BASS_ChannelSetSync %i: %i", s->musicstage, BASS_ErrorGetCode());
906  s->game->logger->Log(msg, Logger::Level::Error);
907  }
908  }
909 }
910 
911 void Sound::LoadSound(int soundEnum, SoundConfig* newDevice)
912 {
913  if (newDevice == nullptr)
914  newDevice = &game->config.soundConfigLegacy;
915 
916  if (!newDevice->bassDevice)
917  return;
918 
919  const char oldsounddevice = sound_device[soundEnum];
920  sound_config[soundEnum] = newDevice;
921  sound_device[soundEnum] = newDevice->bassDevice;
922 
923  if (sound_sample[soundEnum])
924  {
925  if (sound_device[soundEnum] == oldsounddevice)
926  return;
927 
928  if (currentSoundDevice != oldsounddevice)
929  {
930  BASS_SetDevice(oldsounddevice);
931  currentSoundDevice = oldsounddevice;
932  }
933 
934  BASS_SampleStop(sound_sample[soundEnum]);
935  if (!BASS_SampleFree(sound_sample[soundEnum]))
936  {
937  char msg[99];
938  sprintf_s(msg, 99, "BASS_SampleFree(%i): %i", soundEnum, BASS_ErrorGetCode());
939  Trace(msg, Logger::Level::Error);
940  }
941  sound_sample[soundEnum] = NULL; // BASS_SampleFree does NOT NULL the sound_sample[soundEnum]!
942  sound_channel[soundEnum] = NULL;
943  }
944 
945  if (!sound_device[soundEnum])
946  return;
947 
948  if (currentSoundDevice != sound_device[soundEnum])
949  {
950  BASS_SetDevice(sound_device[soundEnum]);
951  currentSoundDevice = sound_device[soundEnum];
952  }
953 
954  sound_sample[soundEnum] = BASS_SampleLoad(false, sound_path[soundEnum], 0L, 0L, 1, 0L);
955  if (!sound_sample[soundEnum])
956  {
957  char msg[99];
958  sprintf_s(msg, 99, "BASS_SampleLoad(%i), \"%s\"): %i", soundEnum, sound_path[soundEnum], BASS_ErrorGetCode());
959  Trace(msg, Logger::Level::Error);
960  sound_device[soundEnum] = 0;
961  sound_config[soundEnum] = nullptr;
962  }
963  else
964  {
965  WCHAR wstr[MAX_PATH];
966  swprintf_s(wstr, MAX_PATH, L"%S", sound_path[soundEnum]);
967  game->TouchFile(wstr);
968 
969  BASS_SAMPLE info;
970  if (BASS_SampleGetInfo(sound_sample[soundEnum], &info))
971  {
972  sound_rate[soundEnum] = static_cast<float>(info.freq);
973  }
974  else
975  {
976  char msg[99];
977  sprintf_s(msg, 99, "BASS_SampleGetInfo(%i), \"%s\"): %i", soundEnum, sound_path[soundEnum], BASS_ErrorGetCode());
978  Trace(msg, Logger::Level::Error);
979  }
980  }
981 }
982 
983 void Sound::LoadCockpitSound(int soundEnum, const char* path, bool force, SoundConfig* device)
984 {
985  if (device == nullptr)
986  device = &game->config.soundConfigLegacy;
987 
988  if (!device->bassDevice)
989  return;
990 
991  char oldsounddevice = sound_device[soundEnum];
992  sound_config[soundEnum] = device;
993  sound_device[soundEnum] = device->bassDevice;
994 
995  if (sound_sample[soundEnum])
996  {
997  if (sound_device[soundEnum] == oldsounddevice && path != nullptr && !force)
998  return;
999 
1000  if (currentSoundDevice != oldsounddevice)
1001  {
1002  BASS_SetDevice(oldsounddevice);
1003  currentSoundDevice = oldsounddevice;
1004  }
1005 
1006  BASS_SampleStop(sound_sample[soundEnum]);
1007  if (!BASS_SampleFree(sound_sample[soundEnum]))
1008  {
1009  char msg[99];
1010  sprintf_s(msg, 99, "BASS_SampleFree(%i): %i", soundEnum, BASS_ErrorGetCode());
1011  Trace(msg, Logger::Level::Error);
1012  }
1013  sound_sample[soundEnum] = NULL; // BASS_StreamFree does NOT NULL the sound_sample[soundEnum]!
1014  sound_channel[soundEnum] = NULL;
1015  }
1016 
1017  if (!sound_device[soundEnum] || path == nullptr)
1018  return;
1019 
1020  if (currentSoundDevice != sound_device[soundEnum])
1021  {
1022  BASS_SetDevice(sound_device[soundEnum]);
1023  currentSoundDevice = sound_device[soundEnum];
1024  }
1025 
1026  sound_sample[soundEnum] = BASS_SampleLoad(false, path, 0L, 0L, 1, 0L);
1027  if (!sound_sample[soundEnum])
1028  {
1029  char msg[99];
1030  sprintf_s(msg, 99, "BASS_SampleLoad(%i), \"%s\"): %i", soundEnum, path, BASS_ErrorGetCode());
1031  Trace(msg, Logger::Level::Error);
1032  }
1033  else
1034  {
1035  WCHAR wstr[MAX_PATH];
1036  swprintf_s(wstr, MAX_PATH, L"%S", path);
1037  game->TouchFile(wstr);
1038 
1039  BASS_SAMPLE info;
1040  if (BASS_SampleGetInfo(sound_sample[soundEnum], &info))
1041  {
1042  sound_rate[soundEnum] = static_cast<float>(info.freq);
1043  }
1044  else
1045  {
1046  char msg[99];
1047  sprintf_s(msg, 99, "BASS_SampleGetInfo(%i), \"%s\"): %i", soundEnum, sound_path[soundEnum], BASS_ErrorGetCode());
1048  Trace(msg, Logger::Level::Error);
1049  }
1050  }
1051 }
1052 
1053 void Sound::FrameMove(float elapsedTime)
1054 {
1055  headpan = D3DXToDegree(game->viewscreen->leftright) / 90.0f;
1056 
1057  game->sound->FrameMoveAAC();
1058  game->sound->FrameMoveDelayedEffects(elapsedTime);
1059  game->sound->FrameMoveDopplerEffects(elapsedTime);
1060 }
1061 
1062 float Sound::GetAttenuation(bool applyDensity) const // aka comesFromUs NOT from outside
1063 {
1064  if (game->viewscreen->outside) // not in cockpit
1065  {
1066  if (applyDensity)
1067  return game->viewscreen->ptrPropulsion->staticDensity; // sound based on air density alone
1068  return 1.0f;
1069  }
1070  return ourcockpit.attenuate; // normal attenuation
1071 }
1072 
1073 void Sound::LoadSounds(short instage)
1074 {
1076  {
1077  // set legacy
1078  if (!BASS_SetDevice(game->config.soundConfigLegacy.bassDevice))
1079  {
1080  Trace("BASS_SetDevice failed on LoadSounds() legacy device", Logger::Level::Error);
1081  }
1082 
1083  game->TouchFile(L"Sounds\\ambience.ogg");
1084 
1085  g_pSoundIntro = BASS_StreamCreateFile(false, "Sounds\\ambience.ogg", 0, 0, BASS_STREAM_PRESCAN);
1086  if (!g_pSoundIntro)
1087  {
1088  char msg[99];
1089  sprintf_s(msg, 99, "LoadSounds BASS_StreamCreateFile error: %i", BASS_ErrorGetCode());
1090  Trace(msg, Logger::Level::Error);
1091  }
1092 
1093  if (!BASS_ChannelSetAttribute(g_pSoundIntro, BASS_ATTRIB_VOL, 0.5f))
1094  {
1095  char msg[99];
1096  sprintf_s(msg, 99, "LoadSounds BASS_ChannelSetAttribute error: %i", BASS_ErrorGetCode());
1097  Trace(msg, Logger::Level::Error);
1098  }
1099 
1100  if (!BASS_ChannelPlay(g_pSoundIntro, true))
1101  {
1102  char msg[99];
1103  sprintf_s(msg, 99, "LoadSounds BASS_ChannelPlay error: %i", BASS_ErrorGetCode());
1104  Trace(msg, Logger::Level::Error);
1105  }
1106 
1107  hsync = BASS_ChannelSetSync(g_pSoundIntro, BASS_SYNC_POS | BASS_SYNC_MIXTIME, BASS_ChannelSeconds2Bytes(g_pSoundIntro, 24.061f), AdvanceStage, this); // 30.121
1108  if (!hsync)
1109  {
1110  char msg[99];
1111  sprintf_s(msg, 99, "LoadSounds BASS_ChannelSetSync error: %i", BASS_ErrorGetCode());
1112  Trace(msg, Logger::Level::Error);
1113  }
1114  }
1115 
1116  if (instage < SOUND_THUNDER)
1117  return; // these are all the cockpit-specific sounds
1118 
1119  if (instage == SOUND_SPEAKERPOP || instage == SOUND_EXPLODE2) // explode2 is sinkerhit which is EM burst
1120  LoadSound(instage, &game->config.soundConfigComms);
1121  else if (instage <= SOUND_NEWMSG)
1122  LoadSound(instage);
1123  else if (instage < SOUND_DOCKANNOUNCE1)
1125  else if (instage < SOUND_RADIOCUT1)
1126  LoadSound(instage);
1127  else if (instage <= SOUND_RADIOCARRIER11)
1128  LoadSound(instage, &game->config.soundConfigComms);
1129  else if (instage == SOUND_STATIONID2)
1130  LoadSound(instage, &game->config.soundConfigRadio);
1131 }
1132 
1133 void Sound::LegacySoundRequestUniverse(SServerPacket datapacket)
1134 {
1135  if (datapacket.array == 0)
1136  {
1137  Trace("Should not be getting LegacySoundRequestUniverse calls with our slot!", Logger::Error);
1138  return;
1139  }
1140 
1141  if (datapacket.array >= MAX_SCAN)
1142  {
1143  Trace("LegacySoundRequestUniverse called with out-of-bounds array value!", Logger::Error);
1144  return;
1145  }
1146 
1147  if (!playerships[datapacket.array].active || !playerships[datapacket.array].visible)
1148  {
1149  Trace("LegacySoundRequestUniverse got a call for a vehicle that was not visible or was not active!", Logger::Warn);
1150  return;
1151  }
1152 
1153  if (datapacket.f_x == 0.0f) // car noises
1154  {
1155  if (playerships[0].reference <= REF_BUILDING) // doppler calculate distance
1156  {
1157  if (playerships[datapacket.array].reference < 0)
1158  {
1159  D3DXVECTOR3 source, dest;
1160  source = playerships[datapacket.array].position;
1161  if (playerships[0].reference == REF_INANOTHER)
1163  else
1164  dest = playerships[0].position;
1165 
1166  D3DXVECTOR3 result = source - dest;
1167  if (playerships[datapacket.array].distance < 1.6f) // we said a mile in clear still conditions
1168  {
1169  float tfal = sqrtf(playerships[datapacket.array].distance / 1.6f); // 0 up close, 1 at 1.6km, .7 at .8km (instead of .5)
1170  if (tfal > 1.0f)
1171  tfal = 1.0f;
1172  float newvolume = 1.0f - tfal; // 1 up close, .3 at .8km (instead of .5), 0 at distance
1173  newvolume *= game->viewscreen->ptrPropulsion->staticDensity;
1174  newvolume *= GetAttenuation(false);
1175 
1176  float closing = playerships[datapacket.array].closurerate; // 10 - 5 is 5
1177  if (_isnan(closing) || isinf(closing))
1178  {
1179  Trace("playerships[datapacket.array].closurerate is NAN", Logger::Debug);
1180  closing = 0.0f;
1181  }
1182  closing /= game->viewscreen->ptrPropulsion->speedOfSoundKms; // speed of sound (at sea level?) //
1183  if (_isnan(closing) || isinf(closing))
1184  {
1185  Trace("game->viewscreen->ptrPropulsion->speedOfSoundKms is NAN", Logger::Debug);
1186  closing = 0.0f;
1187  }
1188  closing++;
1189 
1190  D3DXVec3TransformCoord(&result, &result, &game->viewscreen->matrixView);
1191  float bear1;
1192  if (result.z != 0.0f)
1193  {
1194  bear1 = D3DXToDegree(atanf(result.x / result.z));
1195  float mark1 = D3DXToDegree(atanf(result.y / result.z));
1196  float f_temp = sqrtf(mark1 * mark1 + bear1 * bear1);
1197  if (f_temp > 180.0f)
1198  {
1199  f_temp = 180.0f / f_temp;
1200  bear1 *= f_temp;
1201  }
1202  if (result.z > 0.0f) // Behind us
1203  {
1204  if (bear1 > 0.0f)
1205  bear1 -= 180.0f;
1206  else
1207  bear1 += 180.0f;
1208  }
1209  }
1210  else // directly above or below
1211  {
1212  bear1 = 0.0f;
1213  }
1214  const float pan = sinf(bear1); // -90 is -1, -180 is 0 again
1215 
1216  if (datapacket.f_y == 0.0f) // horn
1217  {
1218  if (playerships[datapacket.array].police)
1219  PlayEx(SOUND_POLICECHIRP, false, newvolume, closing, pan - headpan);
1220  else if (playerships[datapacket.array].type == T120 || playerships[datapacket.array].type == T121)
1221  PlayEx(SOUND_HORNTRUCK, false, newvolume, closing, pan - headpan);
1222  else if (playerships[datapacket.array].type == T27)
1223  PlayEx(SOUND_HORNMAMMOTH, false, newvolume, closing, pan - headpan);
1224  else if (_strcmpi(playerships[datapacket.array].hullname, "ECTO 1") == 0)
1225  PlayEx(SOUND_ECTO1, false, newvolume, closing, pan - headpan);
1226  else
1227  PlayEx(SOUND_HORNCAR, false, newvolume, closing, pan - headpan);
1228  }
1229  else if (datapacket.f_y == 1.0f) // brakes on
1230  PlayEx(playerships[datapacket.array].type == T120 || playerships[datapacket.array].type == T121 ? SOUND_AIRBRAKEON : SOUND_AIRBRAKEONMAMMOTH, false, newvolume, closing, pan - headpan);
1231  else if (datapacket.f_y == 2.0f) // brakes off
1232  PlayEx(playerships[datapacket.array].type == T120 || playerships[datapacket.array].type == T121 ? SOUND_AIRBRAKEOFF : SOUND_AIRBRAKEOFFMAMMOTH, false, newvolume, closing, pan - headpan);
1233  else if (datapacket.f_y == 3.0f) // reverse on
1234  AddLoopingVehicleSound(playerships[datapacket.array].type == T120 || playerships[datapacket.array].type == T121 ? SOUND_BACKUP : SOUND_BACKUPMAMMOTH, datapacket.array);
1235  else if (datapacket.f_y == 4.0f) // reverse off
1236  RemoveLoopingVehicleSound(playerships[datapacket.array].type == T120 || playerships[datapacket.array].type == T121 ? SOUND_BACKUP : SOUND_BACKUPMAMMOTH, datapacket.array);
1237  }
1238  }
1239  }
1240  }
1241  else if (datapacket.f_x == 1.0f) // sonic boom
1242  {
1243  const D3DXVECTOR3 source = playerships[datapacket.array].position;
1244  const D3DXVECTOR3 sourcevel = playerships[datapacket.array].velocity;
1245 
1246  D3DXVECTOR3 dest, destvel;
1247  if (playerships[0].reference == REF_INANOTHER)
1248  {
1250  destvel = playerships[playerships[0].inarray].velocity;
1251  }
1252  else if (playerships[0].reference <= REF_BUILDING)
1253  {
1254  dest = playerships[0].position;
1255  destvel = playerships[0].velocity;
1256  }
1257  else
1258  {
1259  dest.x = dest.y = dest.z = 0.0f;
1260  destvel = dest;
1261  }
1262 
1263  D3DXVECTOR3 result = source - dest;
1264  float f_temp = D3DXVec3Length(&result);
1265 
1266  if (f_temp < 160.0f) // 160 km limit or 100 miles
1267  {
1268  f_temp /= 160.0f; // 0 is close, 1 is far
1269  f_temp = 1.0f - f_temp; // 1 is close, 0 is far
1270  f_temp *= f_temp; // inverse square rule
1272 
1273  Trace("Sonic boom detected!");
1274 
1275  if (f_temp < 1.0f)
1276  {
1277  D3DXVECTOR3 resultvel = sourcevel - destvel;
1278  const float delay = D3DXVec3Length(&result) / D3DXVec3Length(&resultvel);
1279  AddDelayedSound(SOUND_SONICBOOM, delay, f_temp * GetAttenuation(false));
1280  }
1281  }
1282  }
1283 }
1284 
1286 {
1287  game->logger->AddToCallStack("Sound::FrameMoveAAC");
1288 
1290  return;
1291 
1293  {
1294  BASS_SetDevice(game->config.soundConfigRadio.bassDevice);
1296  }
1297 
1299  {
1300  g_bRadioPlaying = false;
1301  BASS_StreamFree(radio);
1302  radio = NULL; // BASS_StreamFree does NOT NULL the radio!
1303  currentRadioDevice = -2;
1304  }
1305 
1306  // we have it know if radio is supposed to be on, correct channel is selected, how to handle volume
1307  if (ourcockpit.power > 0.75f && ourcockpit.radioPower)
1308  {
1309  const DWORD channelStatus = BASS_ChannelIsActive(radio);
1310 
1311  // was playing, no station change, station has good reception
1312  if (oldstation == station && channelStatus)
1313  return;
1314 
1315  // either was not on, changed station, or lost the station
1316  if (oldstation == station && (!radio || !channelStatus))
1317  Trace("Lost stream or stream ended... reconnecting...", Logger::Level::Warn);
1318  else if (oldstation != station && radio && channelStatus)
1319  Trace("Changed radio stations...");
1320 
1321  if (oldstation != station || !radio || !channelStatus)
1322  {
1323  g_bRadioPlaying = false;
1324  BASS_StreamFree(radio); // close old stream
1325  radio = NULL; // BASS_StreamFree does NOT NULL the radio!
1326  if (station == 0)
1327  radio = BASS_StreamCreateURL("http://81.88.36.42:8010", 0, BASS_STREAM_STATUS, nullptr, nullptr);
1328  }
1329 
1330  if (!radio)
1331  {
1332  const int hr = BASS_ErrorGetCode();
1333  char msg[99];
1334  sprintf_s(msg, 99, "BASS_StreamCreateURL failed (%i) for station: %i", hr, station);
1335  Trace(msg, Logger::Level::Error);
1336  ourcockpit.radioPower = false;
1337  }
1338  else if (!g_bRadioPlaying)
1339  {
1340  if (!BASS_ChannelPlay(radio, FALSE))
1341  {
1342  char msg[99];
1343  sprintf_s(msg, 99, "FrameMoveAAC BASS_ChannelPlay error: %i", BASS_ErrorGetCode());
1344  Trace(msg, Logger::Level::Error);
1345  }
1346 
1347  g_bRadioPlaying = true;
1349  oldstation = station;
1350 
1351  const float modVolume = game->viewscreen->outside ? 0.0f : 1.0f;
1352  BASS_ChannelSetAttribute(radio, BASS_ATTRIB_VOL, game->config.soundConfigRadio.volume * globalAttenuate * modVolume);
1353 
1354  //oldtitle[0] = metadata[0] = 0;
1355  //stationIdentification = 0;
1356  BASS_ChannelSetSync(radio, BASS_SYNC_MIXTIME | BASS_SYNC_META, NULL, MetaData, this);
1357  }
1358  }
1359  else
1360  {
1361  if (g_bRadioPlaying)
1362  {
1363  BASS_StreamFree(radio); // close old stream
1364  radio = NULL; // freeing the stream does NOT set this to null!
1365  g_bRadioPlaying = false;
1366  }
1367  }
1368 
1369  game->logger->AddToCallStack("Sound::FrameMoveAAC DONE");
1370 }
1371 
1372 void Sound::FrameMoveDelayedEffects(float elapsedTime)
1373 {
1374  game->logger->AddToCallStack("Sound::FrameMoveDelayedEffects");
1375 
1376  if (excludeFromGlobalAttenuate != -1)
1377  {
1378  // gaVolumeAdj 0.8 instead of default 1.0
1379  // invVol 0.2 instead of 0
1380  const float invVolumeAdj = 1.0f - gaVolumeAdj;
1381  const float oldGlobalAttenuate = globalAttenuate;
1382  gaTimer += elapsedTime;
1383  if (gaTimer < gaTimeToFadeOut)
1384  globalAttenuate = 1.0f - invVolumeAdj * gaTimer / gaTimeToFadeOut;
1385  else if (gaTimer < gaTimeToFadeOut + gaTimeToHold)
1386  globalAttenuate = invVolumeAdj;
1389  else
1390  globalAttenuate = 1.0f;
1391 
1392  const float oldExcludedSoundVolume = sound_volume[excludeFromGlobalAttenuate];
1393  if (gaTimer < exTimeToFadeIn)
1395  else if (gaTimer < exTimeToFadeIn + exTimeToHold)
1399  else
1400  {
1404  }
1405 
1406  if (oldGlobalAttenuate != globalAttenuate || oldExcludedSoundVolume != sound_volume[excludeFromGlobalAttenuate])
1407  ChangeVolume();
1408  }
1409 
1410  for (size_t t = 0; t < delayedeffects.size(); t++)
1411  {
1412  delayedeffects[t].delay -= elapsedTime;
1413  if (delayedeffects[t].delay <= 0.0f)
1414  {
1415  PlayEx(delayedeffects[t].soundEnum, false, delayedeffects[t].volume, 1, 0, true);
1416  if (delayedeffects[t].soundEnum == SOUND_SHOCKWAVE)
1417  {
1418  GlobalAttenuate(0.5f, 1.5f, 6.0f, SOUND_EXPLODERING, 0.5f, 1.5f, 6.0f, delayedeffects[t].volume);
1419  PlayEx(SOUND_EXPLODERING, true, 0.0f);
1420  }
1421  delayedeffects.erase(delayedeffects.begin() + t);
1422  break;
1423  }
1424  }
1425 
1426  int oldSoundEnum = -1, oldArray = -1;
1427  float oldVolume = 0, oldPan = 0, oldFreqMod = 0;
1428  for (size_t t = 0; t < loopingeffects.size(); t++)
1429  {
1430  if (loopingeffects.at(t).soundEnum != oldSoundEnum && oldSoundEnum != -1)
1431  {
1432  if (oldVolume > 0)
1433  PlayEx(oldSoundEnum, true, oldVolume * GetAttenuation(oldArray == 0), oldFreqMod, oldPan - headpan);
1434  else
1435  Stop(oldSoundEnum);
1436  oldVolume = 0;
1437  }
1438  oldSoundEnum = loopingeffects.at(t).soundEnum;
1439 
1440  if (playerships[0].reference >= REF_DOCKCPOC || // in space
1441  playerships[loopingeffects.at(t).array].vehicleId != loopingeffects.at(t).vehicleId || // vehicle in that slot changed
1442  !playerships[loopingeffects.at(t).array].active || // vehicle is gone from scanner
1443  !playerships[loopingeffects.at(t).array].visible || // vehicle is gone from scanner
1444  playerships[loopingeffects.at(t).array].reference > 0) // we can't hear them
1445  {
1446  Stop(loopingeffects.at(t).soundEnum);
1447  delayedeffects.erase(delayedeffects.begin() + t);
1448  break;
1449  }
1450 
1451  D3DXVECTOR3 source, sourceVel;
1452  if (playerships[loopingeffects.at(t).array].reference == REF_INANOTHER)
1453  {
1454  source = playerships[playerships[loopingeffects.at(t).array].inarray].position;
1455  sourceVel = playerships[playerships[loopingeffects.at(t).array].inarray].velocity;
1456  }
1457  else
1458  {
1459  source = playerships[loopingeffects.at(t).array].position;
1460  sourceVel = playerships[loopingeffects.at(t).array].velocity;
1461  }
1462 
1463  D3DXVECTOR3 dest, destVel;
1464  if (playerships[0].reference == REF_INANOTHER)
1465  {
1467  destVel = playerships[playerships[0].inarray].velocity;
1468  }
1469  else
1470  {
1471  dest = playerships[0].position;
1472  destVel = playerships[0].velocity;
1473  }
1474 
1475  D3DXVECTOR3 result = source - dest;
1476  D3DXVECTOR3 resultVel = sourceVel - destVel;
1477  float f_temp = D3DXVec3Length(&result);
1478  if (f_temp < 0.5f)
1479  {
1480  float newVolume = sqrtf(f_temp / 0.5f);
1481  if (newVolume > 1.0f)
1482  newVolume = 1.0f;
1483  newVolume = 1.0f - newVolume;
1484  if (loopingeffects.at(t).array != 0)
1485  newVolume *= game->viewscreen->ptrPropulsion->staticDensity;
1486  if (newVolume < oldVolume)
1487  continue;
1488  oldVolume = newVolume;
1489  oldArray = loopingeffects.at(t).array;
1490 
1491  oldFreqMod = D3DXVec3Length(&resultVel);
1492  oldFreqMod /= game->viewscreen->ptrPropulsion->speedOfSoundKms; // speed of sound (at sea level?)
1493  oldFreqMod++; // if 0 vel, it should be 1 times the speed, at 1X sound it should be double speed
1494 
1495  D3DXVec3TransformCoord(&result, &result, &game->viewscreen->matrixView);
1496  float bear1;
1497  if (result.z != 0.0f)
1498  {
1499  bear1 = D3DXToDegree(atanf(result.x / result.z));
1500  const float mark1 = D3DXToDegree(atanf(result.y / result.z));
1501  f_temp = sqrtf(mark1 * mark1 + bear1 * bear1);
1502  if (f_temp > 180.0f)
1503  {
1504  f_temp = 180.0f / f_temp;
1505  bear1 *= f_temp;
1506  }
1507  if (result.z > 0.0f) // Behind us
1508  {
1509  if (bear1 > 0.0f)
1510  bear1 -= 180.0f;
1511  else
1512  bear1 += 180.0f;
1513  }
1514  }
1515  else // directly above or below
1516  {
1517  bear1 = 0.0f;
1518  }
1519  oldPan = sinf(bear1); // -90 is -1, -180 is 0 again
1520  }
1521  }
1522 
1523  if (oldVolume > 0)
1524  PlayEx(oldSoundEnum, true, oldVolume * GetAttenuation(oldArray == 0), oldFreqMod, oldPan - headpan);
1525  else if (oldSoundEnum != -1)
1526  Stop(oldSoundEnum);
1527 
1528  game->logger->AddToCallStack("Sound::FrameMoveDelayedEffects DONE");
1529 }
1530 
1531 void Sound::FrameMoveDopplerEffects(float elapsedTime)
1532 {
1533  game->logger->AddToCallStack("Sound::FrameMoveDopplerEffects");
1534 
1535  // Doppler, we only get data once per second...
1536  float closing1 = 1.0f, closing2 = 1.0f;
1537  float newvolume1 = 0.0f, newvolume2 = 0.0f;
1538  float pan = 0.0f, pan2 = 0.0f;
1539 
1540  game->bus->DebugSoundReal = 0;
1541  game->bus->DebugSoundFake = 0;
1542  game->bus->DebugSoundBear = 0;
1543  game->bus->DebugSoundClose = 0;
1544 
1545  if (playerships[0].reference < REF_DOCKCPOC) // we shouldn't hear anything in dock space
1546  {
1547  D3DXVECTOR3 ourPosition, ourVelocity;
1548  if (playerships[0].reference == REF_INANOTHER)
1549  {
1550  ourPosition = playerships[playerships[0].inarray].position;
1552  }
1553  else
1554  {
1555  ourPosition = playerships[0].position;
1556  ourVelocity = playerships[0].velocity - playerships[0].barycentric;
1557  }
1558 
1559 
1560  for (short t = 1; t < MAX_SCAN; t++)
1561  {
1562  if (playerships[t].active && playerships[t].logolight && // active and powered up
1563  (playerships[t].reference == REF_ACLMODE ||
1564  playerships[t].reference == REF_ONGROUND ||
1565  playerships[t].reference == REF_APNMODE) && // must be outside
1566  (playerships[t].type < PODS_PAX || playerships[t].type > PODS_ENUM) && // not PODS
1567  !playerships[t].groundvehicle) // not GV's
1568  {
1569  D3DXVECTOR3 realPositionDifference = ourPosition - playerships[t].position;
1570  const float realDistance = D3DXVec3Length(&realPositionDifference);
1571 
1572  // if he is 5km then this responds like he is at...
1573  const float delaySeconds = realDistance / game->viewscreen->ptrPropulsion->speedOfSoundKms;
1574  const D3DXVECTOR3 theirVelocity = playerships[t].velocity - playerships[t].barycentric;
1575  const D3DXVECTOR3 theirSoundPosition = (playerships[t].position - theirVelocity * delaySeconds); // back them up
1576  // this new distance
1577  D3DXVECTOR3 soundPositionDifference = ourPosition - theirSoundPosition;
1578  const float soundDistance = D3DXVec3Length(&soundPositionDifference);
1579 
1580  D3DXVec3TransformCoord(&soundPositionDifference, &soundPositionDifference, &game->viewscreen->matrixView);
1581 
1582 
1583  float newtons;
1584  switch (playerships[t].type)
1585  {
1586  case VehicleType::W6Manx: newtons = 1029817.0f; break;
1587  case VehicleType::E10: newtons = 2762909.0f; break;
1588  case VehicleType::E11: newtons = 3134393.0f; break;
1589  case VehicleType::P13: newtons = 1636364.0f; break;
1590  case VehicleType::T19: newtons = 246795.0f; break;
1591  case VehicleType::A4: newtons = 1388073.0f; break;
1592  default: newtons = 0.0f; break;
1593  }
1594  const float thrust = newtons * sqrtf(powf(playerships[t].tx, 2.0f) + powf(playerships[t].ty, 2.0f) + powf(playerships[t].tz, 2.0f));
1595  // 50% E-10 is 1381454.5 is 1.68 which gets capped to 1
1596  // 100% T-19 is 246795.0 is negative which gets capped to 0
1597  // we transition to ripping the air at 513000 to 1029817 N
1598  const float percentDoppler2 = Clamp(min((thrust - 513000.0f) / 516817.0f, 1.0f), 0, 1);
1599 
1600 
1601  // so total thrust of the e-11
1602  const float percentDoppler = 1.0f;// -percentDoppler2;
1603 
1604  // 10 km for an aircraft (doppler)
1605  if (soundDistance < 10.0f && percentDoppler > 0)
1606  {
1607  // at 10km this is 0, at 0km it is 1, 5km this is .29
1608  const float tfal = (1.0f - sqrtf(soundDistance * 0.1f)) * game->viewscreen->ptrPropulsion->staticDensity;
1609  // 0.0f is quiet... so attenutate of 1.0 makes it -5000.0f...
1610  // so thrust of 1 is quiet, 0 is loud, for density
1611  const float proposedvolume = min(tfal * percentDoppler * thrust / 513000.0f, 1);
1612 
1613  if (proposedvolume > newvolume1)
1614  {
1615  newvolume1 = proposedvolume;
1616 
1617  // this new distance in 1 second
1618  D3DXVECTOR3 tempvec = (theirSoundPosition + theirVelocity) - (ourPosition + ourVelocity);
1619  closing1 = soundDistance - D3DXVec3Length(&tempvec);
1620  closing1 /= game->viewscreen->ptrPropulsion->speedOfSoundKms; // 0.34029f; // speed of sound (at sea level?)
1621  closing1++; // if 0 vel, it should be 1 times the speed, at 1X sound it should be double speed
1622 
1623  float bear1;
1624  if (soundPositionDifference.z != 0.0f)
1625  {
1626  bear1 = D3DXToDegree(atanf(soundPositionDifference.x / soundPositionDifference.z));
1627  const float mark1 = D3DXToDegree(atanf(soundPositionDifference.y / soundPositionDifference.z));
1628 
1629  float f_temp = sqrtf(mark1 * mark1 + bear1 * bear1);
1630  if (f_temp > 180.0f)
1631  {
1632  f_temp = 180.0f / f_temp;
1633  bear1 *= f_temp;
1634  }
1635  if (soundPositionDifference.z > 0.0f) // Behind us
1636  {
1637  if (bear1 > 0.0f)
1638  bear1 -= 180.0f;
1639  else
1640  bear1 += 180.0f;
1641  }
1642  }
1643  else // directly above or below
1644  {
1645  bear1 = 0.0f;
1646  }
1647 
1648  game->bus->DebugSoundReal = realDistance;
1649  game->bus->DebugSoundFake = soundDistance;
1650  game->bus->DebugSoundBear = bear1;
1651  game->bus->DebugSoundClose = closing1;
1652 
1653  pan = sinf(D3DXToRadian(bear1)); // -90 is -1, -180 is 0 again
1654  }
1655  }
1656 
1657  // 80 km for a rocket (doppler2)... 4.4 km ... so at 8.8 it would be 1/4
1658  if (soundDistance < 80.0f && percentDoppler2 > 0)
1659  {
1660  float proposedvolume = powf(4.4f / soundDistance, 2.0f); // at 4.4 it is 1, at 2.2 it is 4x, at 44km it is 1/100
1661  proposedvolume *= (thrust - 513000.0f) / (7607000.0f - 513000.0f); // recording at 4.4km was a 7607kN
1662  proposedvolume *= percentDoppler2; // only thrust sounds over 513000 N get this treatment
1663  proposedvolume *= game->viewscreen->ptrPropulsion->staticDensity; // adjust for density
1664  proposedvolume = Clamp(proposedvolume, 0, 1);
1665 
1666  // 0.0f is quiet... so attenutate of 1.0 makes it -5000.0f...
1667  // so thrust of 1 is quiet, 0 is loud, for density
1668  if (proposedvolume > newvolume2)
1669  {
1670  newvolume2 = proposedvolume;
1671 
1672  // this new distance in 1 second
1673  D3DXVECTOR3 tempvec = (theirSoundPosition + theirVelocity) - (ourPosition + ourVelocity);
1674  closing2 = soundDistance - D3DXVec3Length(&tempvec);
1675  closing2 /= game->viewscreen->ptrPropulsion->speedOfSoundKms; // 0.34029f; // speed of sound (at sea level?)
1676  closing2++; // if 0 vel, it should be 1 times the speed, at 1X sound it should be double speed
1677 
1678  float bear1;
1679  if (soundPositionDifference.z != 0.0f)
1680  {
1681  bear1 = D3DXToDegree(atanf(soundPositionDifference.x / soundPositionDifference.z));
1682  float mark1 = D3DXToDegree(atanf(soundPositionDifference.y / soundPositionDifference.z));
1683  float f_temp = sqrtf(mark1 * mark1 + bear1 * bear1);
1684  if (f_temp > 180.0f)
1685  {
1686  f_temp = 180.0f / f_temp;
1687  bear1 *= f_temp;
1688  }
1689  if (soundPositionDifference.z > 0.0f) // Behind us
1690  {
1691  if (bear1 > 0.0f)
1692  bear1 -= 180.0f;
1693  else
1694  bear1 += 180.0f;
1695  }
1696  }
1697  else // directly above or below
1698  {
1699  bear1 = 0.0f;
1700  }
1701  pan2 = sinf(D3DXToRadian(bear1)); // -90 is -1, -180 is 0 again
1702  }
1703  }
1704 
1705  }
1706  }
1707  }
1708 
1709  if (newvolume1 > 0 || oldvolume > 0)
1710  {
1711  newvolume1 = min(newvolume1, 1); // max of 1
1712  float f_temp = (newvolume1 - oldvolume) * elapsedTime;
1713  const float volume = oldvolume + f_temp;
1714 
1715  f_temp = (closing1 - oldFrequencyMod) * elapsedTime;
1716  const float frequency_mod = oldFrequencyMod + f_temp;
1717 
1718  f_temp = (pan - oldPan) * elapsedTime;
1719  const float finalPan = oldPan + f_temp;
1720 
1721  PlayEx(SOUND_DOPPLER, true, volume * GetAttenuation(false), frequency_mod, finalPan - headpan);
1722 
1723  oldvolume = volume;
1724  oldFrequencyMod = frequency_mod;
1725  oldPan = finalPan;
1726  }
1727  else
1728  {
1730  oldvolume = 0;
1731  oldFrequencyMod = 1;
1732  oldPan = 0;
1733  }
1734 
1735  if (newvolume2 > 0 || oldvolume2 > 0)
1736  {
1737  newvolume2 = min(newvolume2, 1); // max of 1
1738  float f_temp = (newvolume2 - oldvolume2) * elapsedTime;
1739  const float volume = oldvolume2 + f_temp;
1740 
1741  f_temp = (closing2 - oldFrequencyMod2) * elapsedTime;
1742  const float frequency_mod = oldFrequencyMod2 + f_temp;
1743 
1744  f_temp = (pan2 - oldPan2) * elapsedTime;
1745  const float finalPan = oldPan2 + f_temp;
1746 
1747  PlayEx(SOUND_DOPPLER2, true, volume * GetAttenuation(false), frequency_mod, finalPan - headpan);
1748 
1749  oldvolume2 = volume;
1750  oldFrequencyMod2 = frequency_mod;
1751  oldPan2 = finalPan;
1752  }
1753  else
1754  {
1756  oldvolume2 = 0;
1757  oldFrequencyMod2 = 1;
1758  oldPan2 = 0;
1759  }
1760 
1761  game->logger->AddToCallStack("Sound::FrameMoveDopplerEffects DONE");
1762 }
1763 
1764 void Sound::PrecipWindSoundBarrier(D3DXVECTOR3 relativewind, float elapsedTime)
1765 {
1766  //static D3DXVECTOR3 relativewindtarget = relativewind;
1767 
1769  //D3DXVec3Lerp(&relativewind, &relativewind, &relativewindtarget, elapsedTime);
1771 
1772  // PAN
1773  float panfloat = 0.0f;
1774  if (relativewind.z != 0.0f)
1775  {
1776  panfloat = atanf(relativewind.x / relativewind.z) / D3DX_HALFPI; // 0/10 is 0, 5/10 is .25 10/10 is .5 20/10 is 1
1777  if (panfloat < -1.0f)
1778  panfloat = -1.0f;
1779  else if (panfloat > 1.0f)
1780  panfloat = 1.0f;
1781  }
1782 
1783  // WIND NOISE
1784  float velocity;
1785  if (playerships[0].reference <= REF_BUILDING)
1786  velocity = D3DXVec3Length(&relativewind);
1787  else
1788  velocity = 0.0f;
1789 
1790  if (velocity > 0.001f)
1791  {
1792  float percentvelocity = velocity / 0.135f; // percent of 135 m/s
1793  if (percentvelocity > 1.0f)
1794  percentvelocity = 1.0f;
1795 
1796  const float freq = 1.0f + percentvelocity;
1797 
1798  const float sqrtvelocity = percentvelocity * percentvelocity;
1799  float volume = Clamp(sqrtvelocity * game->viewscreen->ptrPropulsion->dynamicDensity, 0, 1);
1800  if (playerships[0].reference == REF_INANOTHER)
1801  volume *= sqrtf(playerships[playerships[0].inarray].baydoorextent);
1802 
1803  PlayEx(SOUND_WIND, true, volume * GetAttenuation(false), freq, panfloat - headpan);
1804  PlayEx(SOUND_GEARWIND, true, volume * ourcockpit.gearextent * GetAttenuation(true), freq, headpan);
1805  PlayEx(SOUND_FLAPWIND, true, volume * ourcockpit.flapExtent * GetAttenuation(true), freq, headpan);
1806  }
1807  else
1808  {
1809  Stop(SOUND_WIND);
1812  }
1813 
1814 
1815 
1816 #pragma region SOUND BARRIER and SONIC BOOM
1817 
1818  static float oldBusMach = 0.0f;
1819  if (oldBusMach != 0.0f)
1820  {
1821  if ((oldBusMach < 1.0f && game->bus->Mach >= 1.0f) ||
1822  (game->bus->Mach < 1.0f && oldBusMach >= 1.0f))
1823  {
1824  Command command;
1825  command.name = "AuralSoundBarrier";
1826  game->bus->commandStream.emplace_back(command);
1827  }
1828  }
1829  oldBusMach = game->bus->Mach;
1830 
1831  // based on the REAL number
1833  static float passedSoundBarrierBoom = false;
1834  if (game->viewscreen->ptrPropulsion->mach >= 1.0f)
1835  {
1836  if (!passedSoundBarrierBoom)
1837  {
1838  passedSoundBarrierBoom = true;
1839  // send to everyone else
1840  SClientPacket outpacket;
1841  outpacket.type = 23; // Universe sound
1842  outpacket.f_x = 1.0f; // Sonic boom
1843  outpacket.f_y = 0.0f; // NULL
1844  outpacket.f_z = 0.0f; // NULL
1845  outpacket.f_w = 0.0f; // NULL
1846  game->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
1847  }
1848  }
1849  else if (passedSoundBarrierBoom)
1850  {
1851  passedSoundBarrierBoom = false;
1852  }
1853 
1854 #pragma endregion
1855 
1856 
1857  // PRECIPITATION
1858  float rateofchange = velocity + 0.0353f * cosf(game->bus->LatitudeRad);
1859  rateofchange *= 0.6f * elapsedTime; // /1.5km to be safe in which it can change over
1860 
1861 
1862  float targetintensity;
1863  if (f_MSL < 3.3f)
1864  targetintensity = game->viewscreen->ptrWeather->GetTurbidity();
1865  else
1866  targetintensity = 2.0f;
1867 
1868 
1869  static float currentintensity = targetintensity;
1870  if (currentintensity < targetintensity)
1871  {
1872  currentintensity += rateofchange;
1873  if (currentintensity > targetintensity)
1874  currentintensity = targetintensity;
1875  }
1876  else if (currentintensity > targetintensity)
1877  {
1878  currentintensity -= rateofchange;
1879  if (currentintensity < targetintensity)
1880  currentintensity = targetintensity;
1881  }
1882 
1883 
1884  float percentvelocity = velocity / 0.135f; // percent of 135 m/s ... used to be 200 m/s but aero effects are 135 m/s
1885  if (percentvelocity > 1.0f)
1886  percentvelocity = 1.0f;
1887 
1888  float frequency_mod = 1.0f + percentvelocity; // used to be 0.5f*percentvelocity but aero effects are 2x...
1889 
1890  float f_temp = sqrtf((currentintensity - 2.0f) / 14.0f);
1891  float volume = percentvelocity * f_temp;
1892 
1893  static short precipplay = 0;
1894  short oldprecipplay = precipplay;
1895 
1896  if (currentintensity <= 2.0f)
1897  precipplay = -1;
1898  else if (currentintensity >= 8.0f)
1899  precipplay = 1;
1900  else if (currentintensity >= 10.0f)
1901  precipplay = 2;
1902  else if (currentintensity >= 12.0f)
1903  precipplay = 3;
1904  else if (currentintensity >= 14.0f)
1905  precipplay = 4;
1906  else
1907  precipplay = 0; // tezzac found this 10/10/2018 JIRA 1121, covers currentintensity 2 to 8!
1908 
1909  if (precipplay >= 0)
1910  PlayEx(SOUND_PRECIP0 + precipplay, true, volume * GetAttenuation(true), frequency_mod, panfloat - headpan);
1911 
1912  if (precipplay != oldprecipplay)
1913  {
1914  if (precipplay != 0)
1916  if (precipplay != 1)
1918  if (precipplay != 2)
1920  if (precipplay != 3)
1922  if (precipplay != 4)
1924  }
1925 } // END OF PRECIPITATION
1926 
1927 void Sound::AddDelayedSound(int soundEnum, float delay, float volume)
1928 {
1929  char msg[99];
1930  sprintf_s(msg, 99, "AddDelayedSound adding sound %i with delay: %f", soundEnum, delay);
1931  Trace(msg);
1932 
1933  if (delay < 0.017f) // one frame
1934  {
1935  PlayEx(soundEnum, false, volume);
1936  return;
1937  }
1938 
1939  Sdelayedeffects delayedEffect;
1940  delayedEffect.delay = delay;
1941  delayedEffect.soundEnum = soundEnum;
1942  delayedEffect.volume = volume;
1943  delayedeffects.emplace_back(delayedEffect);
1944 }
1945 
1946 void Sound::Stop(int soundEnum)
1947 {
1948  if (sound_channel[soundEnum])
1949  BASS_ChannelPause(sound_channel[soundEnum]);
1950 }
1951 
1953 
1954 void Sound::AddLoopingVehicleSound(int soundEnum, unsigned char array)
1955 {
1956  Sloopingeffects loopingEffect;
1957  loopingEffect.soundEnum = soundEnum;
1958  loopingEffect.array = array;
1959  loopingEffect.vehicleId = playerships[array].vehicleId;
1960  loopingeffects.emplace_back(loopingEffect);
1961  std::sort(loopingeffects.begin(), loopingeffects.end(), myfunction);
1962 }
1963 
1964 void Sound::RemoveLoopingVehicleSound(int soundEnum, unsigned char array)
1965 {
1966  for (size_t t = 0; t < loopingeffects.size(); t++)
1967  {
1968  if (loopingeffects.at(t).array == array && loopingeffects.at(t).soundEnum == soundEnum)
1969  {
1970  Stop(loopingeffects.at(t).soundEnum);
1971  loopingeffects.erase(loopingeffects.begin() + t);
1972  break;
1973  }
1974  }
1975 }
1976 
1977 void Sound::ChangeCockpit(bool force)
1978 {
1979  game->logger->AddToCallStack("Sound::ChangeCockpit");
1980 
1981  switch (ourcockpit.texturelib)
1982  {
1983  case E10:
1984  LoadCockpitSound(SOUND_COCKPITAMBIENT, "Sounds\\Cockpits\\320-idle.wav", force);
1985  LoadCockpitSound(SOUND_COCKPITENGINELEFT, "Sounds\\Cockpits\\AlienFreighter.wav", force);
1986  LoadCockpitSound(SOUND_COCKPITENGINERIGHT, "Sounds\\Cockpits\\AlienFreighter.wav", force);
1987  LoadCockpitSound(SOUND_COCKPITENGINECENTER, "Sounds\\Cockpits\\AlienFreighter.wav", force);
1988  LoadCockpitSound(SOUND_COCKPITSTART, "Sounds\\Cockpits\\startup40.wav", force);
1989  LoadCockpitSound(SOUND_COCKPITLAND, "Sounds\\Cockpits\\touchlb.wav", force);
1990  LoadCockpitSound(SOUND_COCKPITLEVEL, "Sounds\\Cockpits\\touchld.wav", force);
1991 
1993  LoadCockpitSound(SOUND_COCKPITLIGHTOFF, "Sounds\\VMU\\E-10\\monroe-ll0.wav", force, &game->config.soundConfigComputer);
1994  LoadCockpitSound(SOUND_COCKPITLIGHTON, "Sounds\\VMU\\E-10\\monroe-ll1.wav", force, &game->config.soundConfigComputer);
1995  LoadCockpitSound(SOUND_STALL, "Sounds\\VMU\\E-10\\stall.wav", force, &game->config.soundConfigComputer);
1997 
1998  LoadCockpitSound(SOUND_GPWSSINKRATE, "Sounds\\VMU\\E-10\\GPWS\\monroe-sr.wav", force, &game->config.soundConfigComputer);
1999  LoadCockpitSound(SOUND_GPWSPULLUP, "Sounds\\VMU\\E-10\\GPWS\\monroe-pu.wav", force, &game->config.soundConfigComputer);
2000  LoadCockpitSound(SOUND_GPWSTERRAINTERRAIN, "Sounds\\VMU\\E-10\\GPWS\\monroe-tt.wav", force, &game->config.soundConfigComputer);
2002  LoadCockpitSound(SOUND_GPWSTOOLOWGEAR, "Sounds\\VMU\\E-10\\GPWS\\monroe-struts.wav", force, &game->config.soundConfigComputer);
2004  LoadCockpitSound(SOUND_GPWSBANKANGLE, "Sounds\\VMU\\E-10\\GPWS\\BankAngle.wav", force, &game->config.soundConfigComputer);
2005  LoadCockpitSound(SOUND_GPWSGLIDESLOPE, "Sounds\\VMU\\E-10\\GPWS\\Glideslope.wav", force, &game->config.soundConfigComputer);
2007  LoadCockpitSound(SOUND_GPWSTEN, "Sounds\\VMU\\E-10\\GPWS\\10.wav", force, &game->config.soundConfigComputer);
2008  LoadCockpitSound(SOUND_GPWSTWENTY, "Sounds\\VMU\\E-10\\GPWS\\20.wav", force, &game->config.soundConfigComputer);
2009  LoadCockpitSound(SOUND_GPWSTHIRTY, "Sounds\\VMU\\E-10\\GPWS\\30.wav", force, &game->config.soundConfigComputer);
2010  LoadCockpitSound(SOUND_GPWSFORTY, "Sounds\\VMU\\E-10\\GPWS\\40.wav", force, &game->config.soundConfigComputer);
2011  LoadCockpitSound(SOUND_GPWSFIFTY, "Sounds\\VMU\\E-10\\GPWS\\50.wav", force, &game->config.soundConfigComputer);
2012  LoadCockpitSound(SOUND_GPWSONEHUNDRED, "Sounds\\VMU\\E-10\\GPWS\\100.wav", force, &game->config.soundConfigComputer);
2013  LoadCockpitSound(SOUND_GPWSTWOHUNDRED, "Sounds\\VMU\\E-10\\GPWS\\200.wav", force, &game->config.soundConfigComputer);
2015  LoadCockpitSound(SOUND_GPWSFIVEHUNDRED, "Sounds\\VMU\\E-10\\GPWS\\500.wav", force, &game->config.soundConfigComputer);
2016  LoadCockpitSound(SOUND_GPWSONETHOUSAND, "Sounds\\VMU\\E-10\\GPWS\\1000.wav", force, &game->config.soundConfigComputer);
2019  LoadCockpitSound(SOUND_GPWSWINDSHEARWARNING, "Sounds\\VMU\\E-10\\GPWS\\WindshearWarning.wav", force, &game->config.soundConfigComputer);
2020  LoadCockpitSound(SOUND_GPWSWINDSHEARCAUTION, "Sounds\\VMU\\E-10\\GPWS\\WindshearCaution.wav", force, &game->config.soundConfigComputer);
2022 
2023  LoadCockpitSound(SOUND_TCASCLEAR, "Sounds\\VMU\\E-10\\TCAS\\clearofconflict.wav", force, &game->config.soundConfigComputer);
2024  LoadCockpitSound(SOUND_TCASTRAFFIC, "Sounds\\VMU\\E-10\\TCAS\\traffic.wav", force, &game->config.soundConfigComputer);
2025  LoadCockpitSound(SOUND_TCASCLIMB, "Sounds\\VMU\\E-10\\TCAS\\climb.wav", force, &game->config.soundConfigComputer);
2026  LoadCockpitSound(SOUND_TCASDESCEND, "Sounds\\VMU\\E-10\\TCAS\\descend.wav", force, &game->config.soundConfigComputer);
2027  LoadCockpitSound(SOUND_TCASMONITOR, "Sounds\\VMU\\E-10\\TCAS\\monitorverticalspeed.wav", force, &game->config.soundConfigComputer);
2028 
2029  LoadCockpitSound(SOUND_MONROECARGOBAY, "Sounds\\VMU\\E-10\\monroe-tiaditcb.wav", force, &game->config.soundConfigComputer);
2030  LoadCockpitSound(SOUND_MONROEALLMOORINGSCLEARED, "Sounds\\VMU\\E-10\\monroe-amc.wav", force, &game->config.soundConfigComputer);
2031  LoadCockpitSound(SOUND_MONROEGEARDOWN, "Sounds\\VMU\\E-10\\monroe-strutse.wav", force, &game->config.soundConfigComputer);
2032  LoadCockpitSound(SOUND_MONROEGEARUP, "Sounds\\VMU\\E-10\\monroe-strutsr.wav", force, &game->config.soundConfigComputer);
2033  LoadCockpitSound(SOUND_MONROEHULLIONIZATION, "Sounds\\VMU\\E-10\\monroe-hid.wav", force, &game->config.soundConfigComputer);
2034  LoadCockpitSound(SOUND_MONROESOUNDBARRIER, "Sounds\\VMU\\E-10\\monroe-psb.wav", force, &game->config.soundConfigComputer);
2045  LoadCockpitSound(SOUND_CABINPRESSURE, "Sounds\\VMU\\E-10\\CabinPressure.wav", force, &game->config.soundConfigComputer);
2046 
2047 
2048  ourcockpit.attenuate = 0.5f;
2049  break;
2050 
2051  case E11:
2052  LoadCockpitSound(SOUND_COCKPITAMBIENT, "Sounds\\Cockpits\\320-idle.wav", force);
2053  LoadCockpitSound(SOUND_COCKPITENGINELEFT, "Sounds\\Cockpits\\AlienFreighter.wav", force);
2054  LoadCockpitSound(SOUND_COCKPITENGINERIGHT, "Sounds\\Cockpits\\AlienFreighter.wav", force);
2055  LoadCockpitSound(SOUND_COCKPITENGINECENTER, "Sounds\\Cockpits\\AlienFreighter.wav", force);
2056  LoadCockpitSound(SOUND_COCKPITSTART, "Sounds\\Cockpits\\startup40.wav", force);
2057  LoadCockpitSound(SOUND_COCKPITLAND, "Sounds\\Cockpits\\touchlb.wav", force);
2058  LoadCockpitSound(SOUND_COCKPITLEVEL, "Sounds\\Cockpits\\touchld.wav", force);
2059 
2061  LoadCockpitSound(SOUND_COCKPITLIGHTOFF, "Sounds\\VMU\\monroe-ll0.mp3", force, &game->config.soundConfigComputer);
2062  LoadCockpitSound(SOUND_COCKPITLIGHTON, "Sounds\\VMU\\monroe-ll1.mp3", force, &game->config.soundConfigComputer);
2063  LoadCockpitSound(SOUND_STALL, "Sounds\\VMU\\stall.mp3", force, &game->config.soundConfigComputer);
2065 
2066  LoadCockpitSound(SOUND_GPWSSINKRATE, "Sounds\\VMU\\GPWS\\monroe-sr.mp3", force, &game->config.soundConfigComputer);
2067  LoadCockpitSound(SOUND_GPWSPULLUP, "Sounds\\VMU\\GPWS\\monroe-pu.mp3", force, &game->config.soundConfigComputer);
2068  LoadCockpitSound(SOUND_GPWSTERRAINTERRAIN, "Sounds\\VMU\\GPWS\\TerrainTerrain.mp3", force, &game->config.soundConfigComputer);
2069  LoadCockpitSound(SOUND_GPWSTOOLOWTERRAIN, "Sounds\\VMU\\GPWS\\TooLowTerrain.mp3", force, &game->config.soundConfigComputer);
2070  LoadCockpitSound(SOUND_GPWSTOOLOWGEAR, "Sounds\\VMU\\GPWS\\TooLowStruts.mp3", force, &game->config.soundConfigComputer);
2071  LoadCockpitSound(SOUND_GPWSTOOLOWFLAPS, "Sounds\\VMU\\GPWS\\TooLowFlaps.mp3", force, &game->config.soundConfigComputer);
2072  LoadCockpitSound(SOUND_GPWSBANKANGLE, "Sounds\\VMU\\GPWS\\BankAngle.wav", force, &game->config.soundConfigComputer);
2073  LoadCockpitSound(SOUND_GPWSGLIDESLOPE, "Sounds\\VMU\\GPWS\\Glideslope.wav", force, &game->config.soundConfigComputer);
2074  LoadCockpitSound(SOUND_GPWSRETARD, "Sounds\\VMU\\GPWS\\Retard.wav", force, &game->config.soundConfigComputer);
2075  LoadCockpitSound(SOUND_GPWSTEN, "Sounds\\VMU\\GPWS\\10.wav", force, &game->config.soundConfigComputer);
2076  LoadCockpitSound(SOUND_GPWSTWENTY, "Sounds\\VMU\\GPWS\\20.wav", force, &game->config.soundConfigComputer);
2077  LoadCockpitSound(SOUND_GPWSTHIRTY, "Sounds\\VMU\\GPWS\\30.wav", force, &game->config.soundConfigComputer);
2078  LoadCockpitSound(SOUND_GPWSFORTY, "Sounds\\VMU\\GPWS\\40.wav", force, &game->config.soundConfigComputer);
2079  LoadCockpitSound(SOUND_GPWSFIFTY, "Sounds\\VMU\\GPWS\\50.wav", force, &game->config.soundConfigComputer);
2080  LoadCockpitSound(SOUND_GPWSONEHUNDRED, "Sounds\\VMU\\GPWS\\100.wav", force, &game->config.soundConfigComputer);
2081  LoadCockpitSound(SOUND_GPWSTWOHUNDRED, "Sounds\\VMU\\GPWS\\200.wav", force, &game->config.soundConfigComputer);
2082  LoadCockpitSound(SOUND_GPWSMINIMUMS, "Sounds\\VMU\\GPWS\\Minimums.wav", force, &game->config.soundConfigComputer);
2083  LoadCockpitSound(SOUND_GPWSFIVEHUNDRED, "Sounds\\VMU\\GPWS\\500.wav", force, &game->config.soundConfigComputer);
2084  LoadCockpitSound(SOUND_GPWSONETHOUSAND, "Sounds\\VMU\\GPWS\\1000.wav", force, &game->config.soundConfigComputer);
2085  LoadCockpitSound(SOUND_GPWSDONTSINK, "Sounds\\VMU\\GPWS\\DontSink.mp3", force, &game->config.soundConfigComputer);
2086  LoadCockpitSound(SOUND_GPWSPOSITIVERATE, "Sounds\\VMU\\GPWS\\PositiveRate.mp3", force, &game->config.soundConfigComputer);
2087  LoadCockpitSound(SOUND_GPWSWINDSHEARWARNING, "Sounds\\VMU\\GPWS\\WindshearWarning.wav", force, &game->config.soundConfigComputer);
2088  LoadCockpitSound(SOUND_GPWSWINDSHEARCAUTION, "Sounds\\VMU\\GPWS\\WindshearCaution.mp3", force, &game->config.soundConfigComputer);
2089  LoadCockpitSound(SOUND_GPWSROTATE, "Sounds\\VMU\\GPWS\\Rotate.mp3", force, &game->config.soundConfigComputer);
2090 
2091  LoadCockpitSound(SOUND_TCASCLEAR, "Sounds\\VMU\\TCAS\\clearofconflict.mp3", force, &game->config.soundConfigComputer);
2092  LoadCockpitSound(SOUND_TCASTRAFFIC, "Sounds\\VMU\\TCAS\\traffic.mp3", force, &game->config.soundConfigComputer);
2093  LoadCockpitSound(SOUND_TCASCLIMB, "Sounds\\VMU\\TCAS\\climb.mp3", force, &game->config.soundConfigComputer);
2094  LoadCockpitSound(SOUND_TCASDESCEND, "Sounds\\VMU\\TCAS\\descend.mp3", force, &game->config.soundConfigComputer);
2095  LoadCockpitSound(SOUND_TCASMONITOR, "Sounds\\VMU\\TCAS\\monitorverticalspeed.mp3", force, &game->config.soundConfigComputer);
2096 
2097  LoadCockpitSound(SOUND_MONROECARGOBAY, "Sounds\\VMU\\monroe-tiaditcb.mp3", force, &game->config.soundConfigComputer);
2098  LoadCockpitSound(SOUND_MONROEALLMOORINGSCLEARED, "Sounds\\VMU\\monroe-amc.mp3", force, &game->config.soundConfigComputer);
2099  LoadCockpitSound(SOUND_MONROEGEARDOWN, "Sounds\\VMU\\monroe-strutse.mp3", force, &game->config.soundConfigComputer);
2100  LoadCockpitSound(SOUND_MONROEGEARUP, "Sounds\\VMU\\monroe-strutsr.mp3", force, &game->config.soundConfigComputer);
2101  LoadCockpitSound(SOUND_MONROEHULLIONIZATION, "Sounds\\VMU\\monroe-hid.mp3", force, &game->config.soundConfigComputer);
2102  LoadCockpitSound(SOUND_MONROESOUNDBARRIER, "Sounds\\VMU\\monroe-psb.mp3", force, &game->config.soundConfigComputer);
2104  LoadCockpitSound(SOUND_CONFIGAF, "Sounds\\VMU\\config-af.mp3", force, &game->config.soundConfigComputer);
2105  LoadCockpitSound(SOUND_CONFIGFLAPS, "Sounds\\VMU\\config-flaps.mp3", force, &game->config.soundConfigComputer);
2106  LoadCockpitSound(SOUND_CONFIGTRIM, "Sounds\\VMU\\config-trim.mp3", force, &game->config.soundConfigComputer);
2107  LoadCockpitSound(SOUND_AURALUNITOKAY, "Sounds\\VMU\\AuralUnitOkay.mp3", force, &game->config.soundConfigComputer);
2108  LoadCockpitSound(SOUND_AURALUNITTESTA, "Sounds\\VMU\\AuralWarningTestA.mp3", force, &game->config.soundConfigComputer);
2109  LoadCockpitSound(SOUND_AURALUNITTESTB, "Sounds\\VMU\\AuralWarningTestB.mp3", force, &game->config.soundConfigComputer);
2110  LoadCockpitSound(SOUND_SCANNERSYNC, "Sounds\\VMU\\ScannerSync.mp3", force, &game->config.soundConfigComputer);
2111  LoadCockpitSound(SOUND_FORWARDTHRUST, "Sounds\\VMU\\ForwardThrust.mp3", force, &game->config.soundConfigComputer);
2112  LoadCockpitSound(SOUND_REVERSETHRUST, "Sounds\\VMU\\ReverseThrust.mp3", force, &game->config.soundConfigComputer);
2113  LoadCockpitSound(SOUND_CABINPRESSURE, "Sounds\\VMU\\CabinPressure.mp3", force, &game->config.soundConfigComputer);
2114 
2115  ourcockpit.attenuate = 0.5f;
2116  break;
2117 
2118  case C98:
2119  case C2:
2120  case C2A:
2121  LoadCockpitSound(SOUND_COCKPITAMBIENT, "Sounds\\Cockpits\\321-idle.wav", force);
2122  LoadCockpitSound(SOUND_COCKPITENGINELEFT, nullptr, force);
2123  LoadCockpitSound(SOUND_COCKPITENGINERIGHT, nullptr, force);
2124  LoadCockpitSound(SOUND_COCKPITENGINECENTER, "Sounds\\Cockpits\\MuVERmoto.wav", force);
2125  LoadCockpitSound(SOUND_COCKPITSTART, "Sounds\\Cockpits\\vehicle_start.wav", force);
2126  LoadCockpitSound(SOUND_COCKPITLAND, "Sounds\\Cockpits\\cmtouch1.wav", force);
2127  LoadCockpitSound(SOUND_COCKPITLEVEL, "Sounds\\Cockpits\\cmtouch2.wav", force);
2128 
2129  LoadCockpitSound(SOUND_COCKPITLOWFUEL, "Sounds\\nchime.wav", force, &game->config.soundConfigComputer);
2130  LoadCockpitSound(SOUND_COCKPITLIGHTOFF, "Sounds\\nchime.wav", force, &game->config.soundConfigComputer);
2131  LoadCockpitSound(SOUND_COCKPITLIGHTON, "Sounds\\nchime.wav", force, &game->config.soundConfigComputer);
2134 
2159 
2165 
2183 
2184  ourcockpit.attenuate = 0.9f;
2185  break;
2186 
2187  case T120:
2188  case T121:
2189  LoadCockpitSound(SOUND_COCKPITAMBIENT, "Sounds\\Cockpits\\321-idle.wav", force);
2190  LoadCockpitSound(SOUND_COCKPITENGINELEFT, nullptr, force);
2191  LoadCockpitSound(SOUND_COCKPITENGINERIGHT, nullptr, force);
2192  LoadCockpitSound(SOUND_COCKPITENGINECENTER, "Sounds\\Cockpits\\steerhead_run.wav", force);
2193  LoadCockpitSound(SOUND_COCKPITSTART, "Sounds\\Cockpits\\steerhead_start.wav", force);
2194  LoadCockpitSound(SOUND_COCKPITLAND, "Sounds\\Cockpits\\cmtouch1.wav", force);
2195  LoadCockpitSound(SOUND_COCKPITLEVEL, "Sounds\\Cockpits\\cmtouch2.wav", force);
2196 
2197  LoadCockpitSound(SOUND_COCKPITLOWFUEL, "Sounds\\nchime.wav", force, &game->config.soundConfigComputer);
2198  LoadCockpitSound(SOUND_COCKPITLIGHTOFF, "Sounds\\nchime.wav", force, &game->config.soundConfigComputer);
2199  LoadCockpitSound(SOUND_COCKPITLIGHTON, "Sounds\\nchime.wav", force, &game->config.soundConfigComputer);
2202 
2227 
2233 
2251 
2252  ourcockpit.attenuate = 0.8f;
2253  break;
2254 
2255  case P13:
2256  LoadCockpitSound(SOUND_COCKPITAMBIENT, "Sounds\\Cockpits\\322-idle.wav", force);
2257  LoadCockpitSound(SOUND_COCKPITENGINELEFT, "Sounds\\Cockpits\\AlienEng1.wav", force);
2258  LoadCockpitSound(SOUND_COCKPITENGINERIGHT, "Sounds\\Cockpits\\AlienEng1.wav", force);
2260  LoadCockpitSound(SOUND_COCKPITSTART, "Sounds\\Cockpits\\prowler_start.wav", force);
2261  LoadCockpitSound(SOUND_COCKPITLAND, "Sounds\\Cockpits\\touchlb.wav", force);
2262  LoadCockpitSound(SOUND_COCKPITLEVEL, "Sounds\\Cockpits\\touchld.wav", force);
2263 
2265  LoadCockpitSound(SOUND_COCKPITLIGHTOFF, "Sounds\\VMU\\E-10\\monroe-ll0.wav", force, &game->config.soundConfigComputer);
2266  LoadCockpitSound(SOUND_COCKPITLIGHTON, "Sounds\\VMU\\E-10\\monroe-ll1.wav", force, &game->config.soundConfigComputer);
2267  LoadCockpitSound(SOUND_STALL, "Sounds\\VMU\\E-10\\stall.wav", force, &game->config.soundConfigComputer);
2269 
2270  LoadCockpitSound(SOUND_GPWSSINKRATE, "Sounds\\VMU\\E-10\\GPWS\\monroe-sr.wav", force, &game->config.soundConfigComputer);
2271  LoadCockpitSound(SOUND_GPWSPULLUP, "Sounds\\VMU\\E-10\\GPWS\\monroe-pu.wav", force, &game->config.soundConfigComputer);
2272  LoadCockpitSound(SOUND_GPWSTERRAINTERRAIN, "Sounds\\VMU\\E-10\\GPWS\\monroe-tt.wav", force, &game->config.soundConfigComputer);
2274  LoadCockpitSound(SOUND_GPWSTOOLOWGEAR, "Sounds\\VMU\\E-10\\GPWS\\monroe-struts.wav", force, &game->config.soundConfigComputer);
2276  LoadCockpitSound(SOUND_GPWSBANKANGLE, "Sounds\\VMU\\E-10\\GPWS\\BankAngle.wav", force, &game->config.soundConfigComputer);
2277  LoadCockpitSound(SOUND_GPWSGLIDESLOPE, "Sounds\\VMU\\E-10\\GPWS\\Glideslope.wav", force, &game->config.soundConfigComputer);
2279  LoadCockpitSound(SOUND_GPWSTEN, "Sounds\\VMU\\E-10\\GPWS\\10.wav", force, &game->config.soundConfigComputer);
2280  LoadCockpitSound(SOUND_GPWSTWENTY, "Sounds\\VMU\\E-10\\GPWS\\20.wav", force, &game->config.soundConfigComputer);
2281  LoadCockpitSound(SOUND_GPWSTHIRTY, "Sounds\\VMU\\E-10\\GPWS\\30.wav", force, &game->config.soundConfigComputer);
2282  LoadCockpitSound(SOUND_GPWSFORTY, "Sounds\\VMU\\E-10\\GPWS\\40.wav", force, &game->config.soundConfigComputer);
2283  LoadCockpitSound(SOUND_GPWSFIFTY, "Sounds\\VMU\\E-10\\GPWS\\50.wav", force, &game->config.soundConfigComputer);
2284  LoadCockpitSound(SOUND_GPWSONEHUNDRED, "Sounds\\VMU\\E-10\\GPWS\\100.wav", force, &game->config.soundConfigComputer);
2285  LoadCockpitSound(SOUND_GPWSTWOHUNDRED, "Sounds\\VMU\\E-10\\GPWS\\200.wav", force, &game->config.soundConfigComputer);
2287  LoadCockpitSound(SOUND_GPWSFIVEHUNDRED, "Sounds\\VMU\\E-10\\GPWS\\500.wav", force, &game->config.soundConfigComputer);
2288  LoadCockpitSound(SOUND_GPWSONETHOUSAND, "Sounds\\VMU\\E-10\\GPWS\\1000.wav", force, &game->config.soundConfigComputer);
2291  LoadCockpitSound(SOUND_GPWSWINDSHEARWARNING, "Sounds\\VMU\\E-10\\GPWS\\WindshearWarning.wav", force, &game->config.soundConfigComputer);
2292  LoadCockpitSound(SOUND_GPWSWINDSHEARCAUTION, "Sounds\\VMU\\E-10\\GPWS\\WindshearCaution.wav", force, &game->config.soundConfigComputer);
2294 
2295  LoadCockpitSound(SOUND_TCASCLEAR, "Sounds\\VMU\\E-10\\TCAS\\clearofconflict.wav", force, &game->config.soundConfigComputer);
2296  LoadCockpitSound(SOUND_TCASTRAFFIC, "Sounds\\VMU\\E-10\\TCAS\\traffic.wav", force, &game->config.soundConfigComputer);
2297  LoadCockpitSound(SOUND_TCASCLIMB, "Sounds\\VMU\\E-10\\TCAS\\climb.wav", force, &game->config.soundConfigComputer);
2298  LoadCockpitSound(SOUND_TCASDESCEND, "Sounds\\VMU\\E-10\\TCAS\\descend.wav", force, &game->config.soundConfigComputer);
2299  LoadCockpitSound(SOUND_TCASMONITOR, "Sounds\\VMU\\E-10\\TCAS\\monitorverticalspeed.wav", force, &game->config.soundConfigComputer);
2300 
2301  LoadCockpitSound(SOUND_MONROECARGOBAY, "Sounds\\VMU\\E-10\\monroe-tiaditcb.wav", force, &game->config.soundConfigComputer);
2302  LoadCockpitSound(SOUND_MONROEALLMOORINGSCLEARED, "Sounds\\VMU\\E-10\\monroe-amc.wav", force, &game->config.soundConfigComputer);
2303  LoadCockpitSound(SOUND_MONROEGEARDOWN, "Sounds\\VMU\\E-10\\monroe-strutse.wav", force, &game->config.soundConfigComputer);
2304  LoadCockpitSound(SOUND_MONROEGEARUP, "Sounds\\VMU\\E-10\\monroe-strutsr.wav", force, &game->config.soundConfigComputer);
2305  LoadCockpitSound(SOUND_MONROEHULLIONIZATION, "Sounds\\VMU\\E-10\\monroe-hid.wav", force, &game->config.soundConfigComputer);
2306  LoadCockpitSound(SOUND_MONROESOUNDBARRIER, "Sounds\\VMU\\E-10\\monroe-psb.wav", force, &game->config.soundConfigComputer);
2317  LoadCockpitSound(SOUND_CABINPRESSURE, "Sounds\\VMU\\E-10\\CabinPressure.wav", force, &game->config.soundConfigComputer);
2318 
2319  ourcockpit.attenuate = 0.6f;
2320  break;
2321 
2322  case A4:
2323  LoadCockpitSound(SOUND_COCKPITAMBIENT, "Sounds\\Cockpits\\CABIN FANS.wav", force);
2324  LoadCockpitSound(SOUND_COCKPITENGINELEFT, "Sounds\\Cockpits\\fighter_on_space1.wav", force);
2325  LoadCockpitSound(SOUND_COCKPITENGINERIGHT, "Sounds\\Cockpits\\fighter_on_space1.wav", force);
2327  LoadCockpitSound(SOUND_COCKPITSTART, "Sounds\\Cockpits\\cruiser_start.wav", force);
2328  LoadCockpitSound(SOUND_COCKPITLAND, "Sounds\\Cockpits\\touchlb.wav", force);
2329  LoadCockpitSound(SOUND_COCKPITLEVEL, "Sounds\\Cockpits\\touchld.wav", force);
2330 
2332  LoadCockpitSound(SOUND_COCKPITLIGHTOFF, "Sounds\\VMU\\E-10\\monroe-ll0.wav", force, &game->config.soundConfigComputer);
2333  LoadCockpitSound(SOUND_COCKPITLIGHTON, "Sounds\\VMU\\E-10\\monroe-ll1.wav", force, &game->config.soundConfigComputer);
2334  LoadCockpitSound(SOUND_STALL, "Sounds\\VMU\\E-10\\stall.wav", force, &game->config.soundConfigComputer);
2336 
2337  LoadCockpitSound(SOUND_GPWSSINKRATE, "Sounds\\VMU\\E-10\\GPWS\\monroe-sr.wav", force, &game->config.soundConfigComputer);
2338  LoadCockpitSound(SOUND_GPWSPULLUP, "Sounds\\VMU\\E-10\\GPWS\\monroe-pu.wav", force, &game->config.soundConfigComputer);
2339  LoadCockpitSound(SOUND_GPWSTERRAINTERRAIN, "Sounds\\VMU\\E-10\\GPWS\\monroe-tt.wav", force, &game->config.soundConfigComputer);
2341  LoadCockpitSound(SOUND_GPWSTOOLOWGEAR, "Sounds\\VMU\\E-10\\GPWS\\monroe-struts.wav", force, &game->config.soundConfigComputer);
2343  LoadCockpitSound(SOUND_GPWSBANKANGLE, "Sounds\\VMU\\E-10\\GPWS\\BankAngle.wav", force, &game->config.soundConfigComputer);
2344  LoadCockpitSound(SOUND_GPWSGLIDESLOPE, "Sounds\\VMU\\E-10\\GPWS\\Glideslope.wav", force, &game->config.soundConfigComputer);
2346  LoadCockpitSound(SOUND_GPWSTEN, "Sounds\\VMU\\E-10\\GPWS\\10.wav", force, &game->config.soundConfigComputer);
2347  LoadCockpitSound(SOUND_GPWSTWENTY, "Sounds\\VMU\\E-10\\GPWS\\20.wav", force, &game->config.soundConfigComputer);
2348  LoadCockpitSound(SOUND_GPWSTHIRTY, "Sounds\\VMU\\E-10\\GPWS\\30.wav", force, &game->config.soundConfigComputer);
2349  LoadCockpitSound(SOUND_GPWSFORTY, "Sounds\\VMU\\E-10\\GPWS\\40.wav", force, &game->config.soundConfigComputer);
2350  LoadCockpitSound(SOUND_GPWSFIFTY, "Sounds\\VMU\\E-10\\GPWS\\50.wav", force, &game->config.soundConfigComputer);
2351  LoadCockpitSound(SOUND_GPWSONEHUNDRED, "Sounds\\VMU\\E-10\\GPWS\\100.wav", force, &game->config.soundConfigComputer);
2352  LoadCockpitSound(SOUND_GPWSTWOHUNDRED, "Sounds\\VMU\\E-10\\GPWS\\200.wav", force, &game->config.soundConfigComputer);
2354  LoadCockpitSound(SOUND_GPWSFIVEHUNDRED, "Sounds\\VMU\\E-10\\GPWS\\500.wav", force, &game->config.soundConfigComputer);
2355  LoadCockpitSound(SOUND_GPWSONETHOUSAND, "Sounds\\VMU\\E-10\\GPWS\\1000.wav", force, &game->config.soundConfigComputer);
2358  LoadCockpitSound(SOUND_GPWSWINDSHEARWARNING, "Sounds\\VMU\\E-10\\GPWS\\WindshearWarning.wav", force, &game->config.soundConfigComputer);
2359  LoadCockpitSound(SOUND_GPWSWINDSHEARCAUTION, "Sounds\\VMU\\E-10\\GPWS\\WindshearCaution.wav", force, &game->config.soundConfigComputer);
2361 
2362  LoadCockpitSound(SOUND_TCASCLEAR, "Sounds\\VMU\\E-10\\TCAS\\clearofconflict.wav", force, &game->config.soundConfigComputer);
2363  LoadCockpitSound(SOUND_TCASTRAFFIC, "Sounds\\VMU\\E-10\\TCAS\\traffic.wav", force, &game->config.soundConfigComputer);
2364  LoadCockpitSound(SOUND_TCASCLIMB, "Sounds\\VMU\\E-10\\TCAS\\climb.wav", force, &game->config.soundConfigComputer);
2365  LoadCockpitSound(SOUND_TCASDESCEND, "Sounds\\VMU\\E-10\\TCAS\\descend.wav", force, &game->config.soundConfigComputer);
2366  LoadCockpitSound(SOUND_TCASMONITOR, "Sounds\\VMU\\E-10\\TCAS\\monitorverticalspeed.wav", force, &game->config.soundConfigComputer);
2367 
2368  LoadCockpitSound(SOUND_MONROECARGOBAY, "Sounds\\VMU\\E-10\\monroe-tiaditcb.wav", force, &game->config.soundConfigComputer);
2369  LoadCockpitSound(SOUND_MONROEALLMOORINGSCLEARED, "Sounds\\VMU\\E-10\\monroe-amc.wav", force, &game->config.soundConfigComputer);
2370  LoadCockpitSound(SOUND_MONROEGEARDOWN, "Sounds\\VMU\\E-10\\monroe-strutse.wav", force, &game->config.soundConfigComputer);
2371  LoadCockpitSound(SOUND_MONROEGEARUP, "Sounds\\VMU\\E-10\\monroe-strutsr.wav", force, &game->config.soundConfigComputer);
2372  LoadCockpitSound(SOUND_MONROEHULLIONIZATION, "Sounds\\VMU\\E-10\\monroe-hid.wav", force, &game->config.soundConfigComputer);
2373  LoadCockpitSound(SOUND_MONROESOUNDBARRIER, "Sounds\\VMU\\E-10\\monroe-psb.wav", force, &game->config.soundConfigComputer);
2384  LoadCockpitSound(SOUND_CABINPRESSURE, "Sounds\\VMU\\E-10\\CabinPressure.wav", force, &game->config.soundConfigComputer);
2385 
2386  ourcockpit.attenuate = 0.7f;
2387  break;
2388 
2389  case W6Manx:
2390  LoadCockpitSound(SOUND_COCKPITAMBIENT, "Sounds\\Cockpits\\ambient w-6.wav", force);
2391  LoadCockpitSound(SOUND_COCKPITENGINELEFT, "Sounds\\Cockpits\\engine w-6.wav", force);
2392  LoadCockpitSound(SOUND_COCKPITENGINERIGHT, "Sounds\\Cockpits\\engine w-6.wav", force);
2394  LoadCockpitSound(SOUND_COCKPITSTART, "Sounds\\Cockpits\\startup w-6.wav", force);
2395  LoadCockpitSound(SOUND_COCKPITLAND, "Sounds\\Cockpits\\bmtouch2.wav", force);
2396  LoadCockpitSound(SOUND_COCKPITLEVEL, "Sounds\\Cockpits\\bmtouch4.wav", force);
2397 
2399  LoadCockpitSound(SOUND_COCKPITLIGHTOFF, "Sounds\\VMU\\monroe-ll0.mp3", force, &game->config.soundConfigComputer);
2400  LoadCockpitSound(SOUND_COCKPITLIGHTON, "Sounds\\VMU\\monroe-ll1.mp3", force, &game->config.soundConfigComputer);
2401  LoadCockpitSound(SOUND_STALL, "Sounds\\VMU\\stall.mp3", force, &game->config.soundConfigComputer);
2402  LoadCockpitSound(SOUND_OVERSPEED, "Sounds\\VMU\\overspeed.mp3", force, &game->config.soundConfigComputer);
2403 
2404  LoadCockpitSound(SOUND_GPWSSINKRATE, "Sounds\\VMU\\GPWS\\monroe-sr.mp3", force, &game->config.soundConfigComputer);
2405  LoadCockpitSound(SOUND_GPWSPULLUP, "Sounds\\VMU\\GPWS\\monroe-pu.mp3", force, &game->config.soundConfigComputer);
2406  LoadCockpitSound(SOUND_GPWSTERRAINTERRAIN, "Sounds\\VMU\\GPWS\\TerrainTerrain.mp3", force, &game->config.soundConfigComputer);
2407  LoadCockpitSound(SOUND_GPWSTOOLOWTERRAIN, "Sounds\\VMU\\GPWS\\TooLowTerrain.mp3", force, &game->config.soundConfigComputer);
2408  LoadCockpitSound(SOUND_GPWSTOOLOWGEAR, "Sounds\\VMU\\GPWS\\TooLowGear.mp3", force, &game->config.soundConfigComputer);
2409  LoadCockpitSound(SOUND_GPWSTOOLOWFLAPS, "Sounds\\VMU\\GPWS\\TooLowFlaps.mp3", force, &game->config.soundConfigComputer);
2410  LoadCockpitSound(SOUND_GPWSBANKANGLE, "Sounds\\VMU\\GPWS\\BankAngle.wav", force, &game->config.soundConfigComputer);
2411  LoadCockpitSound(SOUND_GPWSGLIDESLOPE, "Sounds\\VMU\\GPWS\\Glideslope.wav", force, &game->config.soundConfigComputer);
2412  LoadCockpitSound(SOUND_GPWSRETARD, "Sounds\\VMU\\GPWS\\Retard.wav", force, &game->config.soundConfigComputer);
2413  LoadCockpitSound(SOUND_GPWSTEN, "Sounds\\VMU\\GPWS\\10.wav", force, &game->config.soundConfigComputer);
2414  LoadCockpitSound(SOUND_GPWSTWENTY, "Sounds\\VMU\\GPWS\\20.wav", force, &game->config.soundConfigComputer);
2415  LoadCockpitSound(SOUND_GPWSTHIRTY, "Sounds\\VMU\\GPWS\\30.wav", force, &game->config.soundConfigComputer);
2416  LoadCockpitSound(SOUND_GPWSFORTY, "Sounds\\VMU\\GPWS\\40.wav", force, &game->config.soundConfigComputer);
2417  LoadCockpitSound(SOUND_GPWSFIFTY, "Sounds\\VMU\\GPWS\\50.wav", force, &game->config.soundConfigComputer);
2418  LoadCockpitSound(SOUND_GPWSONEHUNDRED, "Sounds\\VMU\\GPWS\\100.wav", force, &game->config.soundConfigComputer);
2419  LoadCockpitSound(SOUND_GPWSTWOHUNDRED, "Sounds\\VMU\\GPWS\\200.wav", force, &game->config.soundConfigComputer);
2420  LoadCockpitSound(SOUND_GPWSMINIMUMS, "Sounds\\VMU\\GPWS\\Minimums.wav", force, &game->config.soundConfigComputer);
2421  LoadCockpitSound(SOUND_GPWSFIVEHUNDRED, "Sounds\\VMU\\GPWS\\500.wav", force, &game->config.soundConfigComputer);
2422  LoadCockpitSound(SOUND_GPWSONETHOUSAND, "Sounds\\VMU\\GPWS\\1000.wav", force, &game->config.soundConfigComputer);
2423  LoadCockpitSound(SOUND_GPWSDONTSINK, "Sounds\\VMU\\GPWS\\DontSink.mp3", force, &game->config.soundConfigComputer);
2424  LoadCockpitSound(SOUND_GPWSPOSITIVERATE, "Sounds\\VMU\\GPWS\\PositiveRate.mp3", force, &game->config.soundConfigComputer);
2425  LoadCockpitSound(SOUND_GPWSWINDSHEARWARNING, "Sounds\\VMU\\GPWS\\WindshearWarning.wav", force, &game->config.soundConfigComputer);
2426  LoadCockpitSound(SOUND_GPWSWINDSHEARCAUTION, "Sounds\\VMU\\GPWS\\WindshearCaution.mp3", force, &game->config.soundConfigComputer);
2427  LoadCockpitSound(SOUND_GPWSROTATE, "Sounds\\VMU\\GPWS\\Rotate.mp3", force, &game->config.soundConfigComputer);
2428 
2429  LoadCockpitSound(SOUND_TCASCLEAR, "Sounds\\VMU\\TCAS\\clearofconflict.mp3", force, &game->config.soundConfigComputer);
2430  LoadCockpitSound(SOUND_TCASTRAFFIC, "Sounds\\VMU\\TCAS\\traffic.mp3", force, &game->config.soundConfigComputer);
2431  LoadCockpitSound(SOUND_TCASCLIMB, "Sounds\\VMU\\TCAS\\climb.mp3", force, &game->config.soundConfigComputer);
2432  LoadCockpitSound(SOUND_TCASDESCEND, "Sounds\\VMU\\TCAS\\descend.mp3", force, &game->config.soundConfigComputer);
2433  LoadCockpitSound(SOUND_TCASMONITOR, "Sounds\\VMU\\TCAS\\monitorverticalspeed.mp3", force, &game->config.soundConfigComputer);
2434 
2435  LoadCockpitSound(SOUND_MONROECARGOBAY, "Sounds\\VMU\\monroe-tiaditcb.mp3", force, &game->config.soundConfigComputer);
2436  LoadCockpitSound(SOUND_MONROEALLMOORINGSCLEARED, "Sounds\\VMU\\monroe-amc.mp3", force, &game->config.soundConfigComputer);
2437  LoadCockpitSound(SOUND_MONROEGEARDOWN, "Sounds\\VMU\\monroe-geardown.mp3", force, &game->config.soundConfigComputer);
2438  LoadCockpitSound(SOUND_MONROEGEARUP, "Sounds\\VMU\\monroe-gearup.mp3", force, &game->config.soundConfigComputer);
2439  LoadCockpitSound(SOUND_MONROEHULLIONIZATION, "Sounds\\VMU\\monroe-hid.mp3", force, &game->config.soundConfigComputer);
2440  LoadCockpitSound(SOUND_MONROESOUNDBARRIER, "Sounds\\VMU\\monroe-psb.mp3", force, &game->config.soundConfigComputer);
2441  LoadCockpitSound(SOUND_CONFIGBRAKE, "Sounds\\VMU\\config-brake.mp3", force, &game->config.soundConfigComputer);
2442  LoadCockpitSound(SOUND_CONFIGAF, "Sounds\\VMU\\config-af.mp3", force, &game->config.soundConfigComputer);
2443  LoadCockpitSound(SOUND_CONFIGFLAPS, "Sounds\\VMU\\config-flaps.mp3", force, &game->config.soundConfigComputer);
2444  LoadCockpitSound(SOUND_CONFIGTRIM, "Sounds\\VMU\\config-trim.mp3", force, &game->config.soundConfigComputer);
2445  LoadCockpitSound(SOUND_AURALUNITOKAY, "Sounds\\VMU\\AuralUnitOkay.mp3", force, &game->config.soundConfigComputer);
2446  LoadCockpitSound(SOUND_AURALUNITTESTA, "Sounds\\VMU\\AuralWarningTestA.mp3", force, &game->config.soundConfigComputer);
2447  LoadCockpitSound(SOUND_AURALUNITTESTB, "Sounds\\VMU\\AuralWarningTestB.mp3", force, &game->config.soundConfigComputer);
2448  LoadCockpitSound(SOUND_SCANNERSYNC, "Sounds\\VMU\\ScannerSync.mp3", force, &game->config.soundConfigComputer);
2449  LoadCockpitSound(SOUND_FORWARDTHRUST, "Sounds\\VMU\\ForwardThrust.mp3", force, &game->config.soundConfigComputer);
2450  LoadCockpitSound(SOUND_REVERSETHRUST, "Sounds\\VMU\\ReverseThrust.mp3", force, &game->config.soundConfigComputer);
2451  LoadCockpitSound(SOUND_CABINPRESSURE, "Sounds\\VMU\\CabinPressure.mp3", force, &game->config.soundConfigComputer);
2452 
2453  ourcockpit.attenuate = 0.6f;
2454  break;
2455 
2456  case Apartment:
2457  LoadCockpitSound(SOUND_COCKPITAMBIENT, "Sounds\\Cockpits\\Apartment.wav", force);
2458  LoadCockpitSound(SOUND_COCKPITENGINELEFT, nullptr, force);
2459  LoadCockpitSound(SOUND_COCKPITENGINERIGHT, nullptr, force);
2461  LoadCockpitSound(SOUND_COCKPITSTART, nullptr, force);
2462  LoadCockpitSound(SOUND_COCKPITLAND, "Sounds\\People\\step2.wav", force);
2463  LoadCockpitSound(SOUND_COCKPITLEVEL, nullptr, force);
2464 
2470 
2495 
2501 
2519 
2520  ourcockpit.attenuate = 0.6f;
2521  break;
2522 
2523  case ControlTower:
2524  LoadCockpitSound(SOUND_COCKPITAMBIENT, "Sounds\\Cockpits\\ControlTower.wav", force);
2525  LoadCockpitSound(SOUND_COCKPITENGINELEFT, nullptr, force);
2526  LoadCockpitSound(SOUND_COCKPITENGINERIGHT, nullptr, force);
2528  LoadCockpitSound(SOUND_COCKPITSTART, nullptr, force);
2529  LoadCockpitSound(SOUND_COCKPITLAND, "Sounds\\People\\step3.wav", force);
2530  LoadCockpitSound(SOUND_COCKPITLEVEL, nullptr, force);
2531 
2537 
2562 
2568 
2586 
2587  ourcockpit.attenuate = 0.5f;
2588  break;
2589 
2590  case SimBay:
2591  LoadCockpitSound(SOUND_COCKPITAMBIENT, "Sounds\\Cockpits\\Simbay.wav", force);
2592  LoadCockpitSound(SOUND_COCKPITENGINELEFT, nullptr, force);
2593  LoadCockpitSound(SOUND_COCKPITENGINERIGHT, nullptr, force);
2595  LoadCockpitSound(SOUND_COCKPITSTART, nullptr, force);
2596  LoadCockpitSound(SOUND_COCKPITLAND, "Sounds\\People\\step1.wav", force);
2597  LoadCockpitSound(SOUND_COCKPITLEVEL, nullptr, force);
2598 
2604 
2629 
2635 
2653 
2654  ourcockpit.attenuate = 0.4f;
2655  break;
2656 
2657  case T19:
2658  LoadCockpitSound(SOUND_COCKPITAMBIENT, "Sounds\\Cockpits\\cockpit t-1.wav", force);
2659  LoadCockpitSound(SOUND_COCKPITENGINELEFT, "Sounds\\Cockpits\\engine t-1.wav", force);
2660  LoadCockpitSound(SOUND_COCKPITENGINERIGHT, "Sounds\\Cockpits\\engine t-1.wav", force);
2662  LoadCockpitSound(SOUND_COCKPITSTART, "Sounds\\Cockpits\\startup t-1.wav", force);
2663  LoadCockpitSound(SOUND_COCKPITLAND, "Sounds\\Cockpits\\cmtouch1.wav", force);
2664  LoadCockpitSound(SOUND_COCKPITLEVEL, "Sounds\\Cockpits\\cmtouch2.wav", force);
2665 
2667  LoadCockpitSound(SOUND_COCKPITLIGHTOFF, "Sounds\\VMU\\monroe-ll0.mp3", force, &game->config.soundConfigComputer);
2668  LoadCockpitSound(SOUND_COCKPITLIGHTON, "Sounds\\VMU\\monroe-ll1.mp3", force, &game->config.soundConfigComputer);
2669  LoadCockpitSound(SOUND_STALL, "Sounds\\VMU\\stall.mp3", force, &game->config.soundConfigComputer);
2671 
2672  LoadCockpitSound(SOUND_GPWSSINKRATE, "Sounds\\VMU\\GPWS\\monroe-sr.mp3", force, &game->config.soundConfigComputer);
2673  LoadCockpitSound(SOUND_GPWSPULLUP, "Sounds\\VMU\\GPWS\\monroe-pu.mp3", force, &game->config.soundConfigComputer);
2674  LoadCockpitSound(SOUND_GPWSTERRAINTERRAIN, "Sounds\\VMU\\GPWS\\TerrainTerrain.mp3", force, &game->config.soundConfigComputer);
2675  LoadCockpitSound(SOUND_GPWSTOOLOWTERRAIN, "Sounds\\VMU\\GPWS\\TooLowTerrain.mp3", force, &game->config.soundConfigComputer);
2676  LoadCockpitSound(SOUND_GPWSTOOLOWGEAR, "Sounds\\VMU\\GPWS\\TooLowGear.mp3", force, &game->config.soundConfigComputer);
2677  LoadCockpitSound(SOUND_GPWSTOOLOWFLAPS, "Sounds\\VMU\\GPWS\\TooLowFlaps.mp3", force, &game->config.soundConfigComputer);
2678  LoadCockpitSound(SOUND_GPWSBANKANGLE, "Sounds\\VMU\\GPWS\\BankAngle.wav", force, &game->config.soundConfigComputer);
2679  LoadCockpitSound(SOUND_GPWSGLIDESLOPE, "Sounds\\VMU\\GPWS\\Glideslope.wav", force, &game->config.soundConfigComputer);
2680  LoadCockpitSound(SOUND_GPWSRETARD, "Sounds\\VMU\\GPWS\\Retard.wav", force, &game->config.soundConfigComputer);
2681  LoadCockpitSound(SOUND_GPWSTEN, "Sounds\\VMU\\GPWS\\10.wav", force, &game->config.soundConfigComputer);
2682  LoadCockpitSound(SOUND_GPWSTWENTY, "Sounds\\VMU\\GPWS\\20.wav", force, &game->config.soundConfigComputer);
2683  LoadCockpitSound(SOUND_GPWSTHIRTY, "Sounds\\VMU\\GPWS\\30.wav", force, &game->config.soundConfigComputer);
2684  LoadCockpitSound(SOUND_GPWSFORTY, "Sounds\\VMU\\GPWS\\40.wav", force, &game->config.soundConfigComputer);
2685  LoadCockpitSound(SOUND_GPWSFIFTY, "Sounds\\VMU\\GPWS\\50.wav", force, &game->config.soundConfigComputer);
2686  LoadCockpitSound(SOUND_GPWSONEHUNDRED, "Sounds\\VMU\\GPWS\\100.wav", force, &game->config.soundConfigComputer);
2687  LoadCockpitSound(SOUND_GPWSTWOHUNDRED, "Sounds\\VMU\\GPWS\\200.wav", force, &game->config.soundConfigComputer);
2688  LoadCockpitSound(SOUND_GPWSMINIMUMS, "Sounds\\VMU\\GPWS\\Minimums.wav", force, &game->config.soundConfigComputer);
2689  LoadCockpitSound(SOUND_GPWSFIVEHUNDRED, "Sounds\\VMU\\GPWS\\500.wav", force, &game->config.soundConfigComputer);
2690  LoadCockpitSound(SOUND_GPWSONETHOUSAND, "Sounds\\VMU\\GPWS\\1000.wav", force, &game->config.soundConfigComputer);
2691  LoadCockpitSound(SOUND_GPWSDONTSINK, "Sounds\\VMU\\GPWS\\DontSink.mp3", force, &game->config.soundConfigComputer);
2692  LoadCockpitSound(SOUND_GPWSPOSITIVERATE, "Sounds\\VMU\\GPWS\\PositiveRate.mp3", force, &game->config.soundConfigComputer);
2693  LoadCockpitSound(SOUND_GPWSWINDSHEARWARNING, "Sounds\\VMU\\GPWS\\WindshearWarning.wav", force, &game->config.soundConfigComputer);
2694  LoadCockpitSound(SOUND_GPWSWINDSHEARCAUTION, "Sounds\\VMU\\GPWS\\WindshearCaution.mp3", force, &game->config.soundConfigComputer);
2695  LoadCockpitSound(SOUND_GPWSROTATE, "Sounds\\VMU\\GPWS\\Rotate.mp3", force, &game->config.soundConfigComputer);
2696 
2697  LoadCockpitSound(SOUND_TCASCLEAR, "Sounds\\VMU\\TCAS\\clearofconflict.mp3", force, &game->config.soundConfigComputer);
2698  LoadCockpitSound(SOUND_TCASTRAFFIC, "Sounds\\VMU\\TCAS\\traffic.mp3", force, &game->config.soundConfigComputer);
2699  LoadCockpitSound(SOUND_TCASCLIMB, "Sounds\\VMU\\TCAS\\climb.mp3", force, &game->config.soundConfigComputer);
2700  LoadCockpitSound(SOUND_TCASDESCEND, "Sounds\\VMU\\TCAS\\descend.mp3", force, &game->config.soundConfigComputer);
2701  LoadCockpitSound(SOUND_TCASMONITOR, "Sounds\\VMU\\TCAS\\monitorverticalspeed.mp3", force, &game->config.soundConfigComputer);
2702 
2703  LoadCockpitSound(SOUND_MONROECARGOBAY, "Sounds\\VMU\\monroe-tiaditcb.mp3", force, &game->config.soundConfigComputer);
2704  LoadCockpitSound(SOUND_MONROEALLMOORINGSCLEARED, "Sounds\\VMU\\monroe-amc.mp3", force, &game->config.soundConfigComputer);
2705  LoadCockpitSound(SOUND_MONROEGEARDOWN, "Sounds\\VMU\\monroe-geardown.mp3", force, &game->config.soundConfigComputer);
2706  LoadCockpitSound(SOUND_MONROEGEARUP, "Sounds\\VMU\\monroe-gearup.mp3", force, &game->config.soundConfigComputer);
2707  LoadCockpitSound(SOUND_MONROEHULLIONIZATION, "Sounds\\VMU\\monroe-hid.mp3", force, &game->config.soundConfigComputer);
2708  LoadCockpitSound(SOUND_MONROESOUNDBARRIER, "Sounds\\VMU\\monroe-psb.mp3", force, &game->config.soundConfigComputer);
2709  LoadCockpitSound(SOUND_CONFIGBRAKE, "Sounds\\VMU\\config-brake.mp3", force, &game->config.soundConfigComputer);
2710  LoadCockpitSound(SOUND_CONFIGAF, "Sounds\\VMU\\config-af.mp3", force, &game->config.soundConfigComputer);
2711  LoadCockpitSound(SOUND_CONFIGFLAPS, "Sounds\\VMU\\config-flaps.mp3", force, &game->config.soundConfigComputer);
2712  LoadCockpitSound(SOUND_CONFIGTRIM, "Sounds\\VMU\\config-trim.mp3", force, &game->config.soundConfigComputer);
2713  LoadCockpitSound(SOUND_AURALUNITOKAY, "Sounds\\VMU\\AuralUnitOkay.mp3", force, &game->config.soundConfigComputer);
2714  LoadCockpitSound(SOUND_AURALUNITTESTA, "Sounds\\VMU\\AuralWarningTestA.mp3", force, &game->config.soundConfigComputer);
2715  LoadCockpitSound(SOUND_AURALUNITTESTB, "Sounds\\VMU\\AuralWarningTestB.mp3", force, &game->config.soundConfigComputer);
2716  LoadCockpitSound(SOUND_SCANNERSYNC, "Sounds\\VMU\\ScannerSync.mp3", force, &game->config.soundConfigComputer);
2717  LoadCockpitSound(SOUND_FORWARDTHRUST, "Sounds\\VMU\\ForwardThrust.mp3", force, &game->config.soundConfigComputer);
2718  LoadCockpitSound(SOUND_REVERSETHRUST, "Sounds\\VMU\\ReverseThrust.mp3", force, &game->config.soundConfigComputer);
2719  LoadCockpitSound(SOUND_CABINPRESSURE, "Sounds\\VMU\\CabinPressure.mp3", force, &game->config.soundConfigComputer);
2720 
2721  ourcockpit.attenuate = 0.6f;
2722  break;
2723 
2724  case T27:
2725  LoadCockpitSound(SOUND_COCKPITAMBIENT, "Sounds\\Cockpits\\MammothAmbient.wav", force);
2726  LoadCockpitSound(SOUND_COCKPITENGINELEFT, "Sounds\\Cockpits\\MammothRun.wav", force);
2727  LoadCockpitSound(SOUND_COCKPITENGINERIGHT, "Sounds\\Cockpits\\MammothRun.wav", force);
2729  LoadCockpitSound(SOUND_COCKPITSTART, "Sounds\\Cockpits\\MammothStart.wav", force);
2730  LoadCockpitSound(SOUND_COCKPITLAND, "Sounds\\Cockpits\\cmtouch1.wav", force);
2731  LoadCockpitSound(SOUND_COCKPITLEVEL, "Sounds\\Cockpits\\cmtouch2.wav", force);
2732 
2733  LoadCockpitSound(SOUND_COCKPITLOWFUEL, "Sounds\\Cockpits\\MammothChime.wav", force, &game->config.soundConfigComputer);
2734  LoadCockpitSound(SOUND_COCKPITLIGHTOFF, "Sounds\\Cockpits\\MammothChime.wav", force, &game->config.soundConfigComputer);
2735  LoadCockpitSound(SOUND_COCKPITLIGHTON, "Sounds\\Cockpits\\MammothChime.wav", force, &game->config.soundConfigComputer);
2738 
2763 
2769 
2787 
2788  ourcockpit.attenuate = 0.9f;
2789  break;
2790 
2791  default:
2792  // here we would decipher the interiors
2793  LoadCockpitSound(SOUND_COCKPITAMBIENT, nullptr, force);
2794  LoadCockpitSound(SOUND_COCKPITENGINELEFT, nullptr, force);
2795  LoadCockpitSound(SOUND_COCKPITENGINERIGHT, nullptr, force);
2797  LoadCockpitSound(SOUND_COCKPITSTART, nullptr, force);
2798  LoadCockpitSound(SOUND_COCKPITLAND, nullptr, force);
2799  LoadCockpitSound(SOUND_COCKPITLEVEL, nullptr, force);
2800 
2806 
2831 
2837 
2855 
2856  char msg[99];
2857  sprintf_s(msg, sizeof msg, "Unsupported interior frame: %i", ourcockpit.texturelib);
2858  Trace(msg, Logger::Level::Error);
2859  ourcockpit.attenuate = 0.6f;
2860  break;
2861  }
2862 
2863  if (ourcockpit.power > 0.5f) // already on
2865 }
2866 
2867 //float Sound::GetProgress(HSTREAM stream)
2868 //{
2869 // float progress = 0.0f;
2870 // // file length
2871 // const QWORD len = BASS_StreamGetFilePosition(stream, BASS_FILEPOS_END);
2872 // // download progress
2873 // const QWORD down = BASS_StreamGetFilePosition(stream, BASS_FILEPOS_DOWNLOAD);
2874 // // get channel info
2875 // BASS_CHANNELINFO info;
2876 // if (!BASS_ChannelGetInfo(stream, &info))
2877 // return progress;
2878 // // streaming in blocks?
2879 // if ((info.flags & BASS_STREAM_BLOCK) != 0)
2880 // {
2881 // // decode position
2882 // const QWORD dec = BASS_StreamGetFilePosition(stream, BASS_FILEPOS_CURRENT);
2883 // // percentage of buffer used
2884 // progress = static_cast<float>(down - dec) / static_cast<float>(len);
2885 // if (progress > 1.0f)
2886 // progress = 1.0f; // restrict to 100% (can be higher)
2887 // }
2888 // else
2889 // {
2890 // // percentage of file downloaded
2891 // progress = static_cast<float>(down) / static_cast<float>(len);
2892 // }
2893 // return progress;
2894 //}
float Mach
Definition: Bus.h:356
float oldPan
Definition: Sound.h:314
float gaTimer
Definition: Sound.h:305
float oldFrequencyMod2
Definition: Sound.h:315
Scockpit ourcockpit
Definition: globals.cpp:176
float oldvolume
Definition: Sound.h:314
float staticDensity
Definition: propulsion.h:84
HCHANNEL sound_channel[SOUND_ENUMERATION]
Definition: Sound.h:286
char bassDevice
Definition: SoundConfig.h:19
float LatitudeRad
Definition: Bus.h:235
float power
Definition: globals.h:608
int excludeFromGlobalAttenuate
Definition: Sound.h:303
char oldtitle[99]
Definition: Sound.h:299
Definition: Sound.h:276
float delay
Definition: Sound.h:14
void LoadCockpitSound(int soundEnum, const char *path, bool force, SoundConfig *device=nullptr)
Definition: Sound.cpp:983
Config config
Definition: GameClass.h:102
std::vector< Command > commandStream
Definition: Bus.h:342
float GetLength(int soundEnum)
Definition: Sound.cpp:572
D3DXVECTOR3 position
Definition: globals.h:549
GameState displaystage
Definition: GameClass.h:121
bool radioPower
Definition: globals.h:606
float dynamicDensity
Definition: propulsion.h:85
float headpan
Definition: Sound.h:316
void SendToServer(void *pData, DWORD dwSize, bool bGuaranteed, PacketOrdering order=ORDERING_NONE) const
Definition: Networking.cpp:59
float gaTimeToHold
Definition: Sound.h:307
void EnumDevices()
Definition: Sound.cpp:218
GameClass * game
Definition: Sound.h:278
char currentRadioDevice
Definition: Sound.h:295
std::vector< GUID > deviceGuids
Definition: Sound.h:337
HSTREAM g_pSoundIntro
Definition: Sound.h:329
unsigned short vehicleId
Definition: globals.h:570
s_network_objects playerships[MAX_SCAN]
Definition: globals.cpp:174
short station
Definition: Sound.h:335
float volume
Definition: Sound.h:13
float gaTimeToFadeIn
Definition: Sound.h:308
short texturelib
Definition: globals.h:612
float mach
Definition: propulsion.h:78
std::vector< Sdelayedeffects > delayedeffects
Definition: Sound.h:318
float leftright
Definition: Viewscreen.h:311
SoundConfig soundConfigLegacy
Definition: config.h:45
SoundConfig * sound_config[SOUND_ENUMERATION]
Definition: Sound.h:290
float oldPan2
Definition: Sound.h:315
float attenuate
Definition: globals.h:611
bool g_bRadioPlaying
Definition: Sound.h:297
float closurerate
Definition: globals.h:590
void ToggleFullScreen(bool goFullScreen)
Definition: GameClass.cpp:269
void FrameMoveDopplerEffects(float elapsedTime)
Definition: Sound.cpp:1531
void InitDevice(SoundConfig *deviceConfig)
Definition: Sound.cpp:274
weather * ptrWeather
Definition: Viewscreen.h:287
float DebugSoundReal
Definition: Bus.h:420
float exTimeToFadeOut
Definition: Sound.h:312
Logger * logger
Definition: GameClass.h:113
Sound(GameClass *gameptr)
Definition: Sound.cpp:204
char currentSoundDevice
Definition: Sound.h:294
static char * sound_path[SOUND_ENUMERATION]
Definition: Sound.h:291
void Close()
Definition: Sound.cpp:375
std::string name
Definition: Command.h:11
void ChangeCockpit(bool force)
Definition: Sound.cpp:1977
const GUID MYGUID_DEFAULT
Definition: Guids.h:5
const float maxrate
Definition: Sound.h:280
void PlayAudioData(unsigned char *data, size_t length)
Definition: Sound.cpp:402
std::vector< std::string > deviceNames
Definition: Sound.h:336
propulsion * ptrPropulsion
Definition: Viewscreen.h:285
float oldvolume2
Definition: Sound.h:315
void LegacySoundRequestUniverse(SServerPacket datapacket)
Definition: Sound.cpp:1133
float flapExtent
Definition: globals.h:655
bool loopintro
Definition: Sound.h:332
float volume
Definition: SoundConfig.h:13
unsigned char array
Definition: Sound.h:19
Viewscreen * viewscreen
Definition: GameClass.h:111
Networking * networking
Definition: GameClass.h:107
HSTREAM radio
Definition: Sound.h:282
float f_MSL
Definition: globals.cpp:36
float exTimeToFadeIn
Definition: Sound.h:310
void PrecipWindSoundBarrier(D3DXVECTOR3 relativewind, float elapsedTime)
Definition: Sound.cpp:1764
bool outside
Definition: Viewscreen.h:272
void AddLoopingVehicleSound(int soundEnum, unsigned char array)
Definition: Sound.cpp:1954
float Clamp(float val, float min, float max)
Definition: MathUtilities.h:3
void LoadSound(int soundEnum, SoundConfig *device=nullptr)
Definition: Sound.cpp:911
void Reset()
Definition: Sound.cpp:583
SoundConfig soundConfigComms
Definition: config.h:44
float DebugSoundBear
Definition: Bus.h:420
float DebugSoundFake
Definition: Bus.h:420
bool g_bSoundIntroMusic
Definition: config.h:19
static void CALLBACK AdvanceStage(HSYNC handle, DWORD channel, DWORD data, void *user)
Definition: Sound.cpp:797
float sound_rate[SOUND_ENUMERATION]
Definition: Sound.h:288
void ChangeVolume()
Definition: Sound.cpp:564
void AddDelayedSound(int soundEnum, float delay, float volume=1.0f)
Definition: Sound.cpp:1927
Definition: Command.h:5
char radioplaying[99]
Definition: globals.h:625
char hullname[23]
Definition: globals.h:535
D3DXVECTOR3 velocity
Definition: globals.cpp:9
D3DXVECTOR3 velocity
Definition: globals.h:540
Sound * sound
Definition: GameClass.h:108
HSYNC hsync
Definition: Sound.h:330
std::vector< Sloopingeffects > loopingeffects
Definition: Sound.h:319
void FrameMove(float elapsedTime)
Definition: Sound.cpp:1053
float GetAttenuation(bool applyDensity) const
Definition: Sound.cpp:1062
char metadata[999]
Definition: Sound.h:300
void Log(const char *msg, Level level=Info, int errorCode=0)
Definition: Logger.cpp:11
void GlobalAttenuate(float prmGaTimeToFadeOut, float prmGaTimeToHold, float prmGaTimeToFadeIn, int soundEnum, float prmExTimeToFadeIn, float prmExTimeToHold, float prmExTimeToFadeOut, float volumeAdj=1.0f)
Definition: Sound.cpp:489
const GUID MYGUID_NULL
Definition: Guids.h:3
int vehicleId
Definition: Sound.h:20
HSTREAM comms
Definition: Sound.h:283
float gearextent
Definition: globals.h:621
bool myfunction(Sloopingeffects i, Sloopingeffects j)
Definition: Sound.cpp:1952
void Trace(const char *msg, Logger::Level severity=Logger::Level::Info) const
Definition: Sound.cpp:395
int soundEnum
Definition: Sound.h:21
float gaVolumeAdj
Definition: Sound.h:309
float Play(int soundEnum)
Definition: Sound.cpp:577
unsigned char type
Definition: globals.h:532
float oldFrequencyMod
Definition: Sound.h:314
HSAMPLE sound_sample[SOUND_ENUMERATION]
Definition: Sound.h:285
D3DXMATRIX matrixView
Definition: Viewscreen.h:220
float DebugSoundClose
Definition: Bus.h:420
float gaTimeToFadeOut
Definition: Sound.h:306
SoundConfig soundConfigRadio
Definition: config.h:46
bool issuedWarning
Definition: Sound.h:326
char stationIdentification
Definition: Sound.h:301
float sound_volume[SOUND_ENUMERATION]
Definition: Sound.h:292
int soundEnum
Definition: Sound.h:12
float globalAttenuate
Definition: Sound.h:304
float sound_length[SOUND_ENUMERATION]
Definition: Sound.h:287
const float minrate
Definition: Sound.h:280
void FrameMoveDelayedEffects(float elapsedTime)
Definition: Sound.cpp:1372
void Stop(int soundEnum)
Definition: Sound.cpp:1946
D3DXVECTOR3 barycentric
Definition: globals.h:540
Level
Definition: Logger.h:19
GameState musicstage
Definition: Sound.h:333
float speedOfSoundKms
Definition: propulsion.h:74
void PlayEx(int soundEnum, bool loop, float volume=1.0f, float frequencyMod=1.0f, float pan=0.0f, bool restart=true)
Definition: Sound.cpp:606
void RemoveLoopingVehicleSound(int soundEnum, unsigned char array)
Definition: Sound.cpp:1964
float GetTurbidity() const
Definition: weather.cpp:913
void AddToCallStack(const char *msg)
Definition: Logger.cpp:86
Bus * bus
Definition: GameClass.h:112
SoundConfig soundConfigComputer
Definition: config.h:43
float exTimeToHold
Definition: Sound.h:311
short oldstation
Definition: Sound.h:298
char sound_device[SOUND_ENUMERATION]
Definition: Sound.h:289
void LoadSounds(short instage)
Definition: Sound.cpp:1073
void Init()
Definition: Sound.cpp:248
void FrameMoveAAC()
Definition: Sound.cpp:1285
static void TouchFile(const WCHAR *str)
Definition: GameClass.cpp:143
GameState
Definition: GameState.h:3
static void CALLBACK MetaData(HSYNC handle, DWORD channel, DWORD data, void *user)
Definition: Sound.cpp:756