player/CrossFade: add method IsEnabled()
This commit is contained in:
		| @@ -96,8 +96,8 @@ CrossFadeSettings::Calculate(SignedSongTime total_time, | |||||||
| { | { | ||||||
| 	unsigned int chunks = 0; | 	unsigned int chunks = 0; | ||||||
|  |  | ||||||
| 	if (total_time.IsNegative() || | 	if (!IsEnabled() || | ||||||
| 	    duration <= FloatDuration::zero() || | 	    total_time.IsNegative() || | ||||||
| 	    duration >= std::chrono::duration_cast<FloatDuration>(total_time) || | 	    duration >= std::chrono::duration_cast<FloatDuration>(total_time) || | ||||||
| 	    /* we can't crossfade when the audio formats are different */ | 	    /* we can't crossfade when the audio formats are different */ | ||||||
| 	    af != old_format) | 	    af != old_format) | ||||||
|   | |||||||
| @@ -39,6 +39,10 @@ struct CrossFadeSettings { | |||||||
| 	 */ | 	 */ | ||||||
| 	FloatDuration mixramp_delay{-1}; | 	FloatDuration mixramp_delay{-1}; | ||||||
|  |  | ||||||
|  | 	constexpr bool IsEnabled() const noexcept { | ||||||
|  | 		return duration.count() > 0; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Calculate how many music pipe chunks should be used for crossfading. | 	 * Calculate how many music pipe chunks should be used for crossfading. | ||||||
| 	 * | 	 * | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann