Exemplo n.º 1
0
        public void StopPlaying()
        {
            if (Thread.CurrentThread.ManagedThreadId != _thread0.ManagedThreadId)
            {
                lock (_queue1)
                {
                    _queue1.Enqueue(new Class164(Enum19.Const1, null));
                    _autoResetEvent0.Set();
                }
                return;
            }
            _enum10 = AudioStatus.ShouldStopAudio;
            _bool0  = false;
            Enum18 @enum;

            lock (_object0)
            {
                @enum = Class162.waveOutReset(_intptr0);
            }
            if (@enum != Enum18.Const0)
            {
                throw new Exception4(@enum, "waveOutReset");
            }
            _stopwatch0.Reset();
        }
Exemplo n.º 2
0
        public AudioPlayer(int int0, WaveFormat waveFormat0, int int1, float volume, bool bool3, Delegate3 delegate31)
        {
            WaitCallback waitCallback   = null;
            var          volumeListener = new VolumeListener();

            volumeListener.Volume = volume;
            _delegate40           = Class165.smethod_0;
            _object0 = new object();
            //base..ctor();
            volumeListener.AudioPlayer = this;
            _bool2      = bool3;
            _byte0      = (byte)((waveFormat0.short_2 == 8) ? 128 : 0);
            _delegate30 = delegate31;
            Exception4.smethod_1(
                Class162.waveOutOpen(out _intptr0, int0, waveFormat0, _delegate40, 0, Class162.Enum17.Const3),
                "waveOutOpen");
            method_7(waveFormat0.method_0(int1 / 5), 5);
            _thread0 = new Thread(method_6);
            SetVolume(0f);
            _thread0.Start();
            if (waitCallback == null)
            {
                waitCallback = volumeListener.StartListener;
            }
            ThreadPool.QueueUserWorkItem(waitCallback);
        }
Exemplo n.º 3
0
 private void method_9(int int4)
 {
     lock (_object0)
     {
         Exception4.smethod_1(Class162.waveOutSetVolume(_intptr0, int4), "waveOutSetVolume");
     }
 }
Exemplo n.º 4
0
 public void Dispose()
 {
     if (_thread0 != null)
     {
         try
         {
             _bool0 = true;
             if (_intptr0 != IntPtr.Zero)
             {
                 Class162.waveInReset(_intptr0);
             }
             method_1();
             _thread0.Join();
             _delegate20 = null;
             method_0();
             if (_intptr0 != IntPtr.Zero)
             {
                 Class162.waveInClose(_intptr0);
             }
         }
         finally
         {
             _thread0 = null;
             _intptr0 = IntPtr.Zero;
         }
     }
     GC.SuppressFinalize(this);
 }
Exemplo n.º 5
0
 public void Dispose()
 {
     lock (_object0)
     {
         if (_thread0 != null)
         {
             try
             {
                 _bool0 = true;
                 if (_intptr0 != IntPtr.Zero)
                 {
                     Class162.waveOutReset(_intptr0);
                 }
                 _thread0.Join();
                 _delegate30 = null;
                 method_8();
                 if (_intptr0 != IntPtr.Zero)
                 {
                     var @class = new Class161();
                     @class.Class1590 = this;
                     @class.Intptr0   = _intptr0;
                     ThreadPool.QueueUserWorkItem(@class.method_0);
                 }
             }
             finally
             {
                 _thread0 = null;
                 _intptr0 = IntPtr.Zero;
             }
         }
     }
     GC.SuppressFinalize(this);
 }
Exemplo n.º 6
0
        public void method_6()
        {
            if (Thread.CurrentThread.ManagedThreadId != _thread0.ManagedThreadId)
            {
                lock (_queue1)
                {
                    _queue1.Enqueue(new Class164(Enum19.Const4, null));
                    _autoResetEvent0.Set();
                }
                return;
            }
            method_9(0);
            Enum18 @enum;

            lock (_object0)
            {
                @enum = Class162.waveOutRestart(_intptr0);
            }
            if (@enum != Enum18.Const0)
            {
                throw new Exception4(@enum, "waveOutRestart");
            }
            if (!_stopwatch0.IsRunning)
            {
                _stopwatch0.Start();
            }
            if (!_bool1)
            {
                ThreadPool.QueueUserWorkItem(method_11);
            }
        }
Exemplo n.º 7
0
        public void SetVolume(float float0)
        {
            var int_ = (int)(float0 * 65535f) + ((int)(float0 * 65535f) << 16);

            if (_intptr0 != IntPtr.Zero)
            {
                Class162.waveOutSetVolume(_intptr0, int_);
            }
        }
Exemplo n.º 8
0
 public bool method_2()
 {
     lock (_object0)
     {
         _autoResetEvent0.Reset();
         _bool0 = (Class162.waveOutWrite(_intptr0, ref _struct660, Marshal.SizeOf(_struct660)) == Enum18.Const0);
     }
     return(_bool0);
 }
Exemplo n.º 9
0
            public void method_0(object object0)
            {
                GC.KeepAlive(Class1590._delegate40);
                var intPtr = Intptr0;

                while (Class162.waveOutClose(intPtr) != Enum18.Const0)
                {
                    Thread.Sleep(1000);
                }
            }
Exemplo n.º 10
0
        public float method_1()
        {
            var num = 0;

            if (_intptr0 != IntPtr.Zero)
            {
                Class162.waveOutGetVolume(_intptr0, ref num);
            }
            return(((num >> 16) / 65536f + (num & 65535) / 65536f) / 2f);
        }
