Browse Source

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

Pq 1 year ago
parent
commit
a18281d55b

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

@@ -42,6 +42,7 @@ import androidx.lifecycle.ViewModelProvider;
  */
 public class MusicHandleSettingFragment extends BaseFragment<FgMusicHandleSettingLayoutBinding> implements View.OnClickListener {
     public static final int MAX_OFFSET_SECTION = 1000;
+    public static final int MIN_OFFSET_SECTION = MAX_OFFSET_SECTION / 10;
     public static final int ACCOMPANY_TYPE = 1;
     public static final int RECORD_TYPE = 2;
     private String accompanyUrl;
@@ -237,7 +238,7 @@ public class MusicHandleSettingFragment extends BaseFragment<FgMusicHandleSettin
 
 
     private void changeOffsetValue(boolean isAdd) {
-        int value = isAdd ? MAX_OFFSET_SECTION / 60 : -MAX_OFFSET_SECTION / 60;
+        int value = isAdd ? MAX_OFFSET_SECTION / MIN_OFFSET_SECTION : -MAX_OFFSET_SECTION / MIN_OFFSET_SECTION;
         int currentValue = mViewBinding.seekBarOffset.getProgress();
         currentValue += value;
         if (currentValue < 0) {
@@ -289,7 +290,7 @@ public class MusicHandleSettingFragment extends BaseFragment<FgMusicHandleSettin
         coverTipDialog.setEventListener(new UploadCoverTipDialog.OnEventListener() {
             @Override
             public void onUploadCover() {
-                toAlbum(1,1,MusicHandleActivity.REQUEST_CODE_LOCAL);
+                toAlbum(1, 1, MusicHandleActivity.REQUEST_CODE_LOCAL);
             }
 
             @Override
@@ -301,7 +302,7 @@ public class MusicHandleSettingFragment extends BaseFragment<FgMusicHandleSettin
             @Override
             public void onSelectVideoCover(boolean isByAlbum) {
                 if (isByAlbum) {
-                    toAlbum(16,9,MusicHandleActivity.REQUEST_CODE_LOCAL_VIDEO_COVER);
+                    toAlbum(16, 9, MusicHandleActivity.REQUEST_CODE_LOCAL_VIDEO_COVER);
                 } else {
                     String value = mViewModel.getVideoFilePath().getValue();
                     ARouter.getInstance().build(RouterPath.MusicTuner.MUSIC_SELECT_VIDEO_FRAME)
@@ -314,21 +315,21 @@ public class MusicHandleSettingFragment extends BaseFragment<FgMusicHandleSettin
         coverTipDialog.show(getChildFragmentManager(), "");
     }
 
-    private void toAlbum(int aspect_ratio_x, int aspect_ratio_y,int requestCode) {
+    private void toAlbum(int aspect_ratio_x, int aspect_ratio_y, int requestCode) {
         new RxPermissions(this)
                 .request(Manifest.permission.CAMERA,
                         Manifest.permission.READ_EXTERNAL_STORAGE,
                         Manifest.permission.WRITE_EXTERNAL_STORAGE)
                 .subscribe(granted -> {
                     if (granted) {
-                        goAlbum(aspect_ratio_x,aspect_ratio_y,requestCode);
+                        goAlbum(aspect_ratio_x, aspect_ratio_y, requestCode);
                     } else {
                         ToastUtil.getInstance().show(getContext(), "请打开存储和相机权限!");
                     }
                 });
     }
 
-    private void goAlbum(int aspect_ratio_x, int aspect_ratio_y,int requestCode) {
+    private void goAlbum(int aspect_ratio_x, int aspect_ratio_y, int requestCode) {
         PictureSelector.create(getActivity())
                 .openGallery(PictureMimeType.ofImage())//全部.PictureMimeType.ofAll()、图片.ofImage()、视频.ofVideo()、音频.ofAudio()
                 .loadImageEngine(GlideEngine.createGlideEngine())
@@ -399,7 +400,7 @@ public class MusicHandleSettingFragment extends BaseFragment<FgMusicHandleSettin
     }
 
     private boolean roundOffProgress(int progress) {
-        int minSection = MAX_OFFSET_SECTION / 60;
+        int minSection = MAX_OFFSET_SECTION / MIN_OFFSET_SECTION;
         int result = progress % minSection;
         if (result == 0) {
             return true;