Skip to content

Commit

Permalink
fix: treat track state INACTIVE with position > 0 as finished track
Browse files Browse the repository at this point in the history
  • Loading branch information
Apehum committed Jan 28, 2025
1 parent e86c6aa commit 8971e1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
- APPEND — Adds a new line to the end of the lore on burn, and removes the last line on erase.
- Fixed clicking with a custom disc into a stopped jukebox with a disc already inside would cause it to play track without actually inserting the disc.
- Fixed an IllegalStateException on ChunkUnloadEvent when using Folia [#92](https://github.com/plasmoapp/pv-addon-discs/issues/92).
- Added support for minecart with hopper. Pulling item from jukebox using minecart hopper stops the track.
- Added support for minecart with hopper. Pulling item from jukebox using minecart hopper stops the track.
- Fixed an issue where the track's job was not being stopped after the track finished, causing unnecessary CPU usage and memory leak.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ class PlasmoAudioPlayerManager : PluginKoinComponent {

val frameProvider = object : AudioFrameProvider {
override fun provide20ms(): AudioFrameResult =
if (track.state == AudioTrackState.FINISHED) {
if (
track.state == AudioTrackState.FINISHED ||
(track.state == AudioTrackState.INACTIVE && track.position > 0)
) {
AudioFrameResult.Finished
} else {
val frame = player.provide()?.data?.let {
Expand Down

0 comments on commit 8971e1d

Please sign in to comment.