Пример #1
0
        public static Class16 smethod_0(GenericAudioStream stream1_0, Stream stream_1, int int_3, int int_4)
        {
            WaveFormat waveFormat = stream1_0.vmethod_0();

            if (waveFormat.waveFormatTag_0 != WaveFormatTag.PCM || waveFormat.short_2 != 16)
            {
                stream1_0  = new Stream4(stream1_0, 16);
                waveFormat = stream1_0.vmethod_0();
            }
            Stream16 stream = new Stream16(stream_1, waveFormat, (waveFormat.int_0 == int_3) ? new BE_CONFIG(waveFormat, (uint)int_4) : new BE_CONFIG(waveFormat, (uint)int_4, (uint)int_3));
            uint     uint_  = (uint)stream.vmethod_1().Position;

            byte[]  array = new byte[stream.method_0() * 2];
            Class16 result;

            try
            {
                int count;
                while ((count = stream1_0.Read(array, 0, array.Length)) > 0)
                {
                    stream.Write(array, 0, count);
                }
                result = new Class16(new WaveFormat(int_3, (int)waveFormat.short_0), uint_, (uint)stream.vmethod_1().Length, int_4 * 1000);
            }
            finally
            {
                stream.method_1();
            }
            return(result);
        }
Пример #2
0
        public static Class16 smethod_0(GenericAudioStream stream10, Stream stream1, int int3, int int4)
        {
            var waveFormat = stream10.vmethod_0();

            if (waveFormat.waveFormatTag_0 != WaveFormatTag.Pcm || waveFormat.short_2 != 16)
            {
                stream10   = new Stream4(stream10, 16);
                waveFormat = stream10.vmethod_0();
            }
            var stream = new Stream16(stream1, waveFormat,
                                      (waveFormat.int_0 == int3)
                    ? new BeConfig(waveFormat, (uint)int4)
                    : new BeConfig(waveFormat, (uint)int4, (uint)int3));
            var     uint_ = (uint)stream.vmethod_1().Position;
            var     array = new byte[stream.method_0() * 2];
            Class16 result;

            try
            {
                int count;
                while ((count = stream10.Read(array, 0, array.Length)) > 0)
                {
                    stream.Write(array, 0, count);
                }
                result = new Class16(new WaveFormat(int3, waveFormat.short_0), uint_, (uint)stream.vmethod_1().Length,
                                     int4 * 1000);
            }
            finally
            {
                stream.method_1();
            }
            return(result);
        }
Пример #3
0
 public OggOutput(GenericAudioStream stream11, Device device1, int int5)
 {
     _stream10 = new Stream4(stream11, 16);
     _int1     = _stream10.vmethod_0().method_0(int5);
     _int1    -= _int1 % 5;
     _int0     = _int1 / 5;
     _double0  = _stream10.vmethod_0().int_0 *(double)_stream10.vmethod_0().short_1 / 1000.0;
     _byte0    = new byte[_int0];
     _device0  = device1;
     if (_device0 == null)
     {
         _device0 = new Device();
         _device0.SetCooperativeLevel(GetDesktopWindow(), CooperativeLevel.Normal);
         _bool0 = true;
     }
     _secondaryBuffer0 = new SecondaryBuffer(new BufferDescription
     {
         BufferBytes           = _int1,
         ControlPositionNotify = true,
         CanGetCurrentPosition = true,
         ControlVolume         = true,
         GlobalFocus           = true,
         StickyFocus           = true,
         Format = smethod_0(_stream10.vmethod_0())
     }, _device0);
     _secondaryBuffer0.SetCurrentPosition(0);
     _int2 = 0;
     _secondaryBuffer0.Volume = 0;
     _autoResetEvent0         = new AutoResetEvent(false);
     _bufferPositionNotify1[0].EventNotifyHandle = _autoResetEvent0.Handle;
     _enum10 = AudioStatus.ShouldStopAudio;
 }
