| 
					
				 | 
			
			
				@@ -698,6 +698,8 @@ class PQStuckPointEditerController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         videoExporter.selectedTotalDuration = selectedTotalDuration 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         videoExporter.selectedDataCount = selectedDataCount 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         videoExporter.selectedImageDataCount = selectedImageDataCount 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        videoExporter.finallyUserAudioTime = finallyUserAudioTime 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        videoExporter.clipAudioRange = getClipAudioRange() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 使用深 copy 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let json = projectModel.toJSONString(prettyPrint: false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if json == nil { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -742,6 +744,17 @@ class PQStuckPointEditerController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 2,添加背景音乐 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         projectModel.sData?.addBGM(audioMix: stuckPointMusicData!) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //计算拼接音乐的开始和结束点 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    func getClipAudioRange() ->  CMTimeRange  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //设置音乐的拼接范围,开始:推荐的卡点  结束:点到的倒数第二位 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let lastSecondPoint =   Float((stuckPointMusicData!.rhythmSdata[0].pointTimes[stuckPointMusicData!.rhythmSdata[0].pointTimes.count - 2] )) / Float(BASE_FILTER_TIMESCALE) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let clipAudioRange = 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        CMTimeRange(start: CMTime(value: CMTimeValue( Float(stuckPointMusicData?.startTime ?? 0) * Float(BASE_FILTER_TIMESCALE)), timescale: BASE_FILTER_TIMESCALE), end: CMTime(value: CMTimeValue((Float(lastSecondPoint)) * Float(BASE_FILTER_TIMESCALE)), timescale: BASE_FILTER_TIMESCALE)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return clipAudioRange 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 设置播放器 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     func settingPlayerView() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -820,14 +833,8 @@ class PQStuckPointEditerController: PQBaseViewController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         playerView.stop() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 这里的测试这个音乐播放有问题 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //        self.playerView.updateAsset(URL(fileURLWithPath: "63930549652d74e477141e3b79c8d29a9ef8af81625053214516.mp3", relativeTo:Bundle.main.resourceURL!), videoComposition: nil, audioMixModel: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //设置音乐的拼接范围,开始:推荐的卡点  结束:点到的倒数第二位 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let lastSecondPoint =   Float((stuckPointMusicData!.rhythmSdata[0].pointTimes[stuckPointMusicData!.rhythmSdata[0].pointTimes.count - 2] )) / Float(BASE_FILTER_TIMESCALE) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let clipAudioRange = 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        CMTimeRange(start: CMTime(value: CMTimeValue( Float(stuckPointMusicData?.startTime ?? 0) * Float(BASE_FILTER_TIMESCALE)), timescale: BASE_FILTER_TIMESCALE), end: CMTime(value: CMTimeValue((Float(lastSecondPoint)) * Float(BASE_FILTER_TIMESCALE)), timescale: BASE_FILTER_TIMESCALE)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        playerView.updateAsset(URL(fileURLWithPath: documensDirectory + audioPath), videoComposition: nil, audioMixModel: nil,originMusicDuration:finallyUserAudioTime,clipAudioRange: clipAudioRange) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        playerView.updateAsset(URL(fileURLWithPath: documensDirectory + audioPath), videoComposition: nil, audioMixModel: nil,originMusicDuration:finallyUserAudioTime,clipAudioRange: getClipAudioRange()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let end2: TimeInterval = Date().timeIntervalSince1970 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BFLog(message: "updateAsset tiskskskskme  \(end2 - end)") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1035,81 +1042,7 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else if model == .createStickersModelSpeed{//快慢速 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for section in sections { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if section.sectionType == "normal" { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    BFLog(message: "stuckPoints count is \(finallyStuckPoints.count)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //一共裁剪的段数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    var totalClipNum:Int = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    for sticker in section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if sticker.type == StickerType.VIDEO.rawValue { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            let asset: AVURLAsset = AVURLAsset(url: URL(fileURLWithPath: documensDirectory + sticker.locationPath), options: nil) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            var i:Int = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            //一个视频切的的段落 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            var oneVideoClipNum:Int = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            var realUsedMusicDuration = 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            while realUsedMusicDuration <= CMTimeGetSeconds(asset.duration) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                //快速段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                let LA = maxSpeed * (finallyStuckPoints[i+1] - finallyStuckPoints[i]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                realUsedMusicDuration = realUsedMusicDuration + Float64(LA) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if(realUsedMusicDuration > CMTimeGetSeconds(asset.duration)){ break} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                oneVideoClipNum = oneVideoClipNum + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                //慢速段 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                let LB = minSpeed * (finallyStuckPoints[i+2] - finallyStuckPoints[i+1]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                realUsedMusicDuration = realUsedMusicDuration + Float64(LB) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                oneVideoClipNum = oneVideoClipNum + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                i = i + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            BFLog(message: "单个视频\(sticker.locationPath)时长::\(CMTimeGetSeconds(asset.duration)) ,clipNum is:\(oneVideoClipNum)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            var lastOutTime:Float64 = 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            for clipindex in 0 ... oneVideoClipNum - 1 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                // deep copy sticker model 防止只有一个对象 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                let stickerjson = sticker.toJSONString(prettyPrint: false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                let deepCopySticker = Mapper<PQEditVisionTrackMaterialsModel>().map(JSONString: stickerjson!) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                // 设置循环模式和适配模式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                deepCopySticker?.generateDefaultValues() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                //当前分段的速度 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                var tempSpeed = (totalClipNum + clipindex) % 2 == 0 ? maxSpeed : minSpeed 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if(totalClipNum + 1 + clipindex < finallyStuckPoints.count){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    deepCopySticker?.speedRate = tempSpeed 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                                    deepCopySticker?.model_in = Float64(tempSpeed) * Float64(finallyStuckPoints[totalClipNum + clipindex] - (finallyStuckPoints.first ?? 0.0)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    deepCopySticker?.model_in = lastOutTime 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    deepCopySticker?.out = lastOutTime + Float64(tempSpeed) * Float64(finallyStuckPoints[totalClipNum + 1 + clipindex] - finallyStuckPoints[totalClipNum + clipindex]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    lastOutTime =  deepCopySticker?.out ?? 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    deepCopySticker?.timelineIn =   Float64(finallyStuckPoints[totalClipNum + clipindex]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    deepCopySticker?.timelineOut =    Float64(finallyStuckPoints[totalClipNum + 1 + clipindex]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                BFLog(message: " 创建 sticker crilp is in \(String(format: "%.6f", deepCopySticker?.model_in ?? 0)) out  \(String(format: "%.6f", deepCopySticker?.out ?? 0)) ,分段素材时长:\(String(format: "%.6f", (deepCopySticker?.out ?? 0) - (deepCopySticker?.model_in ?? 0))) ,分段显示时长:\(String(format: "%.6f", (deepCopySticker?.timelineOut ?? 0) - (deepCopySticker?.timelineIn ?? 0))), 总时长\(CMTimeGetSeconds(asset.duration)) timelineIN: \(String(format: "%.6f", deepCopySticker?.timelineIn ?? 0)) timelineOUT:\(String(format: "%.6f", deepCopySticker?.timelineOut ?? 0)) speedRate:\(deepCopySticker?.speedRate ?? 0.0)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                if deepCopySticker != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    stickers.append(deepCopySticker!) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                               
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            totalClipNum = totalClipNum + oneVideoClipNum - 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } else if sticker.type == StickerType.IMAGE.rawValue { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            sticker.generateDefaultValues() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            sticker.timelineIn = Float64(finallyStuckPoints[totalClipNum]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            sticker.timelineOut = Float64(finallyStuckPoints[totalClipNum + 1]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            stickers.append(sticker) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else if model == .createStickersModelOnlyMusic{ //仅音乐 首尾相连播放 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else if (model == .createStickersModelOnlyMusic || model == .createStickersModelSpeed){ //仅音乐 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for section in sections { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if section.sectionType == "normal" { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1150,7 +1083,10 @@ extension PQStuckPointEditerController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 deepCopySticker?.generateDefaultValues() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 //当前分段的速度 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 var tempSpeed:Float = 1.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if model == .createStickersModelSpeed{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    tempSpeed = (totalClipNum + clipindex) % 2 == 0 ? maxSpeed : minSpeed 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                           
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 if(totalClipNum + 1 + clipindex < finallyStuckPoints.count){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     deepCopySticker?.speedRate = tempSpeed 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |