示例#1
0
 private void method_9(int int_4)
 {
     lock (this.object_0)
     {
         Exception4.smethod_1(Class162.waveOutSetVolume(this.intptr_0, int_4), "waveOutSetVolume");
     }
 }
示例#2
0
 public void Dispose()
 {
     lock (this.object_0)
     {
         if (this.thread_0 != null)
         {
             try
             {
                 this.bool_0 = true;
                 if (this.intptr_0 != IntPtr.Zero)
                 {
                     Class162.waveOutReset(this.intptr_0);
                 }
                 this.thread_0.Join();
                 this.delegate3_0 = null;
                 this.method_8();
                 if (this.intptr_0 != IntPtr.Zero)
                 {
                     AudioPlayer.Class161 @class = new AudioPlayer.Class161();
                     @class.class159_0 = this;
                     @class.intptr_0   = this.intptr_0;
                     ThreadPool.QueueUserWorkItem(new WaitCallback(@class.method_0));
                 }
             }
             finally
             {
                 this.thread_0 = null;
                 this.intptr_0 = IntPtr.Zero;
             }
         }
     }
     GC.SuppressFinalize(this);
 }
示例#3
0
        public void StopPlaying()
        {
            if (Thread.CurrentThread.ManagedThreadId != this.thread_0.ManagedThreadId)
            {
                lock (this.queue_1)
                {
                    this.queue_1.Enqueue(new WaveOutput.Class164(WaveOutput.Enum19.const_1, null));
                    this.autoResetEvent_0.Set();
                }
                return;
            }
            this.enum1_0 = AudioStatus.ShouldStopAudio;
            this.bool_0  = false;
            Enum18 @enum;

            lock (this.object_0)
            {
                @enum = Class162.waveOutReset(this.intptr_0);
            }
            if (@enum != Enum18.const_0)
            {
                throw new Exception4(@enum, "waveOutReset");
            }
            this.stopwatch_0.Reset();
        }
示例#4
0
        public void method_6()
        {
            if (Thread.CurrentThread.ManagedThreadId != this.thread_0.ManagedThreadId)
            {
                lock (this.queue_1)
                {
                    this.queue_1.Enqueue(new WaveOutput.Class164(WaveOutput.Enum19.const_4, null));
                    this.autoResetEvent_0.Set();
                }
                return;
            }
            this.method_9(0);
            Enum18 @enum;

            lock (this.object_0)
            {
                @enum = Class162.waveOutRestart(this.intptr_0);
            }
            if (@enum != Enum18.const_0)
            {
                throw new Exception4(@enum, "waveOutRestart");
            }
            if (!this.stopwatch_0.IsRunning)
            {
                this.stopwatch_0.Start();
            }
            if (!this.bool_1)
            {
                ThreadPool.QueueUserWorkItem(new WaitCallback(this.method_11));
            }
        }
示例#5
0
 public void Dispose()
 {
     if (this.thread_0 != null)
     {
         try
         {
             this.bool_0 = true;
             if (this.intptr_0 != IntPtr.Zero)
             {
                 Class162.waveInReset(this.intptr_0);
             }
             this.method_1();
             this.thread_0.Join();
             this.delegate2_0 = null;
             this.method_0();
             if (this.intptr_0 != IntPtr.Zero)
             {
                 Class162.waveInClose(this.intptr_0);
             }
         }
         finally
         {
             this.thread_0 = null;
             this.intptr_0 = IntPtr.Zero;
         }
     }
     GC.SuppressFinalize(this);
 }
示例#6
0
        public void SetVolume(float float_0)
        {
            int int_ = (int)(float_0 * 65535f) + ((int)(float_0 * 65535f) << 16);

            if (this.intptr_0 != IntPtr.Zero)
            {
                Class162.waveOutSetVolume(this.intptr_0, int_);
            }
        }
示例#7
0
 public bool method_2()
 {
     lock (this.object_0)
     {
         this.autoResetEvent_0.Reset();
         this.bool_0 = (Class162.waveOutWrite(this.intptr_0, ref this.struct66_0, Marshal.SizeOf(this.struct66_0)) == Enum18.const_0);
     }
     return(this.bool_0);
 }
示例#8
0
        public float method_1()
        {
            int num = 0;

            if (this.intptr_0 != IntPtr.Zero)
            {
                Class162.waveOutGetVolume(this.intptr_0, ref num);
            }
            return(((float)(num >> 16) / 65536f + (float)(num & 65535) / 65536f) / 2f);
        }