Пример #4
0
 public OGGOutput(GenericAudioStream stream1_1, Device device_1, int int_5)
 {
     this.stream1_0 = new Stream4(stream1_1, 16);
     this.int_1     = this.stream1_0.vmethod_0().method_0(int_5);
     this.int_1    -= this.int_1 % 5;
     this.int_0     = this.int_1 / 5;
     this.double_0  = (double)this.stream1_0.vmethod_0().int_0 *(double)this.stream1_0.vmethod_0().short_1 / 1000.0;
     this.byte_0    = new byte[this.int_0];
     this.device_0  = device_1;
     if (this.device_0 == null)
     {
         this.device_0 = new Device();
         this.device_0.SetCooperativeLevel(OGGOutput.GetDesktopWindow(), CooperativeLevel.Normal);
         this.bool_0 = true;
     }
     this.secondaryBuffer_0 = new SecondaryBuffer(new BufferDescription
     {
         BufferBytes           = this.int_1,
         ControlPositionNotify = true,
         CanGetCurrentPosition = true,
         ControlVolume         = true,
         GlobalFocus           = true,
         StickyFocus           = true,
         Format = OGGOutput.smethod_0(this.stream1_0.vmethod_0())
     }, this.device_0);
     this.secondaryBuffer_0.SetCurrentPosition(0);
     this.int_2 = 0;
     this.secondaryBuffer_0.Volume = 0;
     this.autoResetEvent_0         = new AutoResetEvent(false);
     this.bufferPositionNotify_1[0].EventNotifyHandle = this.autoResetEvent_0.Handle;
     this.enum1_0 = AudioStatus.ShouldStopAudio;
 }
Пример #5
0
        public static IPlayableAudio LoadPlayableAudio(Enum25 enum250, GenericAudioStream audioStream)
        {
            switch (enum250)
            {
            case Enum25.Const1:
                return(new WaveOutput(audioStream));

            case Enum25.Const2:
                return(new Mp3Output(audioStream));

            case Enum25.Const3:
                return(new WaveOutput(audioStream));

            case Enum25.Const5:
                return(new WaveOutput(audioStream));
            }
            var flag     = Type.GetType("Mono.Runtime") != null;
            var platform = (int)Environment.OSVersion.Platform;

            switch (platform)
            {
            case 0:
            case 1:
            case 2:
            case 3:
            {
                IPlayableAudio result;
                try
                {
                    result = new WaveOutput(audioStream);
                }
                catch
                {
                    result = new OggOutput(audioStream);
                }
                return(result);
            }

            case 4:
            case 6:
                goto IL_F4;

            case 5:
                break;

            default:
                if (platform == 128)
                {
                    goto IL_F4;
                }
                break;
            }
            throw new PlatformNotSupportedException(string.Concat(flag ? "" : "Not ", "Running Mono. PlatformID: ",
                                                                  (int)Environment.OSVersion.Platform, " | ", Environment.OSVersion.Platform));
IL_F4:
            return(new Class117(audioStream));
        }
Пример #6
0
        public static Class16 smethod_2(string string_0)
        {
            Class16 result;

            using (GenericAudioStream stream = AudioManager.getAudioStream(string_0))
            {
                result = stream.vmethod_1();
            }
            return(result);
        }
Пример #7
0
 public Class117(GenericAudioStream stream11)
 {
     _stream10  = stream11;
     _class1200 = (Class120.smethod_2() ?? new Class120());
     _enum120   = Class119.smethod_10(stream11.vmethod_0());
     _int0      = stream11.vmethod_0().int_0;
     _double0   = stream11.vmethod_0().int_0 *(double)stream11.vmethod_0().short_1 / 1000.0;
     _int1      = stream11.vmethod_0().method_0(80);
     _int2      = 5;
     _intptr0   = Marshal.AllocHGlobal(_int1);
     _intptr1   = Class119.smethod_2();
     _intptr2   = Class119.smethod_8(_int2);
     _enum10    = AudioStatus.ShouldStopAudio;
 }
