ISoundOptions.d.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * Interface used to define options for Sound class
  3. */
  4. export interface ISoundOptions {
  5. /**
  6. * Does the sound autoplay once loaded.
  7. */
  8. autoplay?: boolean;
  9. /**
  10. * Does the sound loop after it finishes playing once.
  11. */
  12. loop?: boolean;
  13. /**
  14. * Sound's volume
  15. */
  16. volume?: number;
  17. /**
  18. * Is it a spatial sound?
  19. */
  20. spatialSound?: boolean;
  21. /**
  22. * Maximum distance to hear that sound
  23. */
  24. maxDistance?: number;
  25. /**
  26. * Uses user defined attenuation function
  27. */
  28. useCustomAttenuation?: boolean;
  29. /**
  30. * Define the roll off factor of spatial sounds.
  31. * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound
  32. */
  33. rolloffFactor?: number;
  34. /**
  35. * Define the reference distance the sound should be heard perfectly.
  36. * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound
  37. */
  38. refDistance?: number;
  39. /**
  40. * Define the distance attenuation model the sound will follow.
  41. * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound
  42. */
  43. distanceModel?: string;
  44. /**
  45. * Defines the playback speed (1 by default)
  46. */
  47. playbackRate?: number;
  48. /**
  49. * Defines if the sound is from a streaming source
  50. */
  51. streaming?: boolean;
  52. /**
  53. * Defines an optional length (in seconds) inside the sound file
  54. */
  55. length?: number;
  56. /**
  57. * Defines an optional offset (in seconds) inside the sound file
  58. */
  59. offset?: number;
  60. /**
  61. * If true, URLs will not be required to state the audio file codec to use.
  62. */
  63. skipCodecCheck?: boolean;
  64. }