Skip to content

Commit

Permalink
Fixed a bug related to file duration exceeding while setting the posi…
Browse files Browse the repository at this point in the history
…tion.
  • Loading branch information
MahmoudAtef999 committed Dec 18, 2024
1 parent 1d9abe6 commit 00e5aba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ui/widgets/menu_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def create_menu(self):
self.forward_action.triggered.connect(lambda: self.parent.toolbar.player.forward(SettingsManager.current_settings["listening"]["forward_time"]))
self.replay_action = QAction("إعادة", self)
self.replay_action.setShortcut(QKeySequence("Ctrl+J"))
self.replay_action.triggered.connect(lambda: self.parent.toolbar.player.rewind(500))
self.replay_action.triggered.connect(lambda: self.parent.toolbar.player.set_position(0))

self.play_next_action = QAction("تشغيل الآية التالية", self)
self.play_next_action.setShortcut(QKeySequence("Ctrl+Shift+N"))
Expand Down
2 changes: 1 addition & 1 deletion utils/audio_player/bass_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def set_position(self, new_seconds: float) -> None:
new_seconds = max(0.0, new_seconds)

duration = self.BASS_ChannelBytes2Seconds(self.current_channel, bass.BASS_ChannelGetLength( self.current_channel, 0))
new_seconds = min(new_seconds, duration)
new_seconds = min(new_seconds, duration-1)
new_position = self.BASS_ChannelSeconds2Bytes(self.current_channel, new_seconds)
self.BASS_ChannelSetPosition(self.current_channel, new_position, 0)

Expand Down

0 comments on commit 00e5aba

Please sign in to comment.