dengsixing 8 月之前
父節點
當前提交
5b1fc94082
共有 1 個文件被更改,包括 26 次插入1 次删除
  1. 26 1
      src/main/java/com/fdkankan/scene/util/TtsUtil.java

+ 26 - 1
src/main/java/com/fdkankan/scene/util/TtsUtil.java

@@ -167,7 +167,7 @@ public class TtsUtil {
         if(speed >= 1.2 && speed < 1.5){
             result = (float) (1 + (speed - 1.2)/(1.5 - 1.2) * (2 - 1));
         }
-        if(speed >= 1.5 && speed < 2.5){
+        if(speed >= 1.5 && speed <= 2.5){
             result = (float) (2 + (speed - 1.5)/(2.5 - 1.5) * (6 - 2));
         }
 
@@ -175,6 +175,31 @@ public class TtsUtil {
 
     }
 
+    public static void main(String[] args) {
+        Float speed = 2.5F;
+
+        Float result = null;
+
+        if(speed >= 0.6 && speed < 0.8){
+            result = (float) (-2 + (speed - 0.6)/(0.8 - 0.6) * ((-1) - (-2)));
+        }
+        if(speed >= 0.8 && speed < 1.0){
+            result = (float) (-1 + (speed - 0.8)/(1.0 - 0.8) * (0 - (-1)));
+        }
+        if(speed >= 1.0 && speed < 1.2){
+            result = (float) (0 + (speed - 1.0)/(1.2 - 1.0) * (1 - 0));
+        }
+        if(speed >= 1.2 && speed < 1.5){
+            result = (float) (1 + (speed - 1.2)/(1.5 - 1.2) * (2 - 1));
+        }
+        if(speed >= 1.5 && speed < 2.5){
+            result = (float) (2 + (speed - 1.5)/(2.5 - 1.5) * (6 - 2));
+        }
+        float aa = new BigDecimal(result).setScale(2, BigDecimal.ROUND_DOWN).floatValue();
+        System.out.println(aa);
+
+    }
+