Пример #1
0
            protected virtual void Dispose(bool disposing)
            {
                if (!disposedValue)
                {
                    if (disposing)
                    {
                        // TODO: dispose managed state (managed objects).
                    }

                    // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                    // TODO: set large fields to null.
#if __IOS__
                    m_audioTrack?.Stop();
                    m_audioTrack?.Dispose();
                    m_memory?.Dispose();
                    m_memory = null;
#elif __ANDROID__
                    m_audioTrack?.Stop();
                    m_audioTrack?.Flush();
                    m_audioTrack?.Release();
                    m_audioTrack?.Dispose();
#elif NETFX_CORE
                    m_audioTrack?.Pause();
                    m_memory?.Flush();
                    m_memory?.Dispose();
                    m_memory = null;
#endif
                    m_audioTrack  = null;
                    disposedValue = true;
                }
            }
Пример #2
0
            public async void Stop()
            {
                if (m_PlayThread != Unit.CompletedTask)
                {
                    try
                    {
                        cancellation.Cancel();
                        await m_PlayThread;
                    }
                    catch (Exception)
                    {
                    }
                }
                if (m_audioTrack != null)
                {
#if !WINDOWS_UWP
                    m_audioTrack.Stop();
                    m_audioTrack.Dispose();
#else
                    m_audioTrack.Pause();
#endif
                    m_audioTrack = null;
                }
            }