import java.awt.Component;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.DataLine.Info;

public class Class206_Sub1 extends Class206 {

   byte[] aByteArray8922;
   AudioFormat anAudioFormat8923;
   int anInt8924;
   boolean aBool8925 = false;
   SourceDataLine aSourceDataLine8926;
   boolean aBool8927 = false;


   boolean method14308() {
      boolean var1 = false;
      if(this.aSourceDataLine8926 != null) {
         Thread var2 = new Thread(new Class195(this));
         var2.start();
         boolean var7 = false;

         try {
            try {
               var7 = true;
               var2.join(2000L);
            } catch (InterruptedException var8) {
               if(this.aSourceDataLine8926 != null) {
                  this.aSourceDataLine8926 = null;
                  this.method3491();
               }

               var1 = true;
               var7 = false;
               return var1;
            }

            if(this.aSourceDataLine8926 != null) {
               this.aSourceDataLine8926 = null;
               this.method3491();
            }

            var1 = true;
            var7 = false;
         } finally {
            if(var7) {
               if(this.aSourceDataLine8926 != null) {
                  this.aSourceDataLine8926 = null;
                  this.method3491();
               }

               var1 = true;
            }
         }
      }

      return var1;
   }

   boolean method14309() {
      boolean var1 = false;
      if(this.aSourceDataLine8926 != null) {
         Thread var2 = new Thread(new Class195(this));
         var2.start();
         boolean var7 = false;

         try {
            try {
               var7 = true;
               var2.join(2000L);
            } catch (InterruptedException var8) {
               if(this.aSourceDataLine8926 != null) {
                  this.aSourceDataLine8926 = null;
                  this.method3491();
               }

               var1 = true;
               var7 = false;
               return var1;
            }

            if(this.aSourceDataLine8926 != null) {
               this.aSourceDataLine8926 = null;
               this.method3491();
            }

            var1 = true;
            var7 = false;
         } finally {
            if(var7) {
               if(this.aSourceDataLine8926 != null) {
                  this.aSourceDataLine8926 = null;
                  this.method3491();
               }

               var1 = true;
            }
         }
      }

      return var1;
   }

   void method3492(int var1) throws LineUnavailableException {
      if(this.aSourceDataLine8926 != null) {
         if(!this.aBool8925) {
            throw new IllegalStateException("");
         }

         if(var1 == this.anInt8924) {
            this.aBool8925 = false;
            return;
         }

         if(!this.method14310()) {
            return;
         }
      }

      try {
         Info var2 = new Info(SourceDataLine.class, this.anAudioFormat8923, var1 << (aBool2441?2:1));
         this.aSourceDataLine8926 = (SourceDataLine)AudioSystem.getLine(var2);
         this.aSourceDataLine8926.open();
         this.aSourceDataLine8926.start();
         this.anInt8924 = var1;
         this.aBool8925 = false;
      } catch (LineUnavailableException var3) {
         if(Class101.method1990(var1, -1937855412) != 1) {
            this.method3492(Class468.method7880(var1, (byte)-51));
         } else {
            this.aBool8925 = true;
            throw var3;
         }
      }
   }

   int method3493() {
      return this.anInt8924 - (this.aSourceDataLine8926.available() >> (aBool2441?2:1));
   }

   void method3535() {
      if(!this.aBool8925) {
         int var1 = 256;
         if(aBool2441) {
            var1 <<= 1;
         }

         for(int var2 = 0; var2 < var1; ++var2) {
            int var3 = this.anIntArray2430[var2];
            if((var3 + 8388608 & -16777216) != 0) {
               var3 = 8388607 ^ var3 >> 31;
            }

            this.aByteArray8922[var2 * 2] = (byte)(var3 >> 8);
            this.aByteArray8922[var2 * 2 + 1] = (byte)(var3 >> 16);
         }

         this.aSourceDataLine8926.write(this.aByteArray8922, 0, var1 << 1);
      }
   }

   boolean method14310() {
      boolean var1 = false;
      if(this.aSourceDataLine8926 != null) {
         Thread var2 = new Thread(new Class195(this));
         var2.start();
         boolean var7 = false;

         try {
            try {
               var7 = true;
               var2.join(2000L);
            } catch (InterruptedException var8) {
               if(this.aSourceDataLine8926 != null) {
                  this.aSourceDataLine8926 = null;
                  this.method3491();
               }

               var1 = true;
               var7 = false;
               return var1;
            }

            if(this.aSourceDataLine8926 != null) {
               this.aSourceDataLine8926 = null;
               this.method3491();
            }

            var1 = true;
            var7 = false;
         } finally {
            if(var7) {
               if(this.aSourceDataLine8926 != null) {
                  this.aSourceDataLine8926 = null;
                  this.method3491();
               }

               var1 = true;
            }
         }
      }

      return var1;
   }

