diff --git a/Scripts/BangerTypes/Note.cs b/Scripts/BangerTypes/Note.cs index 34cde04..e6f7dc7 100644 --- a/Scripts/BangerTypes/Note.cs +++ b/Scripts/BangerTypes/Note.cs @@ -5,6 +5,7 @@ using UnityEngine; namespace BangerTypes { + [Serializable] public class Note { public float t; // Time diff --git a/Scripts/BangerTypes/Rhys.cs b/Scripts/BangerTypes/Rhys.cs index 8f51eb9..2b95a70 100644 --- a/Scripts/BangerTypes/Rhys.cs +++ b/Scripts/BangerTypes/Rhys.cs @@ -5,6 +5,7 @@ using UnityEngine; namespace BangerTypes { + [Serializable] public class Rhys { public Note[] notes; diff --git a/Scripts/Menu and Songs/FindSongs.cs b/Scripts/Menu and Songs/FindSongs.cs index 80194db..5f42f9c 100644 --- a/Scripts/Menu and Songs/FindSongs.cs +++ b/Scripts/Menu and Songs/FindSongs.cs @@ -32,7 +32,7 @@ namespace MenuAndSongs Rhys rhys = JsonUtility.FromJson(jsonContent); string title = "" + (rhys.title ?? "Title not found") + ""; - string artist = String.IsNullOrEmpty(rhys.artist) ? "Artist not found" : "By: " + rhys.artist + ""; + string artist = string.IsNullOrEmpty(rhys.artist) ? "Artist not found" : "By: " + rhys.artist + ""; string album = "Album information not available"; TimeSpan duration = TimeSpan.FromSeconds(rhys.track_time); @@ -55,10 +55,8 @@ namespace MenuAndSongs } var notes = rhys.notes; - Debug.Log("NOTES: "); - Debug.Log(notes); - return new() + return new Song { Title = title, Artist = artist, @@ -66,23 +64,20 @@ namespace MenuAndSongs DurationSpan = duration, Duration = formattedTimeSpan, CoverArt = coverImage, + Notes = notes, Clip = LoadAudioFromBase64(rhys.audio) }; } private static AudioClip LoadAudioFromBase64(string base64String) { - // Decode Base64 String to byte array byte[] mp3Bytes = Convert.FromBase64String(base64String); - // Create a temporary file path string tempFilePath = Path.Combine(Application.persistentDataPath, "tempMp3File.mp3"); System.IO.File.WriteAllBytes(tempFilePath, mp3Bytes); - // Load the AudioClip synchronously AudioClip clip = LoadAudioSync(tempFilePath); - // Optionally delete the temporary file if no longer needed System.IO.File.Delete(tempFilePath); return clip;