scpcb icon indicating copy to clipboard operation
scpcb copied to clipboard

Stream channels fix #2

Open Jabka666 opened this issue 2 years ago • 0 comments

  • Removed unnecessary ChannelPlaying checks from RemoveNPC, KillSounds, ResumeSounds and PauseSounds function. We don't need to check if the sound is playing, enough to know does it exist or not;
  • Added CoughCHN, VomitCHN and RadioCHN to PauseSounds, ResumeSounds and KillSounds function;
  • Added channel existing check for UpdateSoundOrigin(2) and UpdateStreamSoundOrigin function, so we don't need to check manually if the sound is existing. First, we don't need to try apply channel functions to null channel and produce unnecessary calculations. Second, added sound playing check because we need to use these functions only when the sound is playing.
  • Completely remove sound from memory. As you know, FreeSound, StopChannel and etc. don't finally frees the memory, so I added CHN = 0 lines.
  • Fixed spammable Failed to find stream Sound: Unknown Stream console error appearing in:
  1. SCP-079's chamber after finishing Speech.ogg sound;
  2. Gate B area after playing AlphaWarheadsFail.ogg sound;
  3. I'm not sure, but sometimes I saw this error for SCP-096. I noticed n\SoundChn2_IsStream = 2 line that should have True value instead of 2. Maybe it shouldn't, who knows ¯_(ツ)_/¯ ; Always reset _isStream parameter while removing a channel for preventing any confuses in UpdateStreamSounds function. Also added more sound exist checks for preventing Unknow stream error;
  • Added ChannelVolume (Chn, 0) line to UpdateSoundOrigin(2) function to prevent sound from being assigned a negative volume when sound emitter out of range.
  • Separated some conditions. First, we should check if the sounds exist. After, check if the sound is stream sound. Don't waste your time time to check them both.

Note:

  • RadioCHN channel placed only in KillSounds because placing in ResumeSounds and PauseSounds doesn't affect on the channel. To do!

Jabka666 avatar Sep 12 '22 19:09 Jabka666