Пример #8
0
 public Class117(GenericAudioStream stream1_1)
 {
     this.stream1_0  = stream1_1;
     this.class120_0 = (Class120.smethod_2() ?? new Class120());
     this.enum12_0   = Class119.smethod_10(stream1_1.vmethod_0());
     this.int_0      = stream1_1.vmethod_0().int_0;
     this.double_0   = (double)stream1_1.vmethod_0().int_0 *(double)stream1_1.vmethod_0().short_1 / 1000.0;
     this.int_1      = stream1_1.vmethod_0().method_0(80);
     this.int_2      = 5;
     this.intptr_0   = Marshal.AllocHGlobal(this.int_1);
     this.intptr_1   = Class119.smethod_2();
     this.intptr_2   = Class119.smethod_8(this.int_2);
     this.enum1_0    = AudioStatus.ShouldStopAudio;
 }
Пример #9
0
 public void method_1(bool bool_1)
 {
     this.StopPlaying();
     if (bool_1 && this.stream1_0 != null)
     {
         try
         {
             this.stream1_0.Dispose();
         }
         finally
         {
             this.stream1_0 = null;
         }
     }
 }
Пример #10
0
 public void method_1(bool bool1)
 {
     StopPlaying();
     if (bool1 && _stream10 != null)
     {
         try
         {
             _stream10.Dispose();
         }
         finally
         {
             _stream10 = null;
         }
     }
 }
Пример #11
0
 public WaveOutput(GenericAudioStream stream1_1, int int_4, int int_5)
 {
     this.stream1_0        = stream1_1;
     this.int_1            = int_4;
     this.int_2            = int_5;
     this.double_0         = (double)stream1_1.vmethod_0().int_0 *(double)stream1_1.vmethod_0().short_1 / 1000.0;
     this.delegate4_0      = new Class162.Delegate4(this.method_2);
     this.queue_1          = new Queue <WaveOutput.Class164>();
     this.queue_0          = new Queue <Class158>(5);
     this.autoResetEvent_0 = new AutoResetEvent(false);
     this.object_0         = new object();
     this.thread_0         = new Thread(new ThreadStart(this.method_1));
     this.thread_0.Start();
     this.enum1_0 = AudioStatus.ShouldStopAudio;
     this.method_0(stream1_1);
 }
Пример #12
0
 public MP3Output(GenericAudioStream stream1_1, bool bool_1)
 {
     if (stream1_1.Length <= 0L)
     {
         throw new Exception("WinMM2Player: Invalid Stream.");
     }
     this.class16_0 = stream1_1.vmethod_1();
     if (this.class16_0.waveFormat_0.waveFormatTag_0 != WaveFormatTag.PCM && this.class16_0.waveFormat_0.waveFormatTag_0 != WaveFormatTag.IEEEFloat)
     {
         throw new Exception("WinMM2Player: Only PCM is supported.");
     }
     this.stream1_0 = stream1_1;
     this.bool_0    = bool_1;
     this.SetStartingTimeBasedOnSomeValue(0);
     this.enum1_0 = AudioStatus.ShouldStopAudio;
 }
Пример #13
0
 public WaveOutput(GenericAudioStream stream11, int int4, int int5)
 {
     _stream10        = stream11;
     _int1            = int4;
     _int2            = int5;
     _double0         = stream11.vmethod_0().int_0 *(double)stream11.vmethod_0().short_1 / 1000.0;
     _delegate40      = method_2;
     _queue1          = new Queue <Class164>();
     _queue0          = new Queue <Class158>(5);
     _autoResetEvent0 = new AutoResetEvent(false);
     _object0         = new object();
     _thread0         = new Thread(method_1);
     _thread0.Start();
     _enum10 = AudioStatus.ShouldStopAudio;
     method_0(stream11);
 }
