package mapped;

import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import net.runelite.rs.api.RSDecimator;
import net.runelite.rs.api.RSRawSound;

@ObfuscatedName("bt")
public class RawSound extends AbstractSound implements RSRawSound {
   @ObfuscatedName("at")
   public int sampleRate;
   @ObfuscatedName("ah")
   public byte[] samples;
   @ObfuscatedName("ar")
   public int start;
   @ObfuscatedName("ao")
   int end;
   @ObfuscatedName("ab")
   public boolean field250;

   RawSound(int var1, byte[] var2, int var3, int var4) {
      this.sampleRate = var1;
      this.samples = var2;
      this.start = var3;
      this.end = var4;
   }

   RawSound(int var1, byte[] var2, int var3, int var4, boolean var5) {
      this.sampleRate = var1;
      this.samples = var2;
      this.start = var3;
      this.end = var4;
      this.field250 = var5;
   }

   @ObfuscatedName("at")
   @ObfuscatedSignature(
      descriptor = "(Lce;)Lbt;"
   )
   public RawSound method772(Decimator var1) {
      this.samples = var1.resample_base(this.samples);
      this.sampleRate = var1.scaleRate_base(this.sampleRate);
      if(this.start == this.end) {
         this.start = this.end = var1.scalePosition_base(this.start);
      } else {
         this.start = var1.scalePosition_base(this.start);
         this.end = var1.scalePosition_base(this.end);
         if(this.start == this.end) {
            --this.start;
         }
      }

      return this;
   }

   public RSRawSound applyResampler(RSDecimator var1) {
      return this.method772((Decimator)var1);
   }
}