示例#9
0
            public void method_0(object object_0)
            {
                GC.KeepAlive(this.class159_0.delegate4_0);
                IntPtr intPtr = this.intptr_0;

                while (Class162.waveOutClose(intPtr) != Enum18.const_0)
                {
                    Thread.Sleep(1000);
                }
            }
示例#10
0
 public Class165(IntPtr intptr_1, int int_0)
 {
     this.intptr_0            = intptr_1;
     this.gchandle_0          = GCHandle.Alloc(this.struct66_0, GCHandleType.Pinned);
     this.struct66_0.intptr_1 = (IntPtr)GCHandle.Alloc(this);
     this.byte_0              = new byte[int_0];
     this.gchandle_1          = GCHandle.Alloc(this.byte_0, GCHandleType.Pinned);
     this.struct66_0.intptr_0 = this.gchandle_1.AddrOfPinnedObject();
     this.struct66_0.int_0    = int_0;
     Exception4.smethod_1(Class162.waveOutPrepareHeader(this.intptr_0, ref this.struct66_0, Marshal.SizeOf(this.struct66_0)), "waveOutPrepareHeader");
 }
示例#11
0
        public int method_0()
        {
            Struct67 @struct = default(Struct67);

            @struct.enum14_0 = Enum14.const_2;
            if (this.intptr_0 != IntPtr.Zero)
            {
                Class162.waveOutGetPosition(this.intptr_0, ref @struct, Marshal.SizeOf(@struct));
            }
            return(@struct.int_2);
        }
示例#12
0
        private void method_4()
        {
            Enum18 @enum;

            lock (this.object_0)
            {
                @enum = Class162.waveOutWrite(this.intptr_0, ref this.struct66_0, Marshal.SizeOf(this.struct66_0));
            }
            if (@enum != Enum18.const_0)
            {
                throw new Exception4(@enum, "waveOutWrite");
            }
            GC.KeepAlive(this);
        }
示例#13
0
 public static void smethod_0(IntPtr intptr_1, Class162.Enum16 enum16_0, int int_0, ref Struct66 struct66_1, int int_1)
 {
     if (enum16_0 == Class162.Enum16.const_1)
     {
         try
         {
             Class165 @class = (Class165)((GCHandle)struct66_1.intptr_1).Target;
             @class.method_4();
         }
         catch
         {
         }
     }
 }
示例#14
0
 public void Dispose()
 {
     if (this.struct66_0.intptr_0 != IntPtr.Zero)
     {
         Class162.waveOutUnprepareHeader(this.intptr_0, ref this.struct66_0, Marshal.SizeOf(this.struct66_0));
         this.gchandle_0.Free();
         this.struct66_0.intptr_0 = IntPtr.Zero;
     }
     this.autoResetEvent_0.Close();
     if (this.gchandle_1.IsAllocated)
     {
         this.gchandle_1.Free();
     }
     GC.SuppressFinalize(this);
 }
示例#15
0
 public void method_7()
 {
     if (this.intptr_0 != IntPtr.Zero)
     {
         this.StopPlaying();
         Class162.waveOutClose(this.intptr_0);
         this.intptr_0 = IntPtr.Zero;
     }
     if (this.class158_0 != null)
     {
         for (int i = 0; i < 5; i++)
         {
             this.class158_0[i].Dispose();
         }
         this.class158_0 = null;
     }
 }
示例#16
0
 public Class158(IntPtr intptr_1, int int_1, GenericAudioStream stream1_1, object object_1)
 {
     this.int_0               = int_1;
     this.class17_0           = new Class17(int_1);
     this.gchandle_0          = GCHandle.Alloc(this.class17_0.method_0(), GCHandleType.Pinned);
     this.intptr_0            = intptr_1;
     this.stream1_0           = stream1_1;
     this.object_0            = object_1;
     this.struct66_0          = default(Struct66);
     this.gchandle_1          = GCHandle.Alloc(this.struct66_0);
     this.struct66_0.intptr_0 = this.gchandle_0.AddrOfPinnedObject();
     this.struct66_0.int_0    = int_1;
     this.struct66_0.int_2    = 1;
     this.gchandle_2          = GCHandle.Alloc(this);
     this.struct66_0.intptr_1 = (IntPtr)this.gchandle_2;
     lock (object_1)
     {
         Exception4.smethod_1(Class162.waveOutPrepareHeader(intptr_1, ref this.struct66_0, Marshal.SizeOf(this.struct66_0)), "waveOutPrepareHeader");
     }
 }