Пример #14
0
 public Mp3Output(GenericAudioStream stream11, bool bool1)
 {
     if (stream11.Length <= 0L)
     {
         throw new Exception("WinMM2Player: Invalid Stream.");
     }
     _class160 = stream11.vmethod_1();
     if (_class160.WaveFormat0.waveFormatTag_0 != WaveFormatTag.Pcm &&
         _class160.WaveFormat0.waveFormatTag_0 != WaveFormatTag.IeeeFloat)
     {
         throw new Exception("WinMM2Player: Only PCM is supported.");
     }
     _stream10 = stream11;
     _bool0    = bool1;
     SetStartingTimeBasedOnSomeValue(0);
     _enum10 = AudioStatus.ShouldStopAudio;
 }
Пример #15
0
        public bool method_1()
        {
            int num;

            lock (this.stream1_0)
            {
                GenericAudioStream arg_39_0 = this.stream1_0;
                IntPtr             arg_39_1 = this.struct66_0.intptr_0;
                int int_;
                this.class17_0.method_4(int_ = this.class17_0.method_0().Length);
                num = arg_39_0.vmethod_3(arg_39_1, int_);
            }
            if (num == 0)
            {
                return(false);
            }
            Array.Clear(this.class17_0.method_0(), num, this.class17_0.method_3() - num);
            this.method_4();
            return(true);
        }
Пример #16
0
 public Stream3(GenericAudioStream stream1_1, long long_3, long long_4) : this(stream1_1)
 {
     if (0L > long_3)
     {
         throw new ArgumentException("Start Offset is out of range.");
     }
     if (stream1_1.Length < long_4)
     {
         throw new ArgumentException("End Offset is out of range.");
     }
     if (long_3 >= long_4)
     {
         throw new ArgumentException("Start/End Offset are out of range.");
     }
     this.long_1 = long_4 - long_3;
     Stream arg_63_0 = this.stream1_0;
     this.long_0       = long_3;
     this.long_2       = long_3;
     arg_63_0.Position = long_3;
 }
Пример #17
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");
     }
 }
Пример #18
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");
     }
 }
Пример #19
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;
 }
Пример #20
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;
 }
Пример #21
0
        public FSBStream(FSBClass1 class167_0)
        {
            switch (class167_0.method_33().Count)
            {
            case 0:
                throw new Exception5("FSB Stream: No subfiles.");

            case 1:
                this.fileStream = (this.stream1_0 = FSBStream.smethod_0(class167_0.method_33()[0]));
                break;

            default:
            {
                List <GenericAudioStream> list = new List <GenericAudioStream>();
                foreach (Class168 current in class167_0.method_33())
                {
                    list.Add(FSBStream.smethod_0(current));
                }
                this.fileStream = (this.stream1_0 = new Stream2(list.ToArray()));
                break;
            }
            }
            this.waveFormat_0 = this.stream1_0.vmethod_0();
        }
Пример #22
0
 public Mp3Output(GenericAudioStream stream11) : this(stream11, false)
 {
 }
Пример #23
0
 public WaveOutput(GenericAudioStream stream11) : this(stream11, -1, 300)
 {
 }
Пример #24
0
 private Stream3(GenericAudioStream stream1_1)
 {
     this.stream1_0    = stream1_1;
     this.fileStream   = stream1_1;
     this.waveFormat_0 = stream1_1.vmethod_0();
 }
