Browse Source

修改音频合成参数取整问题

Pq 1 year ago
parent
commit
f594bd2db0

+ 3 - 3
musicMerge/src/main/java/com/cooleshow/musicmerge/ui/MusicHandleSettingFragment.java

@@ -42,7 +42,7 @@ import androidx.lifecycle.ViewModelProvider;
  */
 public class MusicHandleSettingFragment extends BaseFragment<FgMusicHandleSettingLayoutBinding> implements View.OnClickListener {
     public static final int MAX_OFFSET_SECTION = 1200;
-    public static final int MIN_OFFSET_SECTION = MAX_OFFSET_SECTION / 10;
+    public static final int MIN_OFFSET_SECTION = MAX_OFFSET_SECTION / 2 / 6 / 5;//这里算出来要是10的整数倍
     public static final int ACCOMPANY_TYPE = 1;
     public static final int RECORD_TYPE = 2;
     private String accompanyUrl;
@@ -238,7 +238,7 @@ public class MusicHandleSettingFragment extends BaseFragment<FgMusicHandleSettin
 
 
     private void changeOffsetValue(boolean isAdd) {
-        int value = isAdd ? MAX_OFFSET_SECTION / MIN_OFFSET_SECTION : -MAX_OFFSET_SECTION / MIN_OFFSET_SECTION;
+        int value = isAdd ? MIN_OFFSET_SECTION : -MIN_OFFSET_SECTION;
         int currentValue = mViewBinding.seekBarOffset.getProgress();
         currentValue += value;
         if (currentValue < 0) {
@@ -400,7 +400,7 @@ public class MusicHandleSettingFragment extends BaseFragment<FgMusicHandleSettin
     }
 
     private boolean roundOffProgress(int progress) {
-        int minSection = MAX_OFFSET_SECTION / MIN_OFFSET_SECTION;
+        int minSection = MIN_OFFSET_SECTION;
         int result = progress % minSection;
         if (result == 0) {
             return true;