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

Have MusicZonePlayer only update CurrentPlaylist once per frame #26

Merged
merged 2 commits into from
Apr 7, 2024
Merged
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
Prev Previous commit
Update MusicZonePlayer.cs
  • Loading branch information
UTheCat committed Apr 7, 2024
commit 1a9b8ae4993a78540749184561a6cba7b6766beb
10 changes: 4 additions & 6 deletions src/main/Music/MusicZonePlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ namespace Jumpvalley.Music
/// <br/>
/// In order for music to play when the player is outside a music zone, a primary playlist must be set.
/// This playlist will get played when outside of the music zones.
/// <br/>
/// <br/>
/// It's important to note that MusicZonePlayer will only update <see cref="CurrentPlaylist"/> once per process frame for stability reasons
/// (as long as the calling of MusicZonePlayer's _Process() function hasn't been disabled).
/// </summary>
public partial class MusicZonePlayer : MusicPlayer, IDisposable
{
Expand All @@ -38,19 +42,13 @@ public MusicZonePlayer() : base()

/// <summary>
/// Deregisters a music zone from playback.
/// If the removed music zone is equal to <see cref="CurrentPlaylist"/> and <see cref="IsPlaying"/> is true, <see cref="CurrentPlaylist"/> will be set to <see cref="PrimaryPlaylist"/>.
/// </summary>
/// <param name="zone"></param>
public void Remove(MusicZone zone)
{
if (zone != null)
{
Zones.Remove(zone);

if (IsPlaying && CurrentPlaylist != zone)
{
CurrentPlaylist = PrimaryPlaylist;
}
}
}

Expand Down