Пример #25
0
        public Stream4(GenericAudioStream stream1_1, int int_4)
        {
            this.stream1_0    = stream1_1;
            this.fileStream   = stream1_1;
            this.waveFormat_0 = stream1_1.vmethod_0();
            this.int_3        = int_4 + 7 >> 3;
            this.int_2        = this.waveFormat_0.short_2 + 7 >> 3;
            this.bool_1       = (this.waveFormat_0.waveFormatTag_0 == WaveFormatTag.IEEEFloat);
            this.bool_0       = (this.waveFormat_0.waveFormatTag_0 != WaveFormatTag.PCM || this.int_2 != this.int_3);
            if (!this.bool_0)
            {
                this.delegate1_0 = new Stream4.Delegate1(this.stream1_0.Read);
                this.long_0      = stream1_1.Length;
                return;
            }
            this.waveFormat_0 = new WaveFormat(stream1_1.vmethod_0().int_0, int_4, (int)stream1_1.vmethod_0().short_0);
            this.double_0     = (double)this.int_3 / (double)this.int_2;
            this.long_0       = (long)((double)stream1_1.Length * this.double_0);
            if (!this.bool_1)
            {
                switch (this.int_3)
                {
                case 1:
                    switch (this.int_2)
                    {
                    case 2:
                        this.delegate1_0 = new Stream4.Delegate1(this.method_2);
                        return;

                    case 3:
                        this.delegate1_0 = new Stream4.Delegate1(this.method_1);
                        return;

                    case 4:
                        this.delegate1_0 = new Stream4.Delegate1(this.method_0);
                        return;

                    default:
                        return;
                    }
                    break;

                case 2:
                    switch (this.int_2)
                    {
                    case 1:
                        this.delegate0_0 = new Stream4.Delegate0(Stream4.smethod_8);
                        break;

                    case 3:
                        this.delegate0_0 = new Stream4.Delegate0(Stream4.smethod_7);
                        break;

                    case 4:
                        this.delegate0_0 = new Stream4.Delegate0(Stream4.smethod_6);
                        break;
                    }
                    break;

                case 3:
                    switch (this.int_2)
                    {
                    case 1:
                        this.delegate0_0 = new Stream4.Delegate0(Stream4.smethod_5);
                        break;

                    case 2:
                        this.delegate0_0 = new Stream4.Delegate0(Stream4.smethod_4);
                        break;

                    case 4:
                        this.delegate0_0 = new Stream4.Delegate0(Stream4.smethod_3);
                        break;
                    }
                    break;

                case 4:
                    switch (this.int_2)
                    {
                    case 1:
                        this.delegate0_0 = new Stream4.Delegate0(Stream4.smethod_2);
                        break;

                    case 2:
                        this.delegate0_0 = new Stream4.Delegate0(Stream4.smethod_1);
                        break;

                    case 3:
                        this.delegate0_0 = new Stream4.Delegate0(Stream4.smethod_0);
                        break;
                    }
                    break;
                }
                this.delegate1_0 = new Stream4.Delegate1(this.method_3);
                return;
            }
            switch (this.int_3)
            {
            case 1:
                this.delegate1_0 = new Stream4.Delegate1(this.method_7);
                return;

            case 2:
                this.delegate1_0 = new Stream4.Delegate1(this.method_6);
                return;

            case 3:
                this.delegate1_0 = new Stream4.Delegate1(this.method_5);
                return;

            case 4:
                this.delegate1_0 = new Stream4.Delegate1(this.method_4);
                return;

            default:
                return;
            }
        }
Пример #26
0
 public OggOutput(GenericAudioStream stream11) : this(stream11, null, 500)
 {
 }
Пример #27
0
 public Stream3(GenericAudioStream stream1_1, TimeSpan timeSpan_0, TimeSpan timeSpan_1) : this(stream1_1, (long)Convert.ToInt32((double)(stream1_1.vmethod_0().int_0 *(int)stream1_1.vmethod_0().short_1) * timeSpan_0.TotalSeconds), (long)Convert.ToInt32((double)(stream1_1.vmethod_0().int_0 *(int)stream1_1.vmethod_0().short_1) * timeSpan_1.TotalSeconds))
 {
 }
Пример #28
0
 public OGGOutput(GenericAudioStream stream1_1) : this(stream1_1, null, 500)
 {
 }
Пример #29
0
 public MP3Output(GenericAudioStream stream1_1) : this(stream1_1, false)
 {
 }