| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476 |
- // WARNING - AUTOGENERATED - DO NOT EDIT
- //
- // Generated using `sharpie urho`
- //
- // Audio.cs
- //
- // Copyright 2015 Xamarin Inc. All rights reserved.
- using System;
- using System.Runtime.InteropServices;
- using System.Collections.Generic;
- using Urho.Urho2D;
- using Urho.Gui;
- using Urho.Resources;
- using Urho.IO;
- using Urho.Navigation;
- using Urho.Network;
- namespace Urho.Audio
- {
- /// <summary>
- /// %Audio subsystem.
- /// </summary>
- public unsafe partial class Audio : UrhoObject
- {
- unsafe partial void OnAudioCreated ();
- [Preserve]
- public Audio (IntPtr handle) : base (handle)
- {
- OnAudioCreated ();
- }
- [Preserve]
- protected Audio (UrhoObjectFlag emptyFlag) : base (emptyFlag)
- {
- OnAudioCreated ();
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int Audio_GetType (IntPtr handle);
- private StringHash UrhoGetType ()
- {
- Runtime.ValidateRefCounted (this);
- return new StringHash (Audio_GetType (handle));
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr Audio_GetTypeName (IntPtr handle);
- private string GetTypeName ()
- {
- Runtime.ValidateRefCounted (this);
- return Marshal.PtrToStringAnsi (Audio_GetTypeName (handle));
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int Audio_GetTypeStatic ();
- private static StringHash GetTypeStatic ()
- {
- Runtime.Validate (typeof(Audio));
- return new StringHash (Audio_GetTypeStatic ());
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr Audio_GetTypeNameStatic ();
- private static string GetTypeNameStatic ()
- {
- Runtime.Validate (typeof(Audio));
- return Marshal.PtrToStringAnsi (Audio_GetTypeNameStatic ());
- }
- [Preserve]
- public Audio () : this (Application.CurrentContext)
- {
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr Audio_Audio (IntPtr context);
- [Preserve]
- public Audio (Context context) : base (UrhoObjectFlag.Empty)
- {
- Runtime.Validate (typeof(Audio));
- handle = Audio_Audio ((object)context == null ? IntPtr.Zero : context.Handle);
- Runtime.RegisterObject (this);
- OnAudioCreated ();
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Audio_SetMode (IntPtr handle, int bufferLengthMSec, int mixRate, bool stereo, bool interpolation);
- /// <summary>
- /// Initialize sound output with specified buffer length and output mode.
- /// </summary>
- public bool SetMode (int bufferLengthMSec, int mixRate, bool stereo, bool interpolation = true)
- {
- Runtime.ValidateRefCounted (this);
- return Audio_SetMode (handle, bufferLengthMSec, mixRate, stereo, interpolation);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void Audio_Update (IntPtr handle, float timeStep);
- /// <summary>
- /// Run update on sound sources. Not required for continued playback, but frees unused sound sources
- /// &
- /// sounds and updates 3D positions.
- /// </summary>
- public void Update (float timeStep)
- {
- Runtime.ValidateRefCounted (this);
- Audio_Update (handle, timeStep);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Audio_Play (IntPtr handle);
- /// <summary>
- /// Restart sound output.
- /// </summary>
- public bool Play ()
- {
- Runtime.ValidateRefCounted (this);
- return Audio_Play (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void Audio_Stop (IntPtr handle);
- /// <summary>
- /// Suspend sound output.
- /// </summary>
- public void Stop ()
- {
- Runtime.ValidateRefCounted (this);
- Audio_Stop (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void Audio_SetMasterGain (IntPtr handle, string type, float gain);
- /// <summary>
- /// Set master gain on a specific sound type such as sound effects, music or voice.
- /// </summary>
- public void SetMasterGain (string type, float gain)
- {
- Runtime.ValidateRefCounted (this);
- Audio_SetMasterGain (handle, type, gain);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void Audio_PauseSoundType (IntPtr handle, string type);
- /// <summary>
- /// Pause playback of specific sound type. This allows to suspend e.g. sound effects or voice when the game is paused. By default all sound types are unpaused.
- /// </summary>
- public void PauseSoundType (string type)
- {
- Runtime.ValidateRefCounted (this);
- Audio_PauseSoundType (handle, type);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void Audio_ResumeSoundType (IntPtr handle, string type);
- /// <summary>
- /// Resume playback of specific sound type.
- /// </summary>
- public void ResumeSoundType (string type)
- {
- Runtime.ValidateRefCounted (this);
- Audio_ResumeSoundType (handle, type);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void Audio_ResumeAll (IntPtr handle);
- /// <summary>
- /// Resume playback of all sound types.
- /// </summary>
- public void ResumeAll ()
- {
- Runtime.ValidateRefCounted (this);
- Audio_ResumeAll (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void Audio_SetListener (IntPtr handle, IntPtr listener);
- /// <summary>
- /// Set active sound listener for 3D sounds.
- /// </summary>
- private void SetListener (SoundListener listener)
- {
- Runtime.ValidateRefCounted (this);
- Audio_SetListener (handle, (object)listener == null ? IntPtr.Zero : listener.Handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void Audio_StopSound (IntPtr handle, IntPtr sound);
- /// <summary>
- /// Stop any sound source playing a certain sound clip.
- /// </summary>
- public void StopSound (Sound sound)
- {
- Runtime.ValidateRefCounted (this);
- Audio_StopSound (handle, (object)sound == null ? IntPtr.Zero : sound.Handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern uint Audio_GetSampleSize (IntPtr handle);
- /// <summary>
- /// Return byte size of one sample.
- /// </summary>
- private uint GetSampleSize ()
- {
- Runtime.ValidateRefCounted (this);
- return Audio_GetSampleSize (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int Audio_GetMixRate (IntPtr handle);
- /// <summary>
- /// Return mixing rate.
- /// </summary>
- private int GetMixRate ()
- {
- Runtime.ValidateRefCounted (this);
- return Audio_GetMixRate (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Audio_GetInterpolation (IntPtr handle);
- /// <summary>
- /// Return whether output is interpolated.
- /// </summary>
- private bool GetInterpolation ()
- {
- Runtime.ValidateRefCounted (this);
- return Audio_GetInterpolation (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Audio_IsStereo (IntPtr handle);
- /// <summary>
- /// Return whether output is stereo.
- /// </summary>
- private bool IsStereo ()
- {
- Runtime.ValidateRefCounted (this);
- return Audio_IsStereo (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Audio_IsPlaying (IntPtr handle);
- /// <summary>
- /// Return whether audio is being output.
- /// </summary>
- private bool IsPlaying ()
- {
- Runtime.ValidateRefCounted (this);
- return Audio_IsPlaying (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Audio_IsInitialized (IntPtr handle);
- /// <summary>
- /// Return whether an audio stream has been reserved.
- /// </summary>
- private bool IsInitialized ()
- {
- Runtime.ValidateRefCounted (this);
- return Audio_IsInitialized (handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern float Audio_GetMasterGain (IntPtr handle, string type);
- /// <summary>
- /// Return master gain for a specific sound source type. Unknown sound types will return full gain (1).
- /// </summary>
- public float GetMasterGain (string type)
- {
- Runtime.ValidateRefCounted (this);
- return Audio_GetMasterGain (handle, type);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Audio_IsSoundTypePaused (IntPtr handle, string type);
- /// <summary>
- /// Return whether specific sound type has been paused.
- /// </summary>
- public bool IsSoundTypePaused (string type)
- {
- Runtime.ValidateRefCounted (this);
- return Audio_IsSoundTypePaused (handle, type);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr Audio_GetListener (IntPtr handle);
- /// <summary>
- /// Return active sound listener.
- /// </summary>
- private SoundListener GetListener ()
- {
- Runtime.ValidateRefCounted (this);
- return Runtime.LookupObject<SoundListener> (Audio_GetListener (handle));
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool Audio_HasMasterGain (IntPtr handle, string type);
- /// <summary>
- /// Return whether the specified master gain has been defined.
- /// </summary>
- public bool HasMasterGain (string type)
- {
- Runtime.ValidateRefCounted (this);
- return Audio_HasMasterGain (handle, type);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void Audio_AddSoundSource (IntPtr handle, IntPtr soundSource);
- /// <summary>
- /// Add a sound source to keep track of. Called by SoundSource.
- /// </summary>
- public void AddSoundSource (SoundSource soundSource)
- {
- Runtime.ValidateRefCounted (this);
- Audio_AddSoundSource (handle, (object)soundSource == null ? IntPtr.Zero : soundSource.Handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void Audio_RemoveSoundSource (IntPtr handle, IntPtr soundSource);
- /// <summary>
- /// Remove a sound source. Called by SoundSource.
- /// </summary>
- public void RemoveSoundSource (SoundSource soundSource)
- {
- Runtime.ValidateRefCounted (this);
- Audio_RemoveSoundSource (handle, (object)soundSource == null ? IntPtr.Zero : soundSource.Handle);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern float Audio_GetSoundSourceMasterGain (IntPtr handle, int typeHash);
- /// <summary>
- /// Return sound type specific gain multiplied by master gain.
- /// </summary>
- public float GetSoundSourceMasterGain (StringHash typeHash)
- {
- Runtime.ValidateRefCounted (this);
- return Audio_GetSoundSourceMasterGain (handle, typeHash.Code);
- }
- [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void Audio_MixOutput (IntPtr handle, IntPtr dest, uint samples);
- /// <summary>
- /// Mix sound sources into the buffer.
- /// </summary>
- public void MixOutput (IntPtr dest, uint samples)
- {
- Runtime.ValidateRefCounted (this);
- Audio_MixOutput (handle, dest, samples);
- }
- public override StringHash Type {
- get {
- return UrhoGetType ();
- }
- }
- public override string TypeName {
- get {
- return GetTypeName ();
- }
- }
- [Preserve]
- public static StringHash TypeStatic {
- get {
- return GetTypeStatic ();
- }
- }
- public static string TypeNameStatic {
- get {
- return GetTypeNameStatic ();
- }
- }
- /// <summary>
- /// Return active sound listener.
- /// Or
- /// Set active sound listener for 3D sounds.
- /// </summary>
- public SoundListener Listener {
- get {
- return GetListener ();
- }
- set {
- SetListener (value);
- }
- }
- /// <summary>
- /// Return byte size of one sample.
- /// </summary>
- public uint SampleSize {
- get {
- return GetSampleSize ();
- }
- }
- /// <summary>
- /// Return mixing rate.
- /// </summary>
- public int MixRate {
- get {
- return GetMixRate ();
- }
- }
- /// <summary>
- /// Return whether output is interpolated.
- /// </summary>
- public bool Interpolation {
- get {
- return GetInterpolation ();
- }
- }
- /// <summary>
- /// Return whether output is stereo.
- /// </summary>
- public bool Stereo {
- get {
- return IsStereo ();
- }
- }
- /// <summary>
- /// Return whether audio is being output.
- /// </summary>
- public bool Playing {
- get {
- return IsPlaying ();
- }
- }
- /// <summary>
- /// Return whether an audio stream has been reserved.
- /// </summary>
- public bool Initialized {
- get {
- return IsInitialized ();
- }
- }
- }
- }
|