Skip to content
Closed
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
7 changes: 3 additions & 4 deletions src/MusicPlayer/Music/PlaySongInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ internal class PlaySongInfo
private int delta;
private DateTime lastUpdate;
private int noteIndex;
public event Action<int>? OnCompleted;
public PlaySongInfo(List<List<float>> notes, int tempo, VirtualPerformer performer)
{
this.Notes = notes;
Expand All @@ -27,8 +28,7 @@ public void Update(int index)
if (this.noteIndex == this.Notes.Count)
{
this.PlayCompleted = true;
var songPlayer = MusicPlayer.SongPlayers[index];
songPlayer?.EndSong();
this.OnCompleted?.Invoke(index);
return;
}
this.delta += (int) (DateTime.Now - this.lastUpdate).TotalMilliseconds;
Expand All @@ -39,7 +39,6 @@ public void Update(int index)
{
if (noteValue >= -1f && noteValue <= 1f)
{
//PlayNote(index, noteValue);
this.Performer.PlayNote(index, noteValue);
}
}
Expand All @@ -62,4 +61,4 @@ public static void PlayNote(int index, float note)
{
NetMessage.SendData((int) PacketTypes.PlayHarp, index, -1, null, index, note, 0f, 0f, 0);
}
}
}
Loading