audio.inc 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * SSSSSSSSSSSSSSS AAA RRRRRRRRRRRRRRRRR PPPPPPPPPPPPPPPPP
  3. * SS:::::::::::::::S A:::A R::::::::::::::::R P::::::::::::::::P
  4. * S:::::SSSSSS::::::S A:::::A R::::::RRRRRR:::::R P::::::PPPPPP:::::P
  5. * S:::::S SSSSSSS A:::::::A RR:::::R R:::::RPP:::::P P:::::P
  6. * S:::::S A:::::::::A R::::R R:::::R P::::P P:::::P
  7. * S:::::S A:::::A:::::A R::::R R:::::R P::::P P:::::P
  8. * S::::SSSS A:::::A A:::::A R::::RRRRRR:::::R P::::PPPPPP:::::P
  9. * SS::::::SSSSS A:::::A A:::::A R:::::::::::::RR P:::::::::::::PP
  10. * SSS::::::::SS A:::::A A:::::A R::::RRRRRR:::::R P::::PPPPPPPPP
  11. * SSSSSS::::S A:::::AAAAAAAAA:::::A R::::R R:::::R P::::P
  12. * S:::::S A:::::::::::::::::::::A R::::R R:::::R P::::P
  13. * S:::::S A:::::AAAAAAAAAAAAA:::::A R::::R R:::::R P::::P
  14. * SSSSSSS S:::::S A:::::A A:::::A RR:::::R R:::::RPP::::::PP
  15. * S::::::SSSSSS:::::SA:::::A A:::::A R::::::R R:::::RP::::::::P
  16. * S:::::::::::::::SSA:::::A A:::::A R::::::R R:::::RP::::::::P
  17. * SSSSSSSSSSSSSSS AAAAAAA AAAAAAARRRRRRRR RRRRRRRPPPPPPPPPP
  18. */
  19. #include <a_samp>
  20. /*
  21. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  22. +++++++++++++++++++++++++++++++++ Definitions ++++++++++++++++++++++++++++++++++
  23. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  24. */
  25. #define MAX_CHANNELS 100
  26. #define MAX_LISTENERS 500 // To match the current slots on SARP.
  27. #define AUDIO_ERROR_GENERIC -1
  28. #define AUDIO_SUCCESS 0
  29. #define AUDIO_ERROR_SOCKET 1
  30. #define AUDIO_ERROR_BUSY 2
  31. #define AUDIO_ERROR_OVERUNDERFLOW 3
  32. #define AUDIO_ERROR_NOTFOUND 4
  33. #define AUDIO_ERROR_NOSTREAM 5
  34. ///*****************************************************************************
  35. /// Meaning of the above.
  36. /// AUDIO_ERROR_GENERIC - An unidentified error occurred.
  37. /// a_ChannelStreamPosition = AUDIO_ERROR_NOSTREAM.
  38. ///
  39. /// AUDIO_SUCCESS - The function succeeded.
  40. ///
  41. /// AUDIO_ERROR_SOCKET - A socket failed to create.
  42. ///
  43. /// AUDIO_ERROR_BUSY - 1) The server is already running.
  44. /// 2) The channel ID specified is busy/exists.
  45. /// 3) Couldn't bind a socket.
  46. ///
  47. /// AUDIO_ERROR_OVERUNDERFLOW - The channel ID specified is either...
  48. /// 1) Below 0.
  49. /// 2) Above MAX_CHANNELS.
  50. ///
  51. /// AUDIO_ERROR_NOTFOUND - 1) The server is not running.
  52. /// 2) The channel ID specified does not exist.
  53. ///
  54. /// AUDIO_ERROR_NOSTREAM - The channel ID doesn't have a valid stream.
  55. ///*****************************************************************************
  56. /*
  57. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  58. +++++++++++++++++++++++++++++++++ Main Natives +++++++++++++++++++++++++++++++++
  59. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  60. */
  61. ///*****************************************************************************
  62. /// a_StartServer(ip[], port);
  63. /// Starts the main server.
  64. ///*****************************************************************************
  65. native a_StartServer(ip[], port);
  66. ///*****************************************************************************
  67. /// a_StopServer(bool:retainchannels);
  68. /// Stops the main server, retainchannels specifys to keep channels or not.
  69. ///*****************************************************************************
  70. native a_StopServer(bool:retainchannels);
  71. ///*****************************************************************************
  72. /// a_CreateChannel(id);
  73. /// Creates an audio channel.
  74. ///*****************************************************************************
  75. native a_CreateChannel(id);
  76. ///*****************************************************************************
  77. /// a_DestroyChannel(id);
  78. /// Destroys an audio channel.
  79. ///*****************************************************************************
  80. native a_DestroyChannel(id);
  81. ///*****************************************************************************
  82. /// a_ChannelStreamURL(id, url[]);
  83. /// Streams the specified URL to the specified channel.
  84. ///*****************************************************************************
  85. native a_ChannelStreamURL(id, url[]);
  86. ///*****************************************************************************
  87. /// a_ChannelStopStream(id);
  88. /// Stops the specified channel's stream.
  89. ///*****************************************************************************
  90. native a_ChannelStopStream(id);
  91. ///*****************************************************************************
  92. /// a_ChannelStreamSeek(id, second);
  93. /// Seeks the specified channel's stream to the specified second in time.
  94. ///*****************************************************************************
  95. native a_ChannelStreamSeek(id, second);
  96. ///*****************************************************************************
  97. /// a_ChannelStreamPosition(id);
  98. /// Returns the position of the specified channel's stream in seconds.
  99. ///*****************************************************************************
  100. native a_ChannelStreamPosition(id);