コード例 #1
0
 public void Dispose()
 {
     if (this.id != 0u)
     {
         AudioSampleProvider.InternalSetScriptingPtr(this.id, null);
         this.id = 0u;
     }
     GC.SuppressFinalize(this);
 }
コード例 #2
0
        static internal AudioSampleProvider Lookup(
            uint providerId, Object ownerObj, ushort trackIndex)
        {
            AudioSampleProvider provider = InternalGetScriptingPtr(providerId);

            if (provider != null || !InternalIsValid(providerId))
            {
                return(provider);
            }

            return(new AudioSampleProvider(providerId, ownerObj, trackIndex));
        }
コード例 #3
0
        private AudioSampleProvider(uint providerId, UnityEngine.Object ownerObj, ushort trackIdx)
        {
            this.owner      = ownerObj;
            this.id         = providerId;
            this.trackIndex = trackIdx;
            this.m_ConsumeSampleFramesNativeFunction = (AudioSampleProvider.ConsumeSampleFramesNativeFunction)Marshal.GetDelegateForFunctionPointer(AudioSampleProvider.InternalGetConsumeSampleFramesNativeFunctionPtr(), typeof(AudioSampleProvider.ConsumeSampleFramesNativeFunction));
            ushort channelCount = 0;
            uint   sampleRate   = 0u;

            AudioSampleProvider.InternalGetFormatInfo(providerId, out channelCount, out sampleRate);
            this.channelCount = channelCount;
            this.sampleRate   = sampleRate;
            AudioSampleProvider.InternalSetScriptingPtr(providerId, this);
        }
コード例 #4
0
        internal static AudioSampleProvider Lookup(uint providerId, UnityEngine.Object ownerObj, ushort trackIndex)
        {
            AudioSampleProvider audioSampleProvider = AudioSampleProvider.InternalGetScriptingPtr(providerId);
            AudioSampleProvider result;

            if (audioSampleProvider != null)
            {
                result = audioSampleProvider;
            }
            else
            {
                result = new AudioSampleProvider(providerId, ownerObj, trackIndex);
            }
            return(result);
        }
コード例 #5
0
        internal uint QueueSampleFrames(NativeArray <float> sampleFrames)
        {
            bool flag = this.channelCount == 0;
            uint result;

            if (flag)
            {
                result = 0u;
            }
            else
            {
                result = AudioSampleProvider.InternalQueueSampleFrames(this.id, (IntPtr)sampleFrames.GetUnsafeReadOnlyPtr <float>(), (uint)(sampleFrames.Length / (int)this.channelCount));
            }
            return(result);
        }
コード例 #6
0
        public void Dispose()
        {
            bool flag = this.id > 0u;

            if (flag)
            {
                AudioSampleProvider.InternalSetScriptingPtr(this.id, null);
                bool flag2 = this.owner == null;
                if (flag2)
                {
                    AudioSampleProvider.InternalRemove(this.id);
                }
                this.id = 0u;
            }
            GC.SuppressFinalize(this);
        }
コード例 #7
0
        internal static AudioSampleProvider Create(ushort channelCount, uint sampleRate)
        {
            uint providerId = AudioSampleProvider.InternalCreateSampleProvider(channelCount, sampleRate);
            bool flag       = !AudioSampleProvider.InternalIsValid(providerId);
            AudioSampleProvider result;

            if (flag)
            {
                result = null;
            }
            else
            {
                result = new AudioSampleProvider(providerId, null, 0);
            }
            return(result);
        }
コード例 #8
0
 private static extern void InternalSetScriptingPtr(
     uint providerId, AudioSampleProvider provider);
コード例 #9
0
 public void ClearSampleFramesOverflowNativeHandler()
 {
     AudioSampleProvider.InternalClearSampleFramesOverflowNativeHandler(this.id);
 }
コード例 #10
0
 public void SetSampleFramesOverflowNativeHandler(AudioSampleProvider.SampleFramesEventNativeFunction handler, IntPtr userData)
 {
     AudioSampleProvider.InternalSetSampleFramesOverflowNativeHandler(this.id, Marshal.GetFunctionPointerForDelegate(handler), userData);
 }
コード例 #11
0
 public void ClearSampleFramesAvailableNativeHandler()
 {
     AudioSampleProvider.InternalClearSampleFramesAvailableNativeHandler(this.id);
 }
コード例 #12
0
 public static void UnregisterSampleProvider(this AudioSource source, AudioSampleProvider provider)
 {
     Internal_UnregisterSampleProviderFromAudioSource(source, provider.id);
 }
コード例 #13
0
 public static void RegisterSampleProvider(this AudioSource source, AudioSampleProvider provider)
 {
     Internal_RegisterSampleProviderWithAudioSource(source, provider.id);
 }
コード例 #14
0
 public static float GetSpeed(this AudioSampleProvider provider)
 {
     return(InternalGetAudioSampleProviderSpeed(provider.id));
 }