示例#17
0
 public void method_0(GenericAudioStream stream1_1)
 {
     if (Thread.CurrentThread.ManagedThreadId != this.thread_0.ManagedThreadId)
     {
         lock (this.queue_1)
         {
             this.queue_1.Enqueue(new WaveOutput.Class164(WaveOutput.Enum19.const_0, this.stream1_0));
             this.autoResetEvent_0.Set();
         }
         return;
     }
     this.stream1_0 = stream1_1;
     this.int_0     = stream1_1.vmethod_0().method_0(this.int_2 / 5);
     Exception4.smethod_1(Class162.waveOutOpen(out this.intptr_0, this.int_1, this.stream1_0.vmethod_0(), this.delegate4_0, 0, Class162.Enum17.const_3), "waveOutOpen");
     this.stream1_0.Position = (long)this.vmethod_0();
     this.class158_0         = new Class158[5];
     for (int i = 0; i < 5; i++)
     {
         this.class158_0[i] = new Class158(this.intptr_0, this.int_0, this.stream1_0, this.object_0);
     }
     this.bool_0 = false;
 }
示例#18
0
 public void method_0(bool bool_0)
 {
     if (this.gchandle_1.IsAllocated)
     {
         this.gchandle_1.Free();
     }
     if (this.gchandle_0.IsAllocated)
     {
         this.gchandle_0.Free();
     }
     if (this.gchandle_2.IsAllocated)
     {
         this.gchandle_2.Free();
     }
     if (this.intptr_0 != IntPtr.Zero)
     {
         lock (this.object_0)
         {
             Class162.waveOutUnprepareHeader(this.intptr_0, ref this.struct66_0, Marshal.SizeOf(this.struct66_0));
         }
         this.intptr_0 = IntPtr.Zero;
     }
 }
示例#19
0
        public AudioPlayer(int int_0, WaveFormat waveFormat_0, int int_1, float Volume, bool bool_3, Delegate3 delegate3_1) : base()
        {
            WaitCallback waitCallback = null;

            AudioPlayer.VolumeListener volumeListener = new AudioPlayer.VolumeListener();
            volumeListener.Volume = Volume;
            this.delegate4_0      = new Class162.Delegate4(Class165.smethod_0);
            this.object_0         = new object();
            //base..ctor();
            volumeListener.audioPlayer = this;
            this.bool_2      = bool_3;
            this.byte_0      = (byte)((waveFormat_0.short_2 == 8) ? 128 : 0);
            this.delegate3_0 = delegate3_1;
            Exception4.smethod_1(Class162.waveOutOpen(out this.intptr_0, int_0, waveFormat_0, this.delegate4_0, 0, Class162.Enum17.const_3), "waveOutOpen");
            this.method_7(waveFormat_0.method_0(int_1 / 5), 5);
            this.thread_0 = new Thread(new ThreadStart(this.method_6));
            this.SetVolume(0f);
            this.thread_0.Start();
            if (waitCallback == null)
            {
                waitCallback = new WaitCallback(volumeListener.StartListener);
            }
            ThreadPool.QueueUserWorkItem(waitCallback);
        }
示例#20
0
 public void method_4()
 {
     Class162.waveOutPause(this.intptr_0);
 }
示例#21
0
 public void method_3()
 {
     Class162.waveOutRestart(this.intptr_0);
 }
示例#22
0
 public static extern Enum18 waveOutOpen(out IntPtr hWaveOut, int uDeviceID, WaveFormat lpFormat, Class162.Delegate4 dwCallback, int dwInstance, Class162.Enum17 dwFlags);
示例#23
0
 private void method_2(IntPtr intptr_1, Class162.Enum16 enum16_0, int int_4, ref Struct66 struct66_0, int int_5)
 {
     if (enum16_0 == Class162.Enum16.const_1)
     {
         Class158 object_ = (Class158)((GCHandle)struct66_0.intptr_1).Target;
         lock (this.queue_1)
         {
             this.queue_1.Enqueue(new Class163.Class164(Class163.Enum19.const_2, object_));
             this.autoResetEvent_0.Set();
         }
     }
 }