Exemplo n.º 11
0
        public int method_0()
        {
            var @struct = default(Struct67);

            @struct.enum14_0 = Enum14.Const2;
            if (_intptr0 != IntPtr.Zero)
            {
                Class162.waveOutGetPosition(_intptr0, ref @struct, Marshal.SizeOf(@struct));
            }
            return(@struct.int_2);
        }
Exemplo n.º 12
0
 public Class165(IntPtr intptr1, int int0)
 {
     _intptr0           = intptr1;
     _gchandle0         = GCHandle.Alloc(_struct660, GCHandleType.Pinned);
     _struct660.Intptr1 = (IntPtr)GCHandle.Alloc(this);
     _byte0             = new byte[int0];
     _gchandle1         = GCHandle.Alloc(_byte0, GCHandleType.Pinned);
     _struct660.Intptr0 = _gchandle1.AddrOfPinnedObject();
     _struct660.Int0    = int0;
     Exception4.smethod_1(Class162.waveOutPrepareHeader(_intptr0, ref _struct660, Marshal.SizeOf(_struct660)),
                          "waveOutPrepareHeader");
 }
Exemplo n.º 13
0
        private void method_4()
        {
            Enum18 @enum;

            lock (_object0)
            {
                @enum = Class162.waveOutWrite(_intptr0, ref _struct660, Marshal.SizeOf(_struct660));
            }
            if (@enum != Enum18.Const0)
            {
                throw new Exception4(@enum, "waveOutWrite");
            }
            GC.KeepAlive(this);
        }
Exemplo n.º 14
0
 public void Dispose()
 {
     if (_struct660.Intptr0 != IntPtr.Zero)
     {
         Class162.waveInUnprepareHeader(_intptr0, ref _struct660, Marshal.SizeOf(_struct660));
         _gchandle0.Free();
         _struct660.Intptr0 = IntPtr.Zero;
     }
     _autoResetEvent0.Close();
     if (_gchandle1.IsAllocated)
     {
         _gchandle1.Free();
     }
     GC.SuppressFinalize(this);
 }
Exemplo n.º 15
0
 public void method_7()
 {
     if (_intptr0 != IntPtr.Zero)
     {
         StopPlaying();
         Class162.waveOutClose(_intptr0);
         _intptr0 = IntPtr.Zero;
     }
     if (_class1580 != null)
     {
         for (var i = 0; i < 5; i++)
         {
             _class1580[i].Dispose();
         }
         _class1580 = null;
     }
 }
Exemplo n.º 16
0
 public Class158(IntPtr intptr1, int int1, GenericAudioStream stream11, object object1)
 {
     _int0              = int1;
     _class170          = new Class17(int1);
     _gchandle0         = GCHandle.Alloc(_class170.method_0(), GCHandleType.Pinned);
     _intptr0           = intptr1;
     _stream10          = stream11;
     _object0           = object1;
     _struct660         = default(Struct66);
     _gchandle1         = GCHandle.Alloc(_struct660);
     _struct660.Intptr0 = _gchandle0.AddrOfPinnedObject();
     _struct660.Int0    = int1;
     _struct660.Int2    = 1;
     _gchandle2         = GCHandle.Alloc(this);
     _struct660.Intptr1 = (IntPtr)_gchandle2;
     lock (object1)
     {
         Exception4.smethod_1(Class162.waveOutPrepareHeader(intptr1, ref _struct660, Marshal.SizeOf(_struct660)),
                              "waveOutPrepareHeader");
     }
 }
Exemplo n.º 17
0
 public void method_0(bool bool0)
 {
     if (_gchandle1.IsAllocated)
     {
         _gchandle1.Free();
     }
     if (_gchandle0.IsAllocated)
     {
         _gchandle0.Free();
     }
     if (_gchandle2.IsAllocated)
     {
         _gchandle2.Free();
     }
     if (_intptr0 != IntPtr.Zero)
     {
         lock (_object0)
         {
             Class162.waveOutUnprepareHeader(_intptr0, ref _struct660, Marshal.SizeOf(_struct660));
         }
         _intptr0 = IntPtr.Zero;
     }
 }
Exemplo n.º 18
0
 public void method_0(GenericAudioStream stream11)
 {
     if (Thread.CurrentThread.ManagedThreadId != _thread0.ManagedThreadId)
     {
         lock (_queue1)
         {
             _queue1.Enqueue(new Class164(Enum19.Const0, _stream10));
             _autoResetEvent0.Set();
         }
         return;
     }
     _stream10 = stream11;
     _int0     = stream11.vmethod_0().method_0(_int2 / 5);
     Exception4.smethod_1(
         Class162.waveOutOpen(out _intptr0, _int1, _stream10.vmethod_0(), _delegate40, 0,
                              Class162.Enum17.Const3), "waveOutOpen");
     _stream10.Position = vmethod_0();
     _class1580         = new Class158[5];
     for (var i = 0; i < 5; i++)
     {
         _class1580[i] = new Class158(_intptr0, _int0, _stream10, _object0);
     }
     _bool0 = false;
 }
Exemplo n.º 19
0
 public void method_4()
 {
     Class162.waveOutPause(_intptr0);
 }
Exemplo n.º 20
0
 public void method_3()
 {
     Class162.waveOutRestart(_intptr0);
 }