Skip to content

Commit 35c3ea5

Browse files
committed
Always use volume tag if not a fade-in.
1 parent b9b67c7 commit 35c3ea5

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/main/kotlin/dev/arbjerg/ukulele/api/PlayerController.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ class PlayerController(
9696
}
9797
}
9898

99+
if (body["fadeIn"] == "true") {
100+
player.isFadeInArmed = true
101+
}
102+
99103
var identifiers = (body["url"] ?: "").split("|")
100104
// ... (rest of play method logic)
101105
if (identifiers.isNotEmpty() && identifiers.first().isEmpty()) {

src/main/kotlin/dev/arbjerg/ukulele/audio/Player.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ class Player(private val beans: Beans, guildProperties: GuildProperties) : Audio
115115
var showQueueOnSkip: Boolean = beans.botProps.showQueueOnSkip
116116

117117
var lastChannel: TextChannel? = null
118+
var isFadeInArmed: Boolean = false
118119

119120
private var queueLabelVolume: Pattern = Pattern.compile("^\\s*\\[.*[vV]:(\\d{1,3}).*]?.*$")
120121

@@ -197,12 +198,12 @@ class Player(private val beans: Beans, guildProperties: GuildProperties) : Audio
197198
// Reset the volume to the current guild volume config
198199
player.volume = scaleVolume(this.volume)
199200

200-
// Only apply queue label volume if the guild volume is not zero.
201-
// This allows the client (e.g. ukulele-remote) to perform a seamless fade-in by
202-
// starting the track at zero volume.
203-
if (this.volume > 0 && (!beans.botProps.normalization || !track.isReplayGainApplied())) {
201+
// Only apply queue label volume if a fade-in is NOT armed.
202+
// This allows the client to perform a seamless fade-in by arming it beforehand.
203+
if (!isFadeInArmed && (!beans.botProps.normalization || !track.isReplayGainApplied())) {
204204
adjustVolumeFromQueueLabelVolumeMatcher(player, track)
205205
}
206+
isFadeInArmed = false
206207
publishState()
207208
}
208209

0 commit comments

Comments
 (0)