   void method3519() throws LineUnavailableException {
      if(!this.aBool8925) {
         this.aSourceDataLine8926.flush();
         if(this.aBool8927) {
            if(!this.method14310()) {
               return;
            }

            Info var1 = new Info(SourceDataLine.class, this.anAudioFormat8923, this.anInt8924 << (aBool2441?2:1));
            this.aSourceDataLine8926 = (SourceDataLine)AudioSystem.getLine(var1);
            this.aSourceDataLine8926.open();
            this.aSourceDataLine8926.start();
         }

      }
   }

   void method3496(Component var1) {
      javax.sound.sampled.Mixer.Info[] var2 = AudioSystem.getMixerInfo();
      if(var2 != null) {
         javax.sound.sampled.Mixer.Info[] var3 = var2;

         for(int var4 = 0; var4 < var3.length; ++var4) {
            javax.sound.sampled.Mixer.Info var5 = var3[var4];
            if(var5 != null) {
               String var6 = var5.getName();
               if(var6 != null && var6.toLowerCase().indexOf("soundmax") >= 0) {
                  this.aBool8927 = true;
               }
            }
         }
      }

      this.anAudioFormat8923 = new AudioFormat((float)anInt2437, 16, aBool2441?2:1, true, false);
      this.aByteArray8922 = new byte[256 << (aBool2441?2:1)];
   }

   void method3530(int var1) throws LineUnavailableException {
      if(this.aSourceDataLine8926 != null) {
         if(!this.aBool8925) {
            throw new IllegalStateException("");
         }

         if(var1 == this.anInt8924) {
            this.aBool8925 = false;
            return;
         }

         if(!this.method14310()) {
            return;
         }
      }

      try {
         Info var2 = new Info(SourceDataLine.class, this.anAudioFormat8923, var1 << (aBool2441?2:1));
         this.aSourceDataLine8926 = (SourceDataLine)AudioSystem.getLine(var2);
         this.aSourceDataLine8926.open();
         this.aSourceDataLine8926.start();
         this.anInt8924 = var1;
         this.aBool8925 = false;
      } catch (LineUnavailableException var3) {
         if(Class101.method1990(var1, -1937855412) != 1) {
            this.method3492(Class468.method7880(var1, (byte)-91));
         } else {
            this.aBool8925 = true;
            throw var3;
         }
      }
   }

   void method3531(int var1) throws LineUnavailableException {
      if(this.aSourceDataLine8926 != null) {
         if(!this.aBool8925) {
            throw new IllegalStateException("");
         }

         if(var1 == this.anInt8924) {
            this.aBool8925 = false;
            return;
         }

         if(!this.method14310()) {
            return;
         }
      }

      try {
         Info var2 = new Info(SourceDataLine.class, this.anAudioFormat8923, var1 << (aBool2441?2:1));
         this.aSourceDataLine8926 = (SourceDataLine)AudioSystem.getLine(var2);
         this.aSourceDataLine8926.open();
         this.aSourceDataLine8926.start();
         this.anInt8924 = var1;
         this.aBool8925 = false;
      } catch (LineUnavailableException var3) {
         if(Class101.method1990(var1, -1937855412) != 1) {
            this.method3492(Class468.method7880(var1, (byte)-94));
         } else {
            this.aBool8925 = true;
            throw var3;
         }
      }
   }

   void method3514() {
      if(!this.aBool8925) {
         int var1 = 256;
         if(aBool2441) {
            var1 <<= 1;
         }

         for(int var2 = 0; var2 < var1; ++var2) {
            int var3 = this.anIntArray2430[var2];
            if((var3 + 8388608 & -16777216) != 0) {
               var3 = 8388607 ^ var3 >> 31;
            }

            this.aByteArray8922[var2 * 2] = (byte)(var3 >> 8);
            this.aByteArray8922[var2 * 2 + 1] = (byte)(var3 >> 16);
         }

         this.aSourceDataLine8926.write(this.aByteArray8922, 0, var1 << 1);
      }
   }

   void method3495(boolean var1) {
      if(var1) {
         this.method14310();
      } else {
         try {
            this.method3519();
         } catch (LineUnavailableException var3) {
            ;
         }

         this.aBool8925 = true;
      }
   }

   void method3526(Component var1) {
      javax.sound.sampled.Mixer.Info[] var2 = AudioSystem.getMixerInfo();
      if(var2 != null) {
         javax.sound.sampled.Mixer.Info[] var3 = var2;

         for(int var4 = 0; var4 < var3.length; ++var4) {
            javax.sound.sampled.Mixer.Info var5 = var3[var4];
            if(var5 != null) {
               String var6 = var5.getName();
               if(var6 != null && var6.toLowerCase().indexOf("soundmax") >= 0) {
                  this.aBool8927 = true;
               }
            }
         }
      }

      this.anAudioFormat8923 = new AudioFormat((float)anInt2437, 16, aBool2441?2:1, true, false);
      this.aByteArray8922 = new byte[256 << (aBool2441?2:1)];
   }

   int method3532() {
      return this.anInt8924 - (this.aSourceDataLine8926.available() >> (aBool2441?2:1));
   }

