diff --git a/GeneralMods/StardewSymphony/Framework/SongsProcessor/MusicPack.cs b/GeneralMods/StardewSymphony/Framework/SongsProcessor/MusicPack.cs new file mode 100644 index 00000000..46ec95f3 --- /dev/null +++ b/GeneralMods/StardewSymphony/Framework/SongsProcessor/MusicPack.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.StardewSymphony.Framework.SongsProcessor +{ + public class MusicPack + { + public MusicPackMetaData musicPackInformation; + public List listOfAllSongs; + + + public MusicPack(string Name,string pathToFiles) + { + string extentionInformation = Path.GetExtension(pathToFiles); + + + if (extentionInformation==".xwb") { + this.musicPackInformation = new MusicPackMetaData(Name,pathToFiles); + } + else + { + this.musicPackInformation = new MusicPackMetaData(Name); + this.getAllWavFileFromDirectory(); + } + } + + public void getAllWavFileFromDirectory() + { + string[] files = System.IO.Directory.GetFiles(musicPackInformation.fileLocation, "*.wav"); + + foreach(var s in files) + { + Song song = new Song(Path.GetFileName(musicPackInformation.fileLocation), s, false); + this.listOfAllSongs.Add(song); + } + } + + public void playSong(string name) + { + Song song = returnSong(name); + if (song != null) + { + song.play(); + } + } + + public void stopSong(string name) + { + Song song = returnSong(name); + if (song != null) + { + song.stop(); + } + } + + public void resumeSong(string name) + { + Song song = returnSong(name); + if (song != null) + { + song.resume(); + } + } + + public void pauseSong(string name) + { + Song song = returnSong(name); + if (song != null) + { + song.pause(); + } + } + + public void changeVolume(string name,float amount) + { + Song song = returnSong(name); + if (song != null) + { + song.changeVolume(amount); + } + } + + /// + /// Get's the song from the list. + /// + /// + /// + public Song returnSong(string Name) + { + return listOfAllSongs.Find(item => item.name == Name); + } + + + } +} diff --git a/GeneralMods/StardewSymphony/Framework/SongsProcessor/MusicPackMetaData.cs b/GeneralMods/StardewSymphony/Framework/SongsProcessor/MusicPackMetaData.cs new file mode 100644 index 00000000..a3e87ce9 --- /dev/null +++ b/GeneralMods/StardewSymphony/Framework/SongsProcessor/MusicPackMetaData.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.StardewSymphony.Framework.SongsProcessor +{ + public class MusicPackMetaData + { + public string name; + public string fileLocation; + public bool xwbWavePack; + + + /// + /// Constructor for non-xwb music packs + /// + /// + public MusicPackMetaData(string name) + { + + this.name = name; + this.xwbWavePack = false; + } + + /// + /// Constructor for xnb music packs + /// + /// + /// + public MusicPackMetaData(string name,string fileLocation) + { + this.name = name; + this.fileLocation = fileLocation; + this.xwbWavePack = true; + } + + } +} diff --git a/GeneralMods/StardewSymphony/Framework/SongsProcessor/Song.cs b/GeneralMods/StardewSymphony/Framework/SongsProcessor/Song.cs new file mode 100644 index 00000000..97e22b43 --- /dev/null +++ b/GeneralMods/StardewSymphony/Framework/SongsProcessor/Song.cs @@ -0,0 +1,221 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.StardewSymphony.Framework.SongsProcessor +{ + public class Song + { + public string name; + public string fileLocation; + public bool existsInMusicXNBFile; + + + public DynamicSoundEffectInstance dynamicSound; + public int position; + public int count; + public byte[] byteArray; + + public EventHandler bufferHandler; + + public SongsProcessor.SongState songState; + + /// + /// Constructor. + /// + /// Name of the song. + /// Path to the song. + /// Checks if this song comes from a .xwb file or a .wav file. + public Song(string Name, string FileLocation, bool ExistsInXNBWavePack) + { + this.name = Name; + this.fileLocation = FileLocation; + this.existsInMusicXNBFile = ExistsInXNBWavePack; + } + + /// + /// Load the song from the path so that we can stream it. + /// + /// + public DynamicSoundEffectInstance loadSongIntoStream() + { + + System.IO.Stream waveFileStream = TitleContainer.OpenStream(this.fileLocation); + + BinaryReader reader = new BinaryReader(waveFileStream); + + int chunkID = reader.ReadInt32(); + int fileSize = reader.ReadInt32(); + int riffType = reader.ReadInt32(); + int fmtID = reader.ReadInt32(); + int fmtSize = reader.ReadInt32(); + int fmtCode = reader.ReadInt16(); + int channels = reader.ReadInt16(); + int sampleRate = reader.ReadInt32(); + int fmtAvgBPS = reader.ReadInt32(); + int fmtBlockAlign = reader.ReadInt16(); + int bitDepth = reader.ReadInt16(); + + if (fmtSize == 18) + { + // Read any extra values + int fmtExtraSize = reader.ReadInt16(); + reader.ReadBytes(fmtExtraSize); + } + + int dataID = reader.ReadInt32(); + int dataSize = reader.ReadInt32(); + + byteArray = reader.ReadBytes(dataSize); + + dynamicSound = new DynamicSoundEffectInstance(sampleRate, (AudioChannels)channels); + count = dynamicSound.GetSampleSizeInBytes(TimeSpan.FromMilliseconds(100)); + bufferHandler= new EventHandler(DynamicSound_BufferNeeded); + dynamicSound.BufferNeeded += bufferHandler; + + return this.dynamicSound; + } + + /// + /// Null the song out so that we can remove it from memory and switch to another song??? + /// + public void unloadSongFromStream() + { + dynamicSound.Stop(); + dynamicSound.BufferNeeded -= bufferHandler; + dynamicSound = null; + } + + /// + /// Taken from an example. I'm sure this is necessary to keep streaming the audio. + /// + /// + /// + void DynamicSound_BufferNeeded(object sender, EventArgs e) + { + dynamicSound.SubmitBuffer(byteArray, position, count / 2); + dynamicSound.SubmitBuffer(byteArray, position + count / 2, count / 2); + + position += count; + if (position + count > byteArray.Length) + { + position = 0; + } + } + + /// + /// Stop the currently playing song. + /// + public void stop() + { + if (this.dynamicSound != null) + { + if(this.songState==SongState.Playing || this.songState == SongState.Paused) + { + this.dynamicSound.Stop(); + this.songState = SongState.Stopped; + } + } + } + + /// + /// Plays the current song. + /// + public void play() + { + if (this.dynamicSound != null) + { + if (getSongState() == SongState.Stopped || getSongState() == SongState.Paused) + { + this.dynamicSound.Play(); + this.songState = SongState.Playing; + } + } + } + + + /// + /// Resume the current song from being paused. + /// + public void resume() + { + if (this.dynamicSound != null) + { + if (getSongState() == SongState.Stopped || getSongState() == SongState.Paused) + { + this.dynamicSound.Resume(); + this.songState = SongState.Playing; + } + } + } + + /// + /// Pauses the current song. + /// + public void pause() + { + if (getSongState() == SongState.Playing || getSongState() == SongState.Stopped) + { + this.dynamicSound.Pause(); + this.songState = SongState.Paused; + } + } + + /// + /// Changes the volume of the song playing. + /// + /// + public void changeVolume(float newVolumeAmount) + { + if (this.dynamicSound != null) + { + this.dynamicSound.Volume = newVolumeAmount; + } + } + + /// + /// Returns the state of the song so that users know if the song is playing, stopped, or paused. + /// + /// + public SongState getSongState() + { + return this.songState; + } + + + /// + /// Checks if the song is playing or not. + /// + /// + public bool isPlaying() + { + if (getSongState() == SongState.Playing) return true; + else return false; + } + + /// + /// Checks is the song is paused or not. + /// + /// + public bool isPaused() + { + if (getSongState() == SongState.Paused) return true; + else return false; + } + + /// + /// Checks if the song is stopped or not. + /// + /// + public bool isStopped() + { + if (getSongState() == SongState.Stopped) return true; + else return false; + } + } +} diff --git a/GeneralMods/StardewSymphony/Framework/SongsProcessor/SongState.cs b/GeneralMods/StardewSymphony/Framework/SongsProcessor/SongState.cs new file mode 100644 index 00000000..ca25c986 --- /dev/null +++ b/GeneralMods/StardewSymphony/Framework/SongsProcessor/SongState.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.StardewSymphony.Framework.SongsProcessor +{ + public enum SongState + { + /// The song is currently playing. + Playing, + + /// The song is currently paused. + Paused, + + /// The song is currently stopped. + Stopped + } +} diff --git a/GeneralMods/StardewSymphony/Framework/SongsProcessor/WaveFile.cs b/GeneralMods/StardewSymphony/Framework/SongsProcessor/WaveFile.cs new file mode 100644 index 00000000..e35ac3a4 Binary files /dev/null and b/GeneralMods/StardewSymphony/Framework/SongsProcessor/WaveFile.cs differ diff --git a/GeneralMods/StardewSymphony/StardewSymphony.cs b/GeneralMods/StardewSymphony/StardewSymphony.cs index 8d1a83e8..614d3704 100644 --- a/GeneralMods/StardewSymphony/StardewSymphony.cs +++ b/GeneralMods/StardewSymphony/StardewSymphony.cs @@ -154,7 +154,7 @@ namespace Omegasis.StardewSymphony } // init sound - this.HexProcessor.ProcessHex(); + this.HexProcessor.ProcessHex(); //Get all of the songs from the music packs. this.SelectMusic(); } diff --git a/GeneralMods/StardewSymphony/StardewSymphony.csproj b/GeneralMods/StardewSymphony/StardewSymphony.csproj index 0378e92d..47723424 100644 --- a/GeneralMods/StardewSymphony/StardewSymphony.csproj +++ b/GeneralMods/StardewSymphony/StardewSymphony.csproj @@ -40,6 +40,11 @@ Properties\GlobalAssemblyInfo.cs + + + + + diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered.sln b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered.sln new file mode 100644 index 00000000..93d924f2 --- /dev/null +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 14 for Windows Desktop +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StardewSymphonyRemastered", "StardewSymphonyRemastered\StardewSymphonyRemastered.csproj", "{19F64B03-6A9B-49E1-854A-C05D5A014646}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19F64B03-6A9B-49E1-854A-C05D5A014646}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19F64B03-6A9B-49E1-854A-C05D5A014646}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19F64B03-6A9B-49E1-854A-C05D5A014646}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19F64B03-6A9B-49E1-854A-C05D5A014646}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Class1.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Class1.cs new file mode 100644 index 00000000..804df5b8 --- /dev/null +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Class1.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using Microsoft.Xna.Framework.Audio; +using StardewModdingAPI; +using StardewValley; + +namespace StardewSymphonyRemastered +{ + + /// + /// BIG WIP. Don't use this at all because it does nothing right now. + /// TODO: + /// 1.Make Xwb packs work + /// 2.Make stream files work + /// 2.5. Make Music Manager + /// 3.Make interface. + /// 4.Make sure stuff doesn't blow up. + /// 5.Release + /// 6.Make videos documenting how to make this mod work. + /// 7.Make way to generate new music packs. + /// + public class Class1 : Mod + { + public static WaveBank DefaultWaveBank; + public static SoundBank DefaultSoundBank; + + + public override void Entry(IModHelper helper) + { + DefaultSoundBank = Game1.soundBank; + DefaultWaveBank = Game1.waveBank; + + StardewModdingAPI.Events.SaveEvents.AfterLoad += SaveEvents_AfterLoad; + } + + /// + /// + /// + /// + /// + private void SaveEvents_AfterLoad(object sender, EventArgs e) + { + StardewSymphonyRemastered.Framework.SongSpecifics.addLocations(); + StardewSymphonyRemastered.Framework.SongSpecifics.addFestivals(); + StardewSymphonyRemastered.Framework.SongSpecifics.addEvents(); + } + + + /// + /// Reset the music files for the game. + /// + public static void Reset() + { + Game1.waveBank = DefaultWaveBank; + Game1.soundBank = DefaultSoundBank; + } + + } +} diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/MusicHexProcessor.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/MusicHexProcessor.cs new file mode 100644 index 00000000..ff1d889b --- /dev/null +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/MusicHexProcessor.cs @@ -0,0 +1,188 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using StardewValley; +using StardewSymphonyRemastered.Framework; + +namespace StardewSymphonyRemastered.Framework +{ + public class MusicHexProcessor + { + /********* + ** Properties + *********/ + /// All of the music/soundbanks and their locations. + private readonly XwbMusicPack MasterList; + + /// The registered soundbanks. + private readonly List SoundBanks = new List(); + + /// The callback to reset the game audio. + private readonly Action Reset; + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// All of the music/soundbanks and their locations. + /// The callback to reset the game audio. + public MusicHexProcessor(XwbMusicPack masterList, Action reset) + { + this.MasterList = masterList; + this.Reset = reset; + } + + /// Add a file path to the list of soundbanks. + /// The soundbank file path. + public void AddSoundBank(string path) + { + this.SoundBanks.Add(path); + } + + public static List ProcessSongNamesFromHex(XwbMusicPack musicPack, Action reset, string FileName) + { + int counter = 0; + List cleanCueNames = new List(); + byte[] array = File.ReadAllBytes(FileName); + string rawName = FileName.Substring(0, FileName.Length - 4); + string cueName = rawName + "CueList.txt"; + + if (File.Exists(cueName)) + { + string[] arr = File.ReadAllLines(cueName); + List names = new List(); + foreach(var v in arr) + { + names.Add(v); + } + return names; + } + string hexDumpContents = HexDump(array); + + string rawHexName = rawName + "HexDump.txt"; + File.WriteAllText(rawHexName, hexDumpContents); + + string[] readText = File.ReadAllLines(rawHexName); + string largeString = ""; + foreach (var line in readText) + { + try + { + string newString = ""; + for (int i = 62; i <= 77; i++) + newString += line[i]; + largeString += newString; + } + catch { } + } + string[] splits = largeString.Split('ÿ'); + string fix = ""; + foreach (string s in splits) + { + if (s == "") continue; + fix += s; + } + splits = fix.Split('.'); + + foreach (var split in splits) + { + if (split == "") continue; + + try + { + Game1.waveBank = musicPack.WaveBank; + Game1.soundBank = musicPack.SoundBank; + + if (Game1.soundBank.GetCue(split) != null) + cleanCueNames.Add(split); + + reset.Invoke(); + } + catch { } + } + + return cleanCueNames; + } + + /********* + ** Private methods + *********/ + public static string HexDump(byte[] bytes, int bytesPerLine = 16) + { + if (bytes == null) + return ""; + + int bytesLength = bytes.Length; + + char[] hexChars = "0123456789ABCDEF".ToCharArray(); + + int firstHexColumn = + 8 // 8 characters for the address + + 3; // 3 spaces + + int firstCharColumn = firstHexColumn + + bytesPerLine * 3 // - 2 digit for the hexadecimal value and 1 space + + (bytesPerLine - 1) / 8 // - 1 extra space every 8 characters from the 9th + + 2; // 2 spaces + + int lineLength = firstCharColumn + + bytesPerLine // - characters to show the ascii value + + Environment.NewLine.Length; // Carriage return and line feed (should normally be 2) + + char[] line = (new String(' ', lineLength - 2) + Environment.NewLine).ToCharArray(); + int expectedLines = (bytesLength + bytesPerLine - 1) / bytesPerLine; + StringBuilder result = new StringBuilder(expectedLines * lineLength); + + for (int i = 0; i < bytesLength; i += bytesPerLine) + { + line[0] = hexChars[(i >> 28) & 0xF]; + line[1] = hexChars[(i >> 24) & 0xF]; + line[2] = hexChars[(i >> 20) & 0xF]; + line[3] = hexChars[(i >> 16) & 0xF]; + line[4] = hexChars[(i >> 12) & 0xF]; + line[5] = hexChars[(i >> 8) & 0xF]; + line[6] = hexChars[(i >> 4) & 0xF]; + line[7] = hexChars[(i >> 0) & 0xF]; + + int hexColumn = firstHexColumn; + int charColumn = firstCharColumn; + + for (int j = 0; j < bytesPerLine; j++) + { + if (j > 0 && (j & 7) == 0) hexColumn++; + if (i + j >= bytesLength) + { + line[hexColumn] = ' '; + line[hexColumn + 1] = ' '; + line[charColumn] = ' '; + } + else + { + byte b = bytes[i + j]; + line[hexColumn] = hexChars[(b >> 4) & 0xF]; + line[hexColumn + 1] = hexChars[b & 0xF]; + line[charColumn] = GetAsciiSymbol(b); + } + hexColumn += 3; + charColumn++; + } + result.Append(line); + } + return result.ToString(); + } + + public static char GetAsciiSymbol(byte ch) + { + if (ch < 32) return '.'; // Non-printable ASCII + if (ch < 127) return (char)ch; // Normal ASCII + // Handle the hole in Latin-1 + if (ch == 127) return '.'; + if (ch < 0x90) return "€.‚ƒ„…†‡ˆ‰Š‹Œ.Ž."[ch & 0xF]; + if (ch < 0xA0) return ".‘’“”•–—˜™š›œ.žŸ"[ch & 0xF]; + if (ch == 0xAD) return '.'; // Soft hyphen: this symbol is zero-width even in monospace fonts + return (char)ch; // Normal Latin-1 + } + } +} diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/MusicManager.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/MusicManager.cs new file mode 100644 index 00000000..c29031dc --- /dev/null +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/MusicManager.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StardewSymphonyRemastered.Framework +{ + /// + /// TODO: Make this manage all of the music. + /// + public class MusicManager + { + } +} diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/MusicPack.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/MusicPack.cs new file mode 100644 index 00000000..8c0a2249 --- /dev/null +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/MusicPack.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StardewSymphonyRemastered.Framework +{ + /// + /// A base class that xnb and wav packs will derive commonalities from. + /// + public class MusicPack + { + public string name; + public string directory; + public List listOfSongs; + + + public virtual void playSong(string name) + { + + } + + public virtual void pauseSong(string name) + { + + } + + public virtual void stopSong(string name) + { + + } + + public virtual void returnSong(string name) + { + + } + + public virtual void loadMusicFiles() + { + + } + + } +} diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/SongSpecifics.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/SongSpecifics.cs new file mode 100644 index 00000000..efdab828 --- /dev/null +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/SongSpecifics.cs @@ -0,0 +1,289 @@ +using StardewValley; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StardewSymphonyRemastered.Framework +{ + /// + /// Stores information about what songs play when. + /// + public class SongSpecifics + { + Dictionary> listOfSongsWithTriggers; //triggerName, + + Dictionary> eventSongs; + + Dictionary> festivalSongs; + + public static List locations = new List(); + public static List festivals = new List(); + public static List events = new List(); + + string[] seasons; + string[] weather; + string[] daysOfWeek; + string[] timesOfDay; + char seperator = '_'; + + /// + /// Constructor. + /// + public SongSpecifics() + { + seasons = new string[] + { + "spring", + "summer", + "fall", + "winter" + }; + + weather = new string[] + { + "sunny", + "rainy", + "debris", + "lightning", + "festival", + "snow", + "wedding" + }; + daysOfWeek = new string[] + { + "sunday", + "monday", + "tuesday", + "wednesday", + "thursday", + "friday", + "saturday" + }; + timesOfDay = new string[] + { + "day", + "night" + }; + + listOfSongsWithTriggers = new Dictionary>(); + eventSongs = new Dictionary>(); + festivalSongs = new Dictionary>(); + + this.addSongLists(); + + } + + /// + /// Initialize the location lists with the names of all of the major locations in the game. + /// + public static void addLocations() + { + foreach(var v in Game1.locations) + { + locations.Add(v.name); + } + } + + /// + /// TODO: Find a way to get all of the festivals in the game for this list. Perhapse have a way to check the season and day of the month and equivilate it to something. + /// Initialize list of festivals for the game. + /// + public static void addFestivals() + { + //Do some logic for festivals here. + } + + /// + /// Add a specific new festival to the list + /// + public static void addFestival(string name) + { + festivals.Add(name); + } + + /// + /// TODO: Get a list of all of the vanilla events in the game. But how to determine what event is playing is the question. + /// + /// + public static void addEvents() + { + //Do some logic here + } + + /// + /// TODO: Custom way to add in event to hijack music. + /// + /// + public static void addEvent(string name) + { + //Do some logic here + } + + /// + /// Add a location to the loctaion list. + /// + /// + public static void addLocation(string name) + { + locations.Add(name); + } + + /// + /// A pretty big function to add in all of the specific songs that play at certain locations_seasons_weather_dayOfWeek_times. + /// + public void addSongLists() + { + foreach (var loc in Game1.locations) + { + foreach (var season in seasons) + { + listOfSongsWithTriggers.Add(loc.name + seperator + season, new List()); + foreach(var Weather in weather) + { + listOfSongsWithTriggers.Add(loc.name + seperator + season + seperator + Weather, new List()); + foreach(var day in daysOfWeek) + { + listOfSongsWithTriggers.Add(loc.name + seperator + season + seperator + Weather + seperator + day, new List()); + foreach(var time in timesOfDay) + { + listOfSongsWithTriggers.Add(loc.name + seperator + season + seperator + Weather + seperator + day + seperator + time, new List()); + } + } + } + } + } + + //Add in some default seasonal music because maybe a location doesn't have some music? + foreach (var season in seasons) + { + listOfSongsWithTriggers.Add(season, new List()); + foreach (var Weather in weather) + { + listOfSongsWithTriggers.Add( season + seperator + Weather, new List()); + foreach (var day in daysOfWeek) + { + listOfSongsWithTriggers.Add(season + seperator + Weather + seperator + day, new List()); + foreach (var time in timesOfDay) + { + listOfSongsWithTriggers.Add(season + seperator + Weather + seperator + day + seperator + time, new List()); + } + } + } + } + } + + /// + /// TODO: Add functionality for events and festivals + /// Sum up some conditionals to parse the correct string key to access the songs list. + /// + /// + public string getCurrentConditionalString() + { + string key = ""; + if (Game1.eventUp == true) + { + //Get the event id an hijack it with some different music + } + else if (Game1.isFestival()) + { + //hijack the name of the festival and load some different songs + } + /* + else if (Game1.eventUp == false && Game1.isFestival() == false && Game1.currentSpeaker != null) + { + //get the speaker's name and play their theme song? + } + */ + else + { + key = getLocationString()+seperator+ getSeasonNameString() + seperator + getWeatherString() + seperator + getDayOfWeekString() + seperator + getTimeOfDayString(); + } + return key; + } + + /// + /// Get the name of the day of the week from what game day it is. + /// + /// + public static string getDayOfWeekString() + { + int day = Game1.dayOfMonth; + int dayOfWeek = day % 7; + if (dayOfWeek == 0) + { + return "sunday"; + } + if (dayOfWeek == 1) + { + return "monday"; + } + if (dayOfWeek == 2) + { + return "tuesday"; + } + if (dayOfWeek == 3) + { + return "wednesday"; + } + if (dayOfWeek == 4) + { + return "thursday"; + } + if (dayOfWeek == 5) + { + return "friday"; + } + if (dayOfWeek == 6) + { + return "saturday"; + } + return ""; + } + + /// + /// Get the name of the current season + /// + /// + public static string getSeasonNameString() + { + return Game1.currentSeason.ToLower(); + } + + /// + /// Get the name for the current weather outside. + /// + /// + public static string getWeatherString() + { + if (Game1.weatherIcon == Game1.weather_sunny) return "sunny"; + if (Game1.weatherIcon == Game1.weather_rain) return "rainy"; + if (Game1.weatherIcon == Game1.weather_debris) return "debris"; + if (Game1.weatherIcon == Game1.weather_lightning) return "lightning"; + if (Game1.weatherIcon == Game1.weather_festival) return "festival"; + if (Game1.weatherIcon == Game1.weather_snow) return "snow"; + if (Game1.weatherIcon == Game1.weather_wedding) return "wedding"; + return ""; + } + + /// + /// Get the name for the time of day that it currently is. + /// + /// + public static string getTimeOfDayString() + { + if (Game1.timeOfDay< Game1.getModeratelyDarkTime()) return "day"; + else return "night"; + } + + /// + /// Get the name of the location of where I am at. + /// + /// + public static string getLocationString() + { + return Game1.currentLocation.name; + } + } +} diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/WavMusicPack.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/WavMusicPack.cs new file mode 100644 index 00000000..271638a4 --- /dev/null +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/WavMusicPack.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StardewSymphonyRemastered.Framework +{ + /// + /// TODO: Make this class + /// + class WavMusicPack : MusicPack + { + } +} diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/XwbMusicPack.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/XwbMusicPack.cs new file mode 100644 index 00000000..b481cff3 --- /dev/null +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/XwbMusicPack.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StardewSymphonyRemastered.Framework +{ + /// + /// TODO: Make this work and add in overrided functions. + /// + public class XwbMusicPack: MusicPack + { + public Microsoft.Xna.Framework.Audio.WaveBank WaveBank; + public Microsoft.Xna.Framework.Audio.SoundBank SoundBank; + + public StardewSymphonyRemastered.Framework.SongSpecifics songInformation; + + public string XWBPath; + + public XwbMusicPack(string name, string directoryToXwb,string pathToXWB) + { + this.name = name; + this.directory = directoryToXwb; + this.XWBPath = pathToXWB; + this.songInformation = new SongSpecifics(); + } + + public override void loadMusicFiles() + { + this.listOfSongs=StardewSymphonyRemastered.Framework.MusicHexProcessor.ProcessSongNamesFromHex(this,Class1.Reset,this.XWBPath); + } + } +} diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Properties/AssemblyInfo.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..9769ec10 --- /dev/null +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("StardewSymphonyRemastered")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("StardewSymphonyRemastered")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("19f64b03-6a9b-49e1-854a-c05d5a014646")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphonyRemastered.csproj b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphonyRemastered.csproj new file mode 100644 index 00000000..27350751 --- /dev/null +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphonyRemastered.csproj @@ -0,0 +1,72 @@ + + + + + Debug + AnyCPU + {19F64B03-6A9B-49E1-854A-C05D5A014646} + Library + Properties + StardewSymphonyRemastered + StardewSymphonyRemastered + v4.5 + 512 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/packages.config b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/packages.config new file mode 100644 index 00000000..028670c6 --- /dev/null +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file