Sound.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. function Sound() {
  2. }
  3. Duktape.fin(Sound.prototype, function (x) {
  4. if (x === Sound.prototype) {
  5. return;
  6. }
  7. Polycode.Sound__delete(x.__ptr)
  8. })
  9. Sound.prototype.getSampleAsNumber = function(offset,channel,listener,orientation) {
  10. return Polycode.Sound_getSampleAsNumber(this.__ptr, offset,channel,listener,orientation)
  11. }
  12. Sound.prototype.loadFile = function(fileName) {
  13. Polycode.Sound_loadFile(this.__ptr, fileName)
  14. }
  15. Sound.prototype.Play = function(loop,restartSound) {
  16. Polycode.Sound_Play(this.__ptr, loop,restartSound)
  17. }
  18. Sound.prototype.Stop = function() {
  19. Polycode.Sound_Stop(this.__ptr)
  20. }
  21. Sound.prototype.setVolume = function(newVolume) {
  22. Polycode.Sound_setVolume(this.__ptr, newVolume)
  23. }
  24. Sound.prototype.getVolume = function() {
  25. return Polycode.Sound_getVolume(this.__ptr)
  26. }
  27. Sound.prototype.setPitch = function(newPitch) {
  28. Polycode.Sound_setPitch(this.__ptr, newPitch)
  29. }
  30. Sound.prototype.getPitch = function() {
  31. return Polycode.Sound_getPitch(this.__ptr)
  32. }
  33. Sound.prototype.isPlaying = function() {
  34. return Polycode.Sound_isPlaying(this.__ptr)
  35. }
  36. Sound.prototype.isLooped = function() {
  37. return Polycode.Sound_isLooped(this.__ptr)
  38. }
  39. Sound.prototype.setIsPositional = function(isPositional) {
  40. Polycode.Sound_setIsPositional(this.__ptr, isPositional)
  41. }
  42. Sound.prototype.setSoundPosition = function(position) {
  43. Polycode.Sound_setSoundPosition(this.__ptr, position)
  44. }
  45. Sound.prototype.setSoundVelocity = function(velocity) {
  46. Polycode.Sound_setSoundVelocity(this.__ptr, velocity)
  47. }
  48. Sound.prototype.setSoundDirection = function(direction) {
  49. Polycode.Sound_setSoundDirection(this.__ptr, direction)
  50. }
  51. Sound.prototype.setOffset = function(offset) {
  52. Polycode.Sound_setOffset(this.__ptr, offset)
  53. }
  54. Sound.prototype.getFileName = function() {
  55. return Polycode.Sound_getFileName(this.__ptr)
  56. }
  57. Sound.prototype.getPlaybackDuration = function() {
  58. return Polycode.Sound_getPlaybackDuration(this.__ptr)
  59. }
  60. Sound.prototype.getPlaybackTime = function() {
  61. return Polycode.Sound_getPlaybackTime(this.__ptr)
  62. }
  63. Sound.prototype.seekTo = function(time) {
  64. Polycode.Sound_seekTo(this.__ptr, time)
  65. }
  66. Sound.prototype.getOffset = function() {
  67. return Polycode.Sound_getOffset(this.__ptr)
  68. }
  69. Sound.prototype.getSampleLength = function() {
  70. return Polycode.Sound_getSampleLength(this.__ptr)
  71. }
  72. Sound.prototype.getFrequency = function() {
  73. return Polycode.Sound_getFrequency(this.__ptr)
  74. }
  75. Sound.prototype.setPositionalProperties = function(referenceDistance,maxDistance) {
  76. Polycode.Sound_setPositionalProperties(this.__ptr, referenceDistance,maxDistance)
  77. }
  78. Sound.prototype.setReferenceDistance = function(referenceDistance) {
  79. Polycode.Sound_setReferenceDistance(this.__ptr, referenceDistance)
  80. }
  81. Sound.prototype.setMaxDistance = function(maxDistance) {
  82. Polycode.Sound_setMaxDistance(this.__ptr, maxDistance)
  83. }
  84. Sound.prototype.getReferenceDistance = function() {
  85. return Polycode.Sound_getReferenceDistance(this.__ptr)
  86. }
  87. Sound.prototype.getMaxDistance = function() {
  88. return Polycode.Sound_getMaxDistance(this.__ptr)
  89. }
  90. Sound.prototype.loadBytes = function(data,size,channels,freq,format) {
  91. return Polycode.Sound_loadBytes(this.__ptr, data,size,channels,freq,format)
  92. }
  93. Sound.prototype.loadWAV = function(fileName) {
  94. return Polycode.Sound_loadWAV(this.__ptr, fileName)
  95. }
  96. Sound.prototype.loadOGG = function(fileName) {
  97. return Polycode.Sound_loadOGG(this.__ptr, fileName)
  98. }
  99. Sound.prototype.soundCheck = function(result,err) {
  100. Polycode.Sound_soundCheck(this.__ptr, result,err)
  101. }
  102. Sound.prototype.updateStream = function(streamCount) {
  103. Polycode.Sound_updateStream(this.__ptr, streamCount)
  104. }