BufferedSoundStream.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // BufferedSoundStream.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. /// %Sound stream that supports manual buffering of data from the main thread.
  21. /// </summary>
  22. public unsafe partial class BufferedSoundStream : SoundStream
  23. {
  24. unsafe partial void OnBufferedSoundStreamCreated ();
  25. [Preserve]
  26. public BufferedSoundStream (IntPtr handle) : base (handle)
  27. {
  28. OnBufferedSoundStreamCreated ();
  29. }
  30. [Preserve]
  31. protected BufferedSoundStream (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnBufferedSoundStreamCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern IntPtr BufferedSoundStream_BufferedSoundStream ();
  37. [Preserve]
  38. public BufferedSoundStream () : base (UrhoObjectFlag.Empty)
  39. {
  40. Runtime.Validate (typeof(BufferedSoundStream));
  41. handle = BufferedSoundStream_BufferedSoundStream ();
  42. Runtime.RegisterObject (this);
  43. OnBufferedSoundStreamCreated ();
  44. }
  45. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  46. internal static extern uint BufferedSoundStream_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 override uint GetData (sbyte* dest, uint numBytes)
  51. {
  52. Runtime.ValidateRefCounted (this);
  53. return BufferedSoundStream_GetData (handle, dest, numBytes);
  54. }
  55. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  56. internal static extern void BufferedSoundStream_AddData (IntPtr handle, IntPtr data, uint numBytes);
  57. /// <summary>
  58. /// Buffer sound data. Makes a copy of it.
  59. /// </summary>
  60. public void AddData (IntPtr data, uint numBytes)
  61. {
  62. Runtime.ValidateRefCounted (this);
  63. BufferedSoundStream_AddData (handle, data, numBytes);
  64. }
  65. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  66. internal static extern void BufferedSoundStream_Clear (IntPtr handle);
  67. /// <summary>
  68. /// Remove all buffered audio data.
  69. /// </summary>
  70. public void Clear ()
  71. {
  72. Runtime.ValidateRefCounted (this);
  73. BufferedSoundStream_Clear (handle);
  74. }
  75. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  76. internal static extern uint BufferedSoundStream_GetBufferNumBytes (IntPtr handle);
  77. /// <summary>
  78. /// Return amount of buffered (unplayed) sound data in bytes.
  79. /// </summary>
  80. private uint GetBufferNumBytes ()
  81. {
  82. Runtime.ValidateRefCounted (this);
  83. return BufferedSoundStream_GetBufferNumBytes (handle);
  84. }
  85. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  86. internal static extern float BufferedSoundStream_GetBufferLength (IntPtr handle);
  87. /// <summary>
  88. /// Return length of buffered (unplayed) sound data in seconds.
  89. /// </summary>
  90. private float GetBufferLength ()
  91. {
  92. Runtime.ValidateRefCounted (this);
  93. return BufferedSoundStream_GetBufferLength (handle);
  94. }
  95. /// <summary>
  96. /// Return amount of buffered (unplayed) sound data in bytes.
  97. /// </summary>
  98. public uint BufferNumBytes {
  99. get {
  100. return GetBufferNumBytes ();
  101. }
  102. }
  103. /// <summary>
  104. /// Return length of buffered (unplayed) sound data in seconds.
  105. /// </summary>
  106. public float BufferLength {
  107. get {
  108. return GetBufferLength ();
  109. }
  110. }
  111. }
  112. }