Sucessfully loaded in songs with the WAV music packs. Just need to implement functionality in the WAV "packs"
This commit is contained in:
parent
1fb92f7cf7
commit
b5b6c20830
|
@ -5,6 +5,7 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using StardewSymphonyRemastered;
|
using StardewSymphonyRemastered;
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace StardewSymphonyRemastered.Framework
|
namespace StardewSymphonyRemastered.Framework
|
||||||
{
|
{
|
||||||
|
@ -168,9 +169,9 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="songListKey"></param>
|
/// <param name="songListKey"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Dictionary<MusicPack,List<string>> getListOfApplicableMusicPacks(string songListKey)
|
public Dictionary<MusicPack,List<Song>> getListOfApplicableMusicPacks(string songListKey)
|
||||||
{
|
{
|
||||||
Dictionary<MusicPack, List<string>> listOfValidDictionaries = new Dictionary<MusicPack, List<string>>();
|
Dictionary<MusicPack, List<Song>> listOfValidDictionaries = new Dictionary<MusicPack, List<Song>>();
|
||||||
foreach(var v in this.musicPacks)
|
foreach(var v in this.musicPacks)
|
||||||
{
|
{
|
||||||
var songList= v.Value.songInformation.getSongList(songListKey).Value;
|
var songList= v.Value.songInformation.getSongList(songListKey).Value;
|
||||||
|
@ -207,44 +208,39 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
|
|
||||||
var songName = musicPackPair.Value.ElementAt(randInt2);
|
var songName = musicPackPair.Value.ElementAt(randInt2);
|
||||||
|
|
||||||
this.currentMusicPack.playSong(songName);
|
this.currentMusicPack.playSong(songName.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// TODO: Make WAV MUSIC PACKS
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="wavMusicPack"></param>
|
|
||||||
public void addMusicPack(WavMusicPack wavMusicPack)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a valid xwb music pack to the list of music packs available.
|
/// Adds a valid xwb music pack to the list of music packs available.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="xwbMusicPack"></param>
|
/// <param name="musicPack"></param>
|
||||||
/// <param name="displayLogInformation">Whether or not to display the process to the console. Will include information from the pack's metadata. Default:False</param>
|
/// <param name="displayLogInformation">Whether or not to display the process to the console. Will include information from the pack's metadata. Default:False</param>
|
||||||
/// <param name="xwbMusicPack">If displayLogInformation is also true this will display the name of all of the songs in the music pack when it is added in.</param>
|
/// <param name="xwbMusicPack">If displayLogInformation is also true this will display the name of all of the songs in the music pack when it is added in.</param>
|
||||||
public void addMusicPack(XACTMusicPack xwbMusicPack,bool displayLogInformation=false,bool displaySongs=false)
|
public void addMusicPack(MusicPack musicPack,bool displayLogInformation=false,bool displaySongs=false)
|
||||||
{
|
{
|
||||||
if (displayLogInformation == true)
|
if (displayLogInformation == true)
|
||||||
{
|
{
|
||||||
StardewSymphony.ModMonitor.Log("Adding a new music pack!");
|
StardewSymphony.ModMonitor.Log("Adding a new music pack!");
|
||||||
StardewSymphony.ModMonitor.Log(" Name:" + xwbMusicPack.musicPackInformation.name);
|
|
||||||
StardewSymphony.ModMonitor.Log(" Author:" + xwbMusicPack.musicPackInformation.author);
|
|
||||||
StardewSymphony.ModMonitor.Log(" Description:" + xwbMusicPack.musicPackInformation.description);
|
StardewSymphony.ModMonitor.Log(" Location:" + musicPack.shortenedDirectory);
|
||||||
StardewSymphony.ModMonitor.Log(" Version Info:" + xwbMusicPack.musicPackInformation.versionInfo);
|
StardewSymphony.ModMonitor.Log(" Name:" + musicPack.musicPackInformation.name);
|
||||||
|
StardewSymphony.ModMonitor.Log(" Author:" + musicPack.musicPackInformation.author);
|
||||||
|
StardewSymphony.ModMonitor.Log(" Description:" + musicPack.musicPackInformation.description);
|
||||||
|
StardewSymphony.ModMonitor.Log(" Version Info:" + musicPack.musicPackInformation.versionInfo);
|
||||||
StardewSymphony.ModMonitor.Log(" Song List:");
|
StardewSymphony.ModMonitor.Log(" Song List:");
|
||||||
|
|
||||||
if (displaySongs == true)
|
if (displaySongs == true)
|
||||||
{
|
{
|
||||||
foreach(var songname in xwbMusicPack.songInformation.listOfSongsWithoutTriggers)
|
foreach(var song in musicPack.songInformation.listOfSongsWithoutTriggers)
|
||||||
{
|
{
|
||||||
StardewSymphony.ModMonitor.Log(" " + songname);
|
StardewSymphony.ModMonitor.Log(" " + song.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.musicPacks.Add(xwbMusicPack.musicPackInformation.name,xwbMusicPack);
|
this.musicPacks.Add(musicPack.musicPackInformation.name,musicPack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
public class MusicPack
|
public class MusicPack
|
||||||
{
|
{
|
||||||
public string directory;
|
public string directory;
|
||||||
|
public string shortenedDirectory;
|
||||||
public StardewSymphonyRemastered.Framework.SongSpecifics songInformation;
|
public StardewSymphonyRemastered.Framework.SongSpecifics songInformation;
|
||||||
public MusicPackMetaData musicPackInformation;
|
public MusicPackMetaData musicPackInformation;
|
||||||
|
|
||||||
|
@ -52,5 +53,9 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void setModDirectoryFromFullDirectory()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace StardewSymphonyRemastered.Framework
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The class to be used to manage individual songs.
|
||||||
|
/// </summary>
|
||||||
|
public class Song
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The path to the song. In the case of XACT songs this points to the .xwb file. For WAV files this points directly to the WAV file itself.
|
||||||
|
/// </summary>
|
||||||
|
public string pathToSong;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the song itself.
|
||||||
|
/// </summary>
|
||||||
|
public string name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Blank Constructor;
|
||||||
|
/// </summary>
|
||||||
|
public Song()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor to be used for WAV files.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="PathToSong"></param>
|
||||||
|
public Song(string PathToSong)
|
||||||
|
{
|
||||||
|
this.pathToSong=PathToSong;
|
||||||
|
this.name = getNameFromPath(this.pathToSong);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor to be used for XACT music packs.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="PathToSong"></param>
|
||||||
|
/// <param name="Name"></param>
|
||||||
|
public Song(string PathToSong,string Name)
|
||||||
|
{
|
||||||
|
this.pathToSong = PathToSong;
|
||||||
|
this.name = Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parse the name of the file from the path provided.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string getNameFromPath(string path)
|
||||||
|
{
|
||||||
|
return Path.GetFileNameWithoutExtension(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read the info from a .json file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Song ReadFromJson(string path)
|
||||||
|
{
|
||||||
|
return StardewSymphony.ModHelper.ReadJsonFile<Song>(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write the information of the instance to a .json file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">The path to which the json file is written to.</param>
|
||||||
|
public void writeToJson(string path)
|
||||||
|
{
|
||||||
|
StardewSymphony.ModHelper.WriteJsonFile<Song>(path, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,13 +14,13 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SongSpecifics
|
public class SongSpecifics
|
||||||
{
|
{
|
||||||
Dictionary<string, List<string>> listOfSongsWithTriggers; //triggerName, <songs>
|
Dictionary<string, List<Song>> listOfSongsWithTriggers; //triggerName, <songs>
|
||||||
|
|
||||||
Dictionary<string, List<string>> eventSongs;
|
Dictionary<string, List<Song>> eventSongs;
|
||||||
|
|
||||||
Dictionary<string, List<string>> festivalSongs;
|
Dictionary<string, List<Song>> festivalSongs;
|
||||||
|
|
||||||
public List<string> listOfSongsWithoutTriggers;
|
public List<Song> listOfSongsWithoutTriggers;
|
||||||
|
|
||||||
public static List<string> locations = new List<string>();
|
public static List<string> locations = new List<string>();
|
||||||
public static List<string> festivals = new List<string>();
|
public static List<string> festivals = new List<string>();
|
||||||
|
@ -71,11 +71,11 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
"night"
|
"night"
|
||||||
};
|
};
|
||||||
|
|
||||||
listOfSongsWithTriggers = new Dictionary<string, List<string>>();
|
listOfSongsWithTriggers = new Dictionary<string, List<Song>>();
|
||||||
eventSongs = new Dictionary<string, List<string>>();
|
eventSongs = new Dictionary<string, List<Song>>();
|
||||||
festivalSongs = new Dictionary<string, List<string>>();
|
festivalSongs = new Dictionary<string, List<Song>>();
|
||||||
|
|
||||||
this.listOfSongsWithoutTriggers = new List<string>();
|
this.listOfSongsWithoutTriggers = new List<Song>();
|
||||||
|
|
||||||
this.addSongLists();
|
this.addSongLists();
|
||||||
|
|
||||||
|
@ -263,9 +263,9 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
/// Adds the song's reference to a music pack.
|
/// Adds the song's reference to a music pack.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="songName"></param>
|
/// <param name="songName"></param>
|
||||||
public void addSongToMusicPack(string songName)
|
public void addSongToMusicPack(Song song)
|
||||||
{
|
{
|
||||||
this.listOfSongsWithoutTriggers.Add(songName);
|
this.listOfSongsWithoutTriggers.Add(song);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -275,7 +275,8 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool isSongInList(string songName)
|
public bool isSongInList(string songName)
|
||||||
{
|
{
|
||||||
return listOfSongsWithoutTriggers.Contains(songName);
|
Song s = getSongFromList(listOfSongsWithoutTriggers, songName);
|
||||||
|
return listOfSongsWithoutTriggers.Contains(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -287,16 +288,16 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
{
|
{
|
||||||
foreach (var season in seasons)
|
foreach (var season in seasons)
|
||||||
{
|
{
|
||||||
listOfSongsWithTriggers.Add(loc + seperator + season, new List<string>());
|
listOfSongsWithTriggers.Add(loc + seperator + season, new List<Song>());
|
||||||
foreach(var Weather in weather)
|
foreach(var Weather in weather)
|
||||||
{
|
{
|
||||||
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather, new List<string>());
|
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather, new List<Song>());
|
||||||
foreach(var day in daysOfWeek)
|
foreach(var day in daysOfWeek)
|
||||||
{
|
{
|
||||||
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather + seperator + day, new List<string>());
|
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather + seperator + day, new List<Song>());
|
||||||
foreach(var time in timesOfDay)
|
foreach(var time in timesOfDay)
|
||||||
{
|
{
|
||||||
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather + seperator + day + seperator + time, new List<string>());
|
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather + seperator + day + seperator + time, new List<Song>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -306,16 +307,16 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
//Add in some default seasonal music because maybe a location doesn't have some music?
|
//Add in some default seasonal music because maybe a location doesn't have some music?
|
||||||
foreach (var season in seasons)
|
foreach (var season in seasons)
|
||||||
{
|
{
|
||||||
listOfSongsWithTriggers.Add(season, new List<string>());
|
listOfSongsWithTriggers.Add(season, new List<Song>());
|
||||||
foreach (var Weather in weather)
|
foreach (var Weather in weather)
|
||||||
{
|
{
|
||||||
listOfSongsWithTriggers.Add( season + seperator + Weather, new List<string>());
|
listOfSongsWithTriggers.Add( season + seperator + Weather, new List<Song>());
|
||||||
foreach (var day in daysOfWeek)
|
foreach (var day in daysOfWeek)
|
||||||
{
|
{
|
||||||
listOfSongsWithTriggers.Add(season + seperator + Weather + seperator + day, new List<string>());
|
listOfSongsWithTriggers.Add(season + seperator + Weather + seperator + day, new List<Song>());
|
||||||
foreach (var time in timesOfDay)
|
foreach (var time in timesOfDay)
|
||||||
{
|
{
|
||||||
listOfSongsWithTriggers.Add(season + seperator + Weather + seperator + day + seperator + time, new List<string>());
|
listOfSongsWithTriggers.Add(season + seperator + Weather + seperator + day + seperator + time, new List<Song>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -328,40 +329,41 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public KeyValuePair<string,List<string>>getSongList(string key)
|
public KeyValuePair<string,List<Song>>getSongList(string key)
|
||||||
{
|
{
|
||||||
string keyPhrase = key.Split(seperator).ElementAt(0);
|
string keyPhrase = key.Split(seperator).ElementAt(0);
|
||||||
|
|
||||||
if (keyPhrase == "event")
|
if (keyPhrase == "event")
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
foreach (KeyValuePair<string, List<string>> pair in eventSongs)
|
foreach (KeyValuePair<string, List<Song>> pair in eventSongs)
|
||||||
{
|
{
|
||||||
if (pair.Key == key) return pair;
|
if (pair.Key == key) return pair;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return new KeyValuePair<string, List<string>>(key, eventSongs[key]);
|
//return new KeyValuePair<string, List<Song>>(key, eventSongs[key]);
|
||||||
}
|
}
|
||||||
else if (keyPhrase == "festival")
|
else if (keyPhrase == "festival")
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
foreach (KeyValuePair<string, List<string>> pair in festivalSongs)
|
foreach (KeyValuePair<string, List<Song>> pair in festivalSongs)
|
||||||
{
|
{
|
||||||
if (pair.Key == key) return pair;
|
if (pair.Key == key) return pair;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return new KeyValuePair<string, List<string>>(key, festivalSongs[key]);
|
//return new KeyValuePair<string, List<string>>(key, festivalSongs[key]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
foreach(KeyValuePair<string,List<string>> pair in listOfSongsWithTriggers)
|
foreach(KeyValuePair<string,List<Song>> pair in listOfSongsWithTriggers)
|
||||||
{
|
{
|
||||||
if (pair.Key == key) return pair;
|
if (pair.Key == key) return pair;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return new KeyValuePair<string, List<string>>(key, listOfSongsWithTriggers[key]);
|
//return new KeyValuePair<string, List<string>>(key, listOfSongsWithTriggers[key]);
|
||||||
}
|
}
|
||||||
|
return new KeyValuePair<string, List<Song>>("",null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -371,9 +373,9 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
/// <param name="songName"></param>
|
/// <param name="songName"></param>
|
||||||
public void addSongToList(string songListKey,string songName)
|
public void addSongToList(string songListKey,string songName)
|
||||||
{
|
{
|
||||||
var songList = getSongList(songListKey);
|
var songKeyPair = getSongList(songListKey);
|
||||||
|
var song = getSongFromList(songKeyPair.Value, songName);
|
||||||
songList.Value.Add(songName);
|
songKeyPair.Value.Add(song);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -383,8 +385,24 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
/// <param name="songName"></param>
|
/// <param name="songName"></param>
|
||||||
public void removeSongFromList(string songListKey,string songName)
|
public void removeSongFromList(string songListKey,string songName)
|
||||||
{
|
{
|
||||||
var songList = getSongList(songListKey);
|
var songKeyPair = getSongList(songListKey);
|
||||||
songList.Value.Remove(songName);
|
var song = getSongFromList(songKeyPair.Value, songName);
|
||||||
|
songKeyPair.Value.Remove(song);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the Song instance that is referenced with the song's name.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="songList"></param>
|
||||||
|
/// <param name="songName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Song getSongFromList(List<Song> songList,string songName)
|
||||||
|
{
|
||||||
|
foreach(var song in songList)
|
||||||
|
{
|
||||||
|
if (song.name == songName) return song;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -11,5 +12,97 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class WavMusicPack : MusicPack
|
public class WavMusicPack : MusicPack
|
||||||
{
|
{
|
||||||
|
public Song currentSong;
|
||||||
|
public string songsDirectory;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="directoryToMusicPack"></param>
|
||||||
|
public WavMusicPack(string directoryToMusicPack)
|
||||||
|
{
|
||||||
|
this.directory = directoryToMusicPack;
|
||||||
|
this.setModDirectoryFromFullDirectory();
|
||||||
|
this.songsDirectory = Path.Combine(this.directory, "Songs");
|
||||||
|
this.songInformation = new SongSpecifics();
|
||||||
|
this.musicPackInformation = MusicPackMetaData.readFromJson(Path.Combine(directoryToMusicPack, "MusicPackInformation.json"));
|
||||||
|
|
||||||
|
if (this.musicPackInformation == null)
|
||||||
|
{
|
||||||
|
StardewSymphony.ModMonitor.Log("Error: MusicPackInformation.json not found at: " + directoryToMusicPack + ". Blank information will be put in place.", StardewModdingAPI.LogLevel.Warn);
|
||||||
|
this.musicPackInformation = new MusicPackMetaData("???", "???", "", "0.0.0");
|
||||||
|
}
|
||||||
|
this.loadMusicFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A shortened directory name for display purposes.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override void setModDirectoryFromFullDirectory()
|
||||||
|
{
|
||||||
|
string[] spliter = this.directory.Split(Path.DirectorySeparatorChar);
|
||||||
|
string directoryLocation = "";
|
||||||
|
for (int i = spliter.Length - 6; i < spliter.Length; i++)
|
||||||
|
{
|
||||||
|
directoryLocation += spliter[i];
|
||||||
|
|
||||||
|
if (i != spliter.Length - 1)
|
||||||
|
{
|
||||||
|
directoryLocation += Path.DirectorySeparatorChar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.shortenedDirectory = directoryLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the name of the currently playing song.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override string getNameOfCurrentSong()
|
||||||
|
{
|
||||||
|
return this.currentSong.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Load in the music files from the pack's respective Directory/Songs folder. Typically Content/Music/Wav/FolderName/Songs
|
||||||
|
/// </summary>
|
||||||
|
public override void loadMusicFiles()
|
||||||
|
{
|
||||||
|
string[] wavFiles = Directory.GetFiles(this.songsDirectory, "*.wav");
|
||||||
|
List<Song> listOfSongs = new List<Song>();
|
||||||
|
foreach(var wav in wavFiles)
|
||||||
|
{
|
||||||
|
Song song = new Song(wav);
|
||||||
|
listOfSongs.Add(song);
|
||||||
|
}
|
||||||
|
this.songInformation.listOfSongsWithoutTriggers = listOfSongs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void pauseSong()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void playSong(string name)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void resumeSong()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void stopSong()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void swapSong(string songName)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
this.directory = directoryToXwb;
|
this.directory = directoryToXwb;
|
||||||
this.WaveBankPath = pathToWaveBank;
|
this.WaveBankPath = pathToWaveBank;
|
||||||
this.SoundBankPath = pathToSoundBank;
|
this.SoundBankPath = pathToSoundBank;
|
||||||
|
this.setModDirectoryFromFullDirectory();
|
||||||
this.songInformation = new SongSpecifics();
|
this.songInformation = new SongSpecifics();
|
||||||
this.currentCue = null;
|
this.currentCue = null;
|
||||||
this.musicPackInformation = MusicPackMetaData.readFromJson(Path.Combine(directoryToXwb, "MusicPackInformation.json"));
|
this.musicPackInformation = MusicPackMetaData.readFromJson(Path.Combine(directoryToXwb, "MusicPackInformation.json"));
|
||||||
|
@ -53,7 +54,21 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void loadMusicFiles()
|
public override void loadMusicFiles()
|
||||||
{
|
{
|
||||||
this.songInformation.listOfSongsWithoutTriggers=StardewSymphonyRemastered.Framework.MusicHexProcessor.ProcessSongNamesFromHex(this,StardewSymphony.Reset,this.SoundBankPath);
|
|
||||||
|
var listOfSongStrings = StardewSymphonyRemastered.Framework.MusicHexProcessor.ProcessSongNamesFromHex(this, StardewSymphony.Reset, this.SoundBankPath);
|
||||||
|
|
||||||
|
List<Song> listofSongs = new List<Song>();
|
||||||
|
foreach(var songname in listOfSongStrings)
|
||||||
|
{
|
||||||
|
Song song = new Song(this.WaveBankPath, songname);
|
||||||
|
listofSongs.Add(song);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.songInformation.listOfSongsWithoutTriggers = listofSongs;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -158,5 +173,25 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
return this.currentCue.Name;
|
return this.currentCue.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a shortened directory name for display purposes.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override void setModDirectoryFromFullDirectory()
|
||||||
|
{
|
||||||
|
string[] spliter = this.WaveBankPath.Split(Path.DirectorySeparatorChar);
|
||||||
|
string directoryLocation="";
|
||||||
|
for (int i = spliter.Length - 5; i < spliter.Length; i++)
|
||||||
|
{
|
||||||
|
directoryLocation += spliter[i];
|
||||||
|
|
||||||
|
if (i != spliter.Length - 1)
|
||||||
|
{
|
||||||
|
directoryLocation += Path.DirectorySeparatorChar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.shortenedDirectory = directoryLocation;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,13 +63,12 @@ namespace StardewSymphonyRemastered
|
||||||
|
|
||||||
this.createDirectories();
|
this.createDirectories();
|
||||||
this.createBlankXACTTemplate();
|
this.createBlankXACTTemplate();
|
||||||
|
this.createBlankWAVTemplate();
|
||||||
musicPacksInitialized = false;
|
musicPacksInitialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (Game1.activeClickableMenu.GetType()!=typeof(StardewValley.Menus.TitleMenu)&& Game1.audioEngine.isNull()) return;
|
|
||||||
if (musicPacksInitialized == false)
|
if (musicPacksInitialized == false)
|
||||||
{
|
{
|
||||||
initializeMusicPacks();
|
initializeMusicPacks();
|
||||||
|
@ -81,6 +80,7 @@ namespace StardewSymphonyRemastered
|
||||||
{
|
{
|
||||||
//load in all packs here.
|
//load in all packs here.
|
||||||
loadXACTMusicPacks();
|
loadXACTMusicPacks();
|
||||||
|
loadWAVMusicPacks();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createDirectories()
|
public void createDirectories()
|
||||||
|
@ -90,6 +90,7 @@ namespace StardewSymphonyRemastered
|
||||||
if (!Directory.Exists(XACTMusicDirectory)) Directory.CreateDirectory(XACTMusicDirectory);
|
if (!Directory.Exists(XACTMusicDirectory)) Directory.CreateDirectory(XACTMusicDirectory);
|
||||||
if (!Directory.Exists(TemplateMusicDirectory)) Directory.CreateDirectory(TemplateMusicDirectory);
|
if (!Directory.Exists(TemplateMusicDirectory)) Directory.CreateDirectory(TemplateMusicDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createBlankXACTTemplate()
|
public void createBlankXACTTemplate()
|
||||||
{
|
{
|
||||||
string path= Path.Combine(TemplateMusicDirectory, "XACT");
|
string path= Path.Combine(TemplateMusicDirectory, "XACT");
|
||||||
|
@ -103,11 +104,35 @@ namespace StardewSymphonyRemastered
|
||||||
}
|
}
|
||||||
if (!File.Exists(Path.Combine(path, "readme.txt")))
|
if (!File.Exists(Path.Combine(path, "readme.txt")))
|
||||||
{
|
{
|
||||||
string info = "Place the Wave Bank.xwb file and Sound Bank.xsb file you created in XACT in a similar directory in Content/Music/XACT/SoundPackName with a new meta data to load it!";
|
string info = "Place the Wave Bank.xwb file and Sound Bank.xsb file you created in XACT in a similar directory in Content/Music/XACT/SoundPackName.\nModify MusicPackInformation.json as desire!\nRun the mod!";
|
||||||
File.WriteAllText(Path.Combine(path, "readme.txt"),info);
|
File.WriteAllText(Path.Combine(path, "readme.txt"),info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void createBlankWAVTemplate()
|
||||||
|
{
|
||||||
|
string path = Path.Combine(TemplateMusicDirectory, "WAV");
|
||||||
|
string pathSongs = Path.Combine(path, "Songs");
|
||||||
|
if (!Directory.Exists(path))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(path);
|
||||||
|
}
|
||||||
|
if (!Directory.Exists(pathSongs))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(pathSongs);
|
||||||
|
}
|
||||||
|
if (!File.Exists(Path.Combine(path, "MusicPackInformation.json")))
|
||||||
|
{
|
||||||
|
MusicPackMetaData blankMetaData = new MusicPackMetaData("Omegas's Music Data Example", "Omegasis", "Just a simple example of how metadata is formated for music packs. Feel free to copy and edit this one!", "1.0.0 CoolExample");
|
||||||
|
blankMetaData.writeToJson(Path.Combine(path, "MusicPackInformation.json"));
|
||||||
|
}
|
||||||
|
if (!File.Exists(Path.Combine(path, "readme.txt")))
|
||||||
|
{
|
||||||
|
string info = "Place the .wav song files in the Songs folder, modify the MusicPackInformation.json as desired, and then run!";
|
||||||
|
File.WriteAllText(Path.Combine(path, "readme.txt"), info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void loadXACTMusicPacks()
|
public static void loadXACTMusicPacks()
|
||||||
{
|
{
|
||||||
|
@ -155,6 +180,23 @@ namespace StardewSymphonyRemastered
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void loadWAVMusicPacks()
|
||||||
|
{
|
||||||
|
string[] listOfDirectories = Directory.GetDirectories(WavMusicDirectory);
|
||||||
|
foreach (string folder in listOfDirectories)
|
||||||
|
{
|
||||||
|
string metaData = Path.Combine(folder, "MusicPackInformation.json");
|
||||||
|
|
||||||
|
if (!File.Exists(metaData))
|
||||||
|
{
|
||||||
|
ModMonitor.Log("WARNING! Loading in a music pack from: " + folder + ". There is no MusicPackInformation.json associated with this music pack meaning that while songs can be played from this pack, no information about it will be displayed.", LogLevel.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
StardewSymphonyRemastered.Framework.WavMusicPack musicPack = new WavMusicPack(folder);
|
||||||
|
musicManager.addMusicPack(musicPack,true,true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Raised when the player changes locations. This should determine the next song to play.
|
/// Raised when the player changes locations. This should determine the next song to play.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -175,9 +217,6 @@ namespace StardewSymphonyRemastered
|
||||||
StardewSymphonyRemastered.Framework.SongSpecifics.addLocations();
|
StardewSymphonyRemastered.Framework.SongSpecifics.addLocations();
|
||||||
StardewSymphonyRemastered.Framework.SongSpecifics.addFestivals();
|
StardewSymphonyRemastered.Framework.SongSpecifics.addFestivals();
|
||||||
StardewSymphonyRemastered.Framework.SongSpecifics.addEvents();
|
StardewSymphonyRemastered.Framework.SongSpecifics.addEvents();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Framework\MusicPackMetaData.cs" />
|
<Compile Include="Framework\MusicPackMetaData.cs" />
|
||||||
|
<Compile Include="Framework\Song.cs" />
|
||||||
<Compile Include="StaticExtentions.cs" />
|
<Compile Include="StaticExtentions.cs" />
|
||||||
<Compile Include="StardewSymphony.cs" />
|
<Compile Include="StardewSymphony.cs" />
|
||||||
<Compile Include="Framework\MusicHexProcessor.cs" />
|
<Compile Include="Framework\MusicHexProcessor.cs" />
|
||||||
|
|
Loading…
Reference in New Issue