Skip to content

Fix Sound.is_precached and StreamSound.is_precached performance #222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 3, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add comment about engine_sound.is_sound_precached.
  • Loading branch information
jsza committed Nov 3, 2017
commit 038fd0b9623832de845d001d1062e42cd8eb18bb
4 changes: 4 additions & 0 deletions addons/source-python/packages/source-python/engines/sound.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ def is_precached(self):

:rtype: bool
"""
# We can't use engine_sound.is_sound_precached here because it always
# returns True.
return string_tables.soundprecache[self.sample] != INVALID_STRING_INDEX


Expand Down Expand Up @@ -368,5 +370,7 @@ def is_precached(self):

:rtype: bool
"""
# We can't use engine_sound.is_sound_precached here because it always
# returns True.
index = string_tables.soundprecache[self._stream_sample]
return index != INVALID_STRING_INDEX