   void method3536() {
      if(!this.aBool8925) {
         int var1 = 256;
         if(aBool2441) {
            var1 <<= 1;
         }

         for(int var2 = 0; var2 < var1; ++var2) {
            int var3 = this.anIntArray2430[var2];
            if((var3 + 8388608 & -16777216) != 0) {
               var3 = 8388607 ^ var3 >> 31;
            }

            this.aByteArray8922[var2 * 2] = (byte)(var3 >> 8);
            this.aByteArray8922[var2 * 2 + 1] = (byte)(var3 >> 16);
         }

         this.aSourceDataLine8926.write(this.aByteArray8922, 0, var1 << 1);
      }
   }

   void method3537(boolean var1) {
      if(var1) {
         this.method14310();
      } else {
         try {
            this.method3519();
         } catch (LineUnavailableException var3) {
            ;
         }

         this.aBool8925 = true;
      }
   }

   void method3538() throws LineUnavailableException {
      if(!this.aBool8925) {
         this.aSourceDataLine8926.flush();
         if(this.aBool8927) {
            if(!this.method14310()) {
               return;
            }

            Info var1 = new Info(SourceDataLine.class, this.anAudioFormat8923, this.anInt8924 << (aBool2441?2:1));
            this.aSourceDataLine8926 = (SourceDataLine)AudioSystem.getLine(var1);
            this.aSourceDataLine8926.open();
            this.aSourceDataLine8926.start();
         }

      }
   }

   void method3505() throws LineUnavailableException {
      if(!this.aBool8925) {
         this.aSourceDataLine8926.flush();
         if(this.aBool8927) {
            if(!this.method14310()) {
               return;
            }

            Info var1 = new Info(SourceDataLine.class, this.anAudioFormat8923, this.anInt8924 << (aBool2441?2:1));
            this.aSourceDataLine8926 = (SourceDataLine)AudioSystem.getLine(var1);
            this.aSourceDataLine8926.open();
            this.aSourceDataLine8926.start();
         }

      }
   }

   void method3541() throws LineUnavailableException {
      if(!this.aBool8925) {
         this.aSourceDataLine8926.flush();
         if(this.aBool8927) {
            if(!this.method14310()) {
               return;
            }

            Info var1 = new Info(SourceDataLine.class, this.anAudioFormat8923, this.anInt8924 << (aBool2441?2:1));
            this.aSourceDataLine8926 = (SourceDataLine)AudioSystem.getLine(var1);
            this.aSourceDataLine8926.open();
            this.aSourceDataLine8926.start();
         }

      }
   }

   void method3542() throws LineUnavailableException {
      if(!this.aBool8925) {
         this.aSourceDataLine8926.flush();
         if(this.aBool8927) {
            if(!this.method14310()) {
               return;
            }

            Info var1 = new Info(SourceDataLine.class, this.anAudioFormat8923, this.anInt8924 << (aBool2441?2:1));
            this.aSourceDataLine8926 = (SourceDataLine)AudioSystem.getLine(var1);
            this.aSourceDataLine8926.open();
            this.aSourceDataLine8926.start();
         }

      }
   }

   int method3533() {
      return this.anInt8924 - (this.aSourceDataLine8926.available() >> (aBool2441?2:1));
   }

   void method3543() throws LineUnavailableException {
      if(!this.aBool8925) {
         this.aSourceDataLine8926.flush();
         if(this.aBool8927) {
            if(!this.method14310()) {
               return;
            }

            Info var1 = new Info(SourceDataLine.class, this.anAudioFormat8923, this.anInt8924 << (aBool2441?2:1));
            this.aSourceDataLine8926 = (SourceDataLine)AudioSystem.getLine(var1);
            this.aSourceDataLine8926.open();
            this.aSourceDataLine8926.start();
         }

      }
   }

   void method3540() throws LineUnavailableException {
      if(!this.aBool8925) {
         this.aSourceDataLine8926.flush();
         if(this.aBool8927) {
            if(!this.method14310()) {
               return;
            }

            Info var1 = new Info(SourceDataLine.class, this.anAudioFormat8923, this.anInt8924 << (aBool2441?2:1));
            this.aSourceDataLine8926 = (SourceDataLine)AudioSystem.getLine(var1);
            this.aSourceDataLine8926.open();
            this.aSourceDataLine8926.start();
         }

      }
   }

   void method3494() {
      if(!this.aBool8925) {
         int var1 = 256;
         if(aBool2441) {
            var1 <<= 1;
         }

         for(int var2 = 0; var2 < var1; ++var2) {
            int var3 = this.anIntArray2430[var2];
            if((var3 + 8388608 & -16777216) != 0) {
               var3 = 8388607 ^ var3 >> 31;
            }

            this.aByteArray8922[var2 * 2] = (byte)(var3 >> 8);
            this.aByteArray8922[var2 * 2 + 1] = (byte)(var3 >> 16);
         }

         this.aSourceDataLine8926.write(this.aByteArray8922, 0, var1 << 1);
      }
   }
}
