mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 10:20:04 +00:00 
			
		
		
		
	Add short delay at the end of a loop
This commit is contained in:
		
							parent
							
								
									ba1de683fa
								
							
						
					
					
						commit
						5970eaf678
					
				
					 1 changed files with 21 additions and 8 deletions
				
			
		|  | @ -261,25 +261,38 @@ void TimelineManager::Impl::Play() | ||||||
|          // Determine loop start time and current position in the loop
 |          // Determine loop start time and current position in the loop
 | ||||||
|          std::chrono::system_clock::time_point startTime = endTime - loopTime_; |          std::chrono::system_clock::time_point startTime = endTime - loopTime_; | ||||||
|          std::chrono::system_clock::time_point currentTime = selectedTime_; |          std::chrono::system_clock::time_point currentTime = selectedTime_; | ||||||
| 
 |          std::chrono::system_clock::time_point newTime; | ||||||
|          // Unlock prior to selecting time
 |  | ||||||
|          lock.unlock(); |  | ||||||
| 
 | 
 | ||||||
|          if (currentTime < startTime || currentTime >= endTime) |          if (currentTime < startTime || currentTime >= endTime) | ||||||
|          { |          { | ||||||
|             // If the currently selected time is out of the loop, select the
 |             // If the currently selected time is out of the loop, select the
 | ||||||
|             // start time
 |             // start time
 | ||||||
|             SelectTime(startTime); |             newTime = startTime; | ||||||
|          } |          } | ||||||
|          else |          else | ||||||
|          { |          { | ||||||
|             // If the currently selected time is in the loop, increment
 |             // If the currently selected time is in the loop, increment
 | ||||||
|             SelectTime(currentTime + 1min); |             newTime = currentTime + 1min; | ||||||
|          } |          } | ||||||
| 
 | 
 | ||||||
|          // Determine repeat interval (loop speed of 1.0 is 1 minute per second)
 |          // Unlock prior to selecting time
 | ||||||
|          std::chrono::milliseconds interval = |          lock.unlock(); | ||||||
|  | 
 | ||||||
|  |          // Select the time
 | ||||||
|  |          SelectTime(newTime); | ||||||
|  | 
 | ||||||
|  |          std::chrono::milliseconds interval; | ||||||
|  |          if (newTime != endTime) | ||||||
|  |          { | ||||||
|  |             // Determine repeat interval (speed of 1.0 is 1 minute per second)
 | ||||||
|  |             interval = | ||||||
|                std::chrono::milliseconds(std::lroundl(1000.0 / loopSpeed_)); |                std::chrono::milliseconds(std::lroundl(1000.0 / loopSpeed_)); | ||||||
|  |          } | ||||||
|  |          else | ||||||
|  |          { | ||||||
|  |             // Pause for 2.5 seconds at the end of the loop
 | ||||||
|  |             interval = std::chrono::milliseconds(2500); | ||||||
|  |          } | ||||||
| 
 | 
 | ||||||
|          std::unique_lock animationTimerLock {animationTimerMutex_}; |          std::unique_lock animationTimerLock {animationTimerMutex_}; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat