mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 20:53:00 +08:00
Merge pull request #10038 from peppy/fade-between-audio-tracks
Add smooth fading between audio tracks on transition
This commit is contained in:
commit
d8a25f5247
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -341,10 +342,13 @@ namespace osu.Game.Overlays
|
|||||||
// but the mutation of the hierarchy is scheduled to avoid exceptions.
|
// but the mutation of the hierarchy is scheduled to avoid exceptions.
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
lastTrack.Expire();
|
lastTrack.VolumeTo(0, 500, Easing.Out).Expire();
|
||||||
|
|
||||||
if (queuedTrack == CurrentTrack)
|
if (queuedTrack == CurrentTrack)
|
||||||
|
{
|
||||||
AddInternal(queuedTrack);
|
AddInternal(queuedTrack);
|
||||||
|
queuedTrack.VolumeTo(0).Then().VolumeTo(1, 300, Easing.Out);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If the track has changed since the call to changeTrack, it is safe to dispose the
|
// If the track has changed since the call to changeTrack, it is safe to dispose the
|
||||||
|
@ -12,6 +12,7 @@ using osu.Framework.Screens;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.IO.Archives;
|
using osu.Game.IO.Archives;
|
||||||
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Screens.Backgrounds;
|
using osu.Game.Screens.Backgrounds;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -60,6 +61,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private AudioManager audio { get; set; }
|
private AudioManager audio { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private MusicController musicController { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the <see cref="Track"/> is provided by osu! resources, rather than a user beatmap.
|
/// Whether the <see cref="Track"/> is provided by osu! resources, rather than a user beatmap.
|
||||||
/// Only valid during or after <see cref="LogoArriving"/>.
|
/// Only valid during or after <see cref="LogoArriving"/>.
|
||||||
@ -167,6 +171,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
Track = initialBeatmap.Track;
|
Track = initialBeatmap.Track;
|
||||||
UsingThemedIntro = !initialBeatmap.Track.IsDummyDevice;
|
UsingThemedIntro = !initialBeatmap.Track.IsDummyDevice;
|
||||||
|
|
||||||
|
// ensure the track starts at maximum volume
|
||||||
|
musicController.CurrentTrack.FinishTransforms();
|
||||||
|
|
||||||
logo.MoveTo(new Vector2(0.5f));
|
logo.MoveTo(new Vector2(0.5f));
|
||||||
logo.ScaleTo(Vector2.One);
|
logo.ScaleTo(Vector2.One);
|
||||||
logo.Hide();
|
logo.Hide();
|
||||||
|
Loading…
Reference in New Issue
Block a user