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

Change how Playlist class opens and closes audio streams #48

Merged
merged 9 commits into from
Jun 18, 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
Next Next commit
Update Playlist.cs
  • Loading branch information
UTheCat committed Jun 18, 2024
commit 191808bb17feb76b0d7e934ef4fa8383ca3771d1
8 changes: 6 additions & 2 deletions src/core/Music/Playlist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public partial class Playlist : Node, IDisposable
/// should approach opening and closing the audio streams
/// of its <see cref="Song"/> instances.
/// </summary>
public enum SongStreamHandlingMode
public enum SongStreamHandlingModeFlags
{
/// <summary>
/// Specifies that the <see cref="Playlist"/> shouldn't open or close
Expand Down Expand Up @@ -101,6 +101,8 @@ private set
}
}

public SongStreamHandlingModeFlags SongStreamHandlingMode;

/// <summary>
/// The list of <see cref="Song"/>s being played by this playlist.
/// </summary>
Expand Down Expand Up @@ -212,7 +214,7 @@ private void SwitchToSong(int index)
bool onlyOneSong = SongList.Count == 1;
CreateAudioStreamPlayer();
s.IsLooping = onlyOneSong;
s.OpenStream();
//s.OpenStream();
streamPlayer.Stream = s.Stream;

// If there's more than one song, switch to the next song on finish
Expand Down Expand Up @@ -336,11 +338,13 @@ public void StopImmediately()
}

// free memory used by CurrentSong's stream
/*
Song song = CurrentSong;
if (song != null)
{
song.CloseStream();
}
*/

RaiseStoppedEvent();
}
Expand Down