cp_sample_defs.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*************************************************************************/
  2. /* cp_sample_defs.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef CP_SAMPLE_DEFS_H
  31. #define CP_SAMPLE_DEFS_H
  32. #include "cp_config.h"
  33. enum CPSample_Loop_Type {
  34. CP_LOOP_NONE,
  35. CP_LOOP_FORWARD,
  36. CP_LOOP_BIDI
  37. };
  38. //#define INVALID_SAMPLE_ID -1
  39. #define CP_MIXING_FRAC_BITS_MACRO 13
  40. #define CP_MIXING_FRAC_BITS_TEXT "13"
  41. // 1<<9 - 1
  42. #define CP_MIXING_FRAC_BITS_MASK_TEXT "8191"
  43. enum CPMixConstants {
  44. CP_MIXING_FRAC_BITS = CP_MIXING_FRAC_BITS_MACRO,
  45. CP_MIXING_FRAC_LENGTH = (1 << CP_MIXING_FRAC_BITS),
  46. CP_MIXING_FRAC_MASK = CP_MIXING_FRAC_LENGTH - 1,
  47. CP_MIXING_VOL_FRAC_BITS = 8,
  48. CP_MIXING_FREQ_FRAC_BITS = 8
  49. };
  50. enum CPFilterConstants {
  51. CP_FILTER_SHIFT = 16,
  52. CP_FILTER_LENGTH = (1 << CP_FILTER_SHIFT)
  53. };
  54. enum CPInterpolationType {
  55. CP_INTERPOLATION_RAW,
  56. CP_INTERPOLATION_LINEAR,
  57. CP_INTERPOLATION_CUBIC
  58. };
  59. enum CPPanConstants {
  60. CP_PAN_BITS = 8, // 0 .. 256
  61. CP_PAN_LEFT = 0,
  62. CP_PAN_RIGHT = ((1 << CP_PAN_BITS) - 1), // 255
  63. CP_PAN_CENTER = CP_PAN_RIGHT / 2, // 128
  64. CP_PAN_SURROUND = 512
  65. };
  66. enum CPMixerVolConstants {
  67. CP_VOL_MAX = 512,
  68. CP_VOL_RAMP_BITS = 9,
  69. CP_VOL_SHIFT = 2
  70. };
  71. enum CPStereoCannels {
  72. CP_CHAN_LEFT,
  73. CP_CHAN_RIGHT
  74. };
  75. #define CP_FIRST_SAMPLE_DECLICK_THRESHOLD 1000
  76. #define CP_FIRST_SAMPLE_RAMP_LEN 32
  77. typedef signed char CPFrame8;
  78. typedef signed short CPFrame16;
  79. #endif