Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase limit on playback speed to 5.0 #1645

Merged
merged 16 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class EffectsFragment : BaseDialogFragment(), CompoundButton.OnCheckedChangeList
val binding = binding ?: return

// val speed = (amount.clipToRange(0.5, 3.0) * 10.0).toInt() / 10.0
val speed = round(amount.clipToRange(0.5, 3.0) * 10.0) / 10.0
val speed = round(amount.clipToRange(0.5, 5.0) * 10.0) / 10.0
effects.playbackSpeed = speed
updatedSpeed = speed
binding.playbackSpeedString = String.format("%.1fx", effects.playbackSpeed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class PodcastEffectsViewModel

private fun changePlaybackSpeed(speed: Double) {
val podcast = this.podcast.value ?: return
val clippedToRangeSpeed = speed.clipToRange(0.5, 3.0)
val clippedToRangeSpeed = speed.clipToRange(0.5, 5.0)
// to stop the issue 1.2000000000000002
val roundedSpeed = round(clippedToRangeSpeed * 10.0) / 10.0
podcastManager.updatePlaybackSpeed(podcast, roundedSpeed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ViewModelConfigControlPlayback @Inject constructor(
InputField(LR.string.time_to_skip_to_seconds, IR.drawable.filter_time, InputControlPlayback.PlaybackCommand.SkipToTime, { skipToSeconds }, { skipToSeconds = it }),
InputField(LR.string.time_to_skip_seconds, IR.drawable.filter_time, listOf(InputControlPlayback.PlaybackCommand.SkipForward, InputControlPlayback.PlaybackCommand.SkipBack), { skipSeconds }, { skipSeconds = it }),
object : InputField<Double>(LR.string.playback_speed_between_values, R.drawable.speedometer, InputControlPlayback.PlaybackCommand.SetPlaybackSpeed, { playbackSpeed }, { playbackSpeed = it }) {
override fun getPossibleValues() = MutableStateFlow((5..30).map { it / 10.0 })
override fun getPossibleValues() = MutableStateFlow((5..50).map { it / 10.0 })
},
object : InputField<TrimMode>(LR.string.trim_silence_mode, R.drawable.content_cut, InputControlPlayback.PlaybackCommand.SetTrimSilenceMode, { trimSilenceMode }, { trimSilenceMode = it }) {
override fun getPossibleValues() = MutableStateFlow(TrimMode.values().toList())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class EffectsViewModel
private fun changePlaybackSpeed(speed: Double) {
val currentState = state.value as? State.Loaded ?: return
val effects = currentState.playbackEffects
val clippedToRangeSpeed = speed.clipToRange(0.5, 3.0)
val clippedToRangeSpeed = speed.clipToRange(0.5, 5.0)
// to stop the issue 1.2000000000000002
val roundedSpeed = round(clippedToRangeSpeed * 10.0) / 10.0
effects.playbackSpeed = roundedSpeed
Expand Down