loading songs

This commit is contained in:
Bucket Of Chicken
2025-08-30 13:31:07 +02:00
parent 702013f9f8
commit e758d1df2b
8 changed files with 323 additions and 31 deletions
+29 -8
View File
@@ -1,22 +1,43 @@
using Godot;
using Instances;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
public partial class Context : Node
{
Song[] Songs;
public Thread processingThread;
public static Context instance;
public IEnumerable<Song> Songs;
AudioStreamPlayer[] StreamPlayers;
DirectoryManager manager = new();
DirectoryLoader manager = new();
public event EventHandler SongsUpdated;
public delegate void SongsUpdatedEventHandler(object sender, SongsUpdatedEventArgs e);
public override void _Ready()
{
base._Ready();
instance = this;
}
public void LoadDirectory(String path){
GD.Print(path);
Songs = manager.LoadDirectory(path);
GD.Print("got here");
foreach (Song song in Songs){
GD.Print("got ", song.Name);
}
GD.Print("Songs loaded");
SongsUpdatedEventArgs args = new();
args.songs = Songs;
OnSongsUpdated(args);
}
protected virtual void OnSongsUpdated(SongsUpdatedEventArgs e){
SongsUpdated.Invoke(this,e);
}
}
public class SongsUpdatedEventArgs : EventArgs
{
public IEnumerable<Song> songs;
}