Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef SOUNDCHARS_H
  7. #define SOUNDCHARS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #define CHAR_STREAM '*' // as one of 1st 2 chars in name, indicates streaming wav data
  12. #define CHAR_USERVOX '?' // as one of 1st 2 chars in name, indicates user realtime voice data
  13. #define CHAR_SENTENCE '!' // as one of 1st 2 chars in name, indicates sentence wav
  14. #define CHAR_DRYMIX '#' // as one of 1st 2 chars in name, indicates wav bypasses dsp fx
  15. #define CHAR_DOPPLER '>' // as one of 1st 2 chars in name, indicates doppler encoded stereo wav: left wav (incomming) and right wav (outgoing).
  16. #define CHAR_DIRECTIONAL '<' // as one of 1st 2 chars in name, indicates stereo wav has direction cone: mix left wav (front facing) with right wav (rear facing) based on soundfacing direction
  17. #define CHAR_DISTVARIANT '^' // as one of 1st 2 chars in name, indicates distance variant encoded stereo wav (left is close, right is far)
  18. #define CHAR_OMNI '@' // as one of 1st 2 chars in name, indicates non-directional wav (default mono or stereo)
  19. #define CHAR_SPATIALSTEREO ')' // as one of 1st 2 chars in name, indicates spatialized stereo wav
  20. #define CHAR_FAST_PITCH '}' // as one of 1st 2 chars in name, forces low quality, non-interpolated pitch shift
  21. inline bool IsSoundChar(char c)
  22. {
  23. bool b;
  24. b = (c == CHAR_STREAM || c == CHAR_USERVOX || c == CHAR_SENTENCE || c == CHAR_DRYMIX || c == CHAR_OMNI );
  25. b = b || (c == CHAR_DOPPLER || c == CHAR_DIRECTIONAL || c == CHAR_DISTVARIANT || c == CHAR_SPATIALSTEREO || c == CHAR_FAST_PITCH );
  26. return b;
  27. }
  28. // return pointer to first valid character in file name
  29. // by skipping over CHAR_STREAM...CHAR_DRYMIX
  30. inline char *PSkipSoundChars(const char *pch)
  31. {
  32. char *pcht = (char *)pch;
  33. while ( 1 )
  34. {
  35. if (!IsSoundChar(*pcht))
  36. break;
  37. pcht++;
  38. }
  39. return pcht;
  40. }
  41. inline bool TestSoundChar(const char *pch, char c)
  42. {
  43. char *pcht = (char *)pch;
  44. while ( 1 )
  45. {
  46. if (!IsSoundChar(*pcht))
  47. break;
  48. if (*pcht == c)
  49. return true;
  50. pcht++;
  51. }
  52. return false;
  53. }
  54. #endif // SOUNDCHARS_H