SoundStream.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // SoundStream.cs
  6. //
  7. // Copyright 2015 Xamarin Inc. All rights reserved.
  8. using System;
  9. using System.Runtime.InteropServices;
  10. using System.Collections.Generic;
  11. using Urho.Urho2D;
  12. using Urho.Gui;
  13. using Urho.Resources;
  14. using Urho.IO;
  15. using Urho.Navigation;
  16. using Urho.Network;
  17. namespace Urho.Audio
  18. {
  19. /// <summary>
  20. /// Base class for sound streams.
  21. /// </summary>
  22. public unsafe partial class SoundStream : RefCounted
  23. {
  24. unsafe partial void OnSoundStreamCreated ();
  25. [Preserve]
  26. public SoundStream (IntPtr handle) : base (handle)
  27. {
  28. OnSoundStreamCreated ();
  29. }
  30. [Preserve]
  31. protected SoundStream (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnSoundStreamCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern bool SoundStream_Seek (IntPtr handle, uint sample_number);
  37. /// <summary>
  38. /// Seek to sample number. Return true on success. Need not be implemented by all streams.
  39. /// </summary>
  40. public virtual bool Seek (uint sample_number)
  41. {
  42. Runtime.ValidateRefCounted (this);
  43. return SoundStream_Seek (handle, sample_number);
  44. }
  45. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  46. internal static extern uint SoundStream_GetData (IntPtr handle, sbyte* dest, uint numBytes);
  47. /// <summary>
  48. /// Produce sound data into destination. Return number of bytes produced. Called by SoundSource from the mixing thread.
  49. /// </summary>
  50. public virtual uint GetData (sbyte* dest, uint numBytes)
  51. {
  52. Runtime.ValidateRefCounted (this);
  53. return SoundStream_GetData (handle, dest, numBytes);
  54. }
  55. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  56. internal static extern void SoundStream_SetFormat (IntPtr handle, uint frequency, bool sixteenBit, bool stereo);
  57. /// <summary>
  58. /// Set sound data format.
  59. /// </summary>
  60. public void SetFormat (uint frequency, bool sixteenBit, bool stereo)
  61. {
  62. Runtime.ValidateRefCounted (this);
  63. SoundStream_SetFormat (handle, frequency, sixteenBit, stereo);
  64. }
  65. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  66. internal static extern void SoundStream_SetStopAtEnd (IntPtr handle, bool enable);
  67. /// <summary>
  68. /// Set whether playback should stop when no more data. Default false.
  69. /// </summary>
  70. private void SetStopAtEnd (bool enable)
  71. {
  72. Runtime.ValidateRefCounted (this);
  73. SoundStream_SetStopAtEnd (handle, enable);
  74. }
  75. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  76. internal static extern uint SoundStream_GetSampleSize (IntPtr handle);
  77. /// <summary>
  78. /// Return sample size.
  79. /// </summary>
  80. private uint GetSampleSize ()
  81. {
  82. Runtime.ValidateRefCounted (this);
  83. return SoundStream_GetSampleSize (handle);
  84. }
  85. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  86. internal static extern float SoundStream_GetFrequency (IntPtr handle);
  87. /// <summary>
  88. /// Return default frequency as a float.
  89. /// </summary>
  90. private float GetFrequency ()
  91. {
  92. Runtime.ValidateRefCounted (this);
  93. return SoundStream_GetFrequency (handle);
  94. }
  95. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  96. internal static extern uint SoundStream_GetIntFrequency (IntPtr handle);
  97. /// <summary>
  98. /// Return default frequency as an integer.
  99. /// </summary>
  100. private uint GetIntFrequency ()
  101. {
  102. Runtime.ValidateRefCounted (this);
  103. return SoundStream_GetIntFrequency (handle);
  104. }
  105. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  106. internal static extern bool SoundStream_GetStopAtEnd (IntPtr handle);
  107. /// <summary>
  108. /// Return whether playback should stop when no more data.
  109. /// </summary>
  110. private bool GetStopAtEnd ()
  111. {
  112. Runtime.ValidateRefCounted (this);
  113. return SoundStream_GetStopAtEnd (handle);
  114. }
  115. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  116. internal static extern bool SoundStream_IsSixteenBit (IntPtr handle);
  117. /// <summary>
  118. /// Return whether data is sixteen bit.
  119. /// </summary>
  120. private bool IsSixteenBit ()
  121. {
  122. Runtime.ValidateRefCounted (this);
  123. return SoundStream_IsSixteenBit (handle);
  124. }
  125. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  126. internal static extern bool SoundStream_IsStereo (IntPtr handle);
  127. /// <summary>
  128. /// Return whether data is stereo.
  129. /// </summary>
  130. private bool IsStereo ()
  131. {
  132. Runtime.ValidateRefCounted (this);
  133. return SoundStream_IsStereo (handle);
  134. }
  135. /// <summary>
  136. /// Return whether playback should stop when no more data.
  137. /// Or
  138. /// Set whether playback should stop when no more data. Default false.
  139. /// </summary>
  140. public bool StopAtEnd {
  141. get {
  142. return GetStopAtEnd ();
  143. }
  144. set {
  145. SetStopAtEnd (value);
  146. }
  147. }
  148. /// <summary>
  149. /// Return sample size.
  150. /// </summary>
  151. public uint SampleSize {
  152. get {
  153. return GetSampleSize ();
  154. }
  155. }
  156. /// <summary>
  157. /// Return default frequency as a float.
  158. /// </summary>
  159. public float Frequency {
  160. get {
  161. return GetFrequency ();
  162. }
  163. }
  164. /// <summary>
  165. /// Return default frequency as an integer.
  166. /// </summary>
  167. public uint IntFrequency {
  168. get {
  169. return GetIntFrequency ();
  170. }
  171. }
  172. /// <summary>
  173. /// Return whether data is sixteen bit.
  174. /// </summary>
  175. public bool SixteenBit {
  176. get {
  177. return IsSixteenBit ();
  178. }
  179. }
  180. /// <summary>
  181. /// Return whether data is stereo.
  182. /// </summary>
  183. public bool Stereo {
  184. get {
  185. return IsStereo ();
  186. }
  187. }
  188. }
  189. }