diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicPack.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicPack.cs index d60a0943..286b3cd3 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicPack.cs +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/MusicPack.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; +using NAudio.Vorbis; using NAudio.Wave; using StardewModdingAPI; using StardewValley; @@ -166,10 +167,6 @@ namespace StardewSymphonyRemastered.Framework DirectoryInfo songFolder = new DirectoryInfo(Path.Combine(this.ContentPack.DirectoryPath, this.MusicFolderName)); foreach (FileInfo file in songFolder.GetFiles()) { - //MemoryStream memoryStream = new MemoryStream(); - //AudioFileReader fileReader = new AudioFileReader(file.FullName); - //fileReader.CopyTo(memoryStream); - // get name string name = Path.GetFileNameWithoutExtension(file.Name); if (this.Sounds.ContainsKey(name)) @@ -190,7 +187,7 @@ namespace StardewSymphonyRemastered.Framework using (WaveStream pcmStream = WaveFormatConversionStream.CreatePcmStream(reader)) { string tempPath = Path.Combine(songFolder.FullName, $"{name}.wav"); - StardewSymphony.ModMonitor.Log($"MP3 CONVERT! {tempPath}"); + StardewSymphony.ModMonitor.Log($"Converting: {tempPath}"); WaveFileWriter.CreateWaveFile(tempPath, pcmStream); using (Stream tempStream = File.OpenRead(tempPath)) @@ -199,6 +196,20 @@ namespace StardewSymphonyRemastered.Framework } break; + case ".ogg": + // Credits: https://social.msdn.microsoft.com/Forums/vstudio/en-US/100a97af-2a1c-4b28-b464-d43611b9b5d6/converting-multichannel-ogg-to-stereo-wav-file?forum=csharpgeneral + using (VorbisWaveReader vorbisStream = new VorbisWaveReader(file.FullName)) + { + string tempPath = Path.Combine(songFolder.FullName, $"{name}.wav"); + StardewSymphony.DebugLog($"Converting: {tempPath}"); + + WaveFileWriter.CreateWaveFile(tempPath, vorbisStream.ToWaveProvider16()); + using (Stream tempStream = File.OpenRead(tempPath)) + effect = SoundEffect.FromStream(tempStream); + File.Delete(tempPath); + } + break; + default: StardewSymphony.ModMonitor.Log($"Unsupported file extension {file.Extension}.", LogLevel.Warn); break; diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/README.md b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/README.md index 07eacc8c..48b1eb79 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/README.md +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/README.md @@ -58,8 +58,8 @@ To create a content pack: 1. [Create a standard content pack](https://stardewvalleywiki.com/Modding:Content_packs), using `Omegasis.StardewSymphonyRemastered` as the 'content pack for' ID. 2. Add an `icon.png` image, which is the album logo to show in-game. -2. Create a `songs` subfolder containing the `.mp3` or `.wav` files to include. The file names - (without extensions) will be shown in-game as the song names. +2. Create a `songs` subfolder containing the `.mp3`, `.ogg`, or `.wav` files to include. The file + names (without extensions) will be shown in-game as the song names. ## For SMAPI mod creators You can reference Stardew Symphony in your own SMAPI mods in order to add new events, festivals, diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphonyRemastered.csproj b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphonyRemastered.csproj index 5038df1a..6c6097a1 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphonyRemastered.csproj +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/StardewSymphonyRemastered.csproj @@ -67,6 +67,7 @@ + diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/manifest.json b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/manifest.json index 131da877..84679222 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/manifest.json +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/manifest.json @@ -1,7 +1,7 @@ { "Name": "Stardew Symphony Remastered", "Author": "Alpha_Omegasis", - "Version": "2.2.0", + "Version": "2.3.0", "Description": "Adding more music to the game one beep at a time. Now with streaming!", "UniqueID": "Omegasis.StardewSymphonyRemastered", "EntryDll": "StardewSymphonyRemastered.dll",