Updated SSM to allow for playing/stoping of sound files.
This commit is contained in:
parent
8f0f692a60
commit
c474ce1a8d
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SimpleSoundManager.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface used for common sound functionality;
|
||||
/// </summary>
|
||||
public interface Sound
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles playing a sound.
|
||||
/// </summary>
|
||||
void play();
|
||||
/// <summary>
|
||||
/// Handles pausing a song.
|
||||
/// </summary>
|
||||
void pause();
|
||||
/// <summary>
|
||||
/// Handles stopping a song.
|
||||
/// </summary>
|
||||
void stop();
|
||||
/// <summary>
|
||||
/// Handles restarting a song.
|
||||
/// </summary>
|
||||
void restart();
|
||||
/// <summary>
|
||||
/// Handles getting a clone of the song.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Sound clone();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,216 @@
|
|||
using Microsoft.Xna.Framework.Audio;
|
||||
using StardewModdingAPI;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SimpleSoundManager.Framework
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// TODO:
|
||||
/// Pause sounds.
|
||||
/// </summary>
|
||||
public class SoundManager
|
||||
{
|
||||
|
||||
public Dictionary<string,Sound> sounds;
|
||||
public Dictionary<string, XACTMusicPair> musicBanks;
|
||||
public KeyValuePair<string,Sound> previousSound;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for this class.
|
||||
/// </summary>
|
||||
public SoundManager()
|
||||
{
|
||||
this.sounds = new Dictionary<string, Sound>();
|
||||
this.musicBanks = new Dictionary<string, XACTMusicPair>();
|
||||
this.previousSound = new KeyValuePair<string, Sound>("", null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for wav files.
|
||||
/// </summary>
|
||||
/// <param name="soundName"></param>
|
||||
/// <param name="pathToWav"></param>
|
||||
public void loadWavFile(string soundName,string pathToWav)
|
||||
{
|
||||
WavSound wav = new WavSound(pathToWav);
|
||||
this.sounds.Add(soundName,wav);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for wav files.
|
||||
/// </summary>
|
||||
/// <param name="helper"></param>
|
||||
/// <param name="soundName"></param>
|
||||
/// <param name="pathToWav"></param>
|
||||
public void loadWavFile(IModHelper helper,string soundName,string pathToWav)
|
||||
{
|
||||
WavSound wav = new WavSound(helper ,pathToWav);
|
||||
this.sounds.Add(soundName,wav);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for wav files.
|
||||
/// </summary>
|
||||
/// <param name="helper"></param>
|
||||
/// <param name="songName"></param>
|
||||
/// <param name="pathToWav"></param>
|
||||
public void loadWavFile(IModHelper helper,string songName,List<string> pathToWav)
|
||||
{
|
||||
WavSound wav = new WavSound(helper,pathToWav);
|
||||
this.sounds.Add(songName,wav);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for XACT files.
|
||||
/// </summary>
|
||||
/// <param name="waveBank"></param>
|
||||
/// <param name="soundBank"></param>
|
||||
/// <param name="songName"></param>
|
||||
public void loadXACTFile(WaveBank waveBank, ISoundBank soundBank, string songName)
|
||||
{
|
||||
XACTSound xactSound = new XACTSound(waveBank, soundBank, songName);
|
||||
this.sounds.Add(songName, xactSound);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for XACT files based on already added music packs.
|
||||
/// </summary>
|
||||
/// <param name="pairName"></param>
|
||||
/// <param name="songName"></param>
|
||||
public void loadXACTFile(string pairName, string songName)
|
||||
{
|
||||
XACTMusicPair musicPair = getMusicPack(pairName);
|
||||
if (pairName == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
loadXACTFile(musicPair.waveBank, musicPair.soundBank, songName);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a music pack pair that holds .xwb and .xsb music files.
|
||||
/// </summary>
|
||||
/// <param name="helper">The mod's helper that will handle the path of the files.</param>
|
||||
/// <param name="pairName">The name of this music pack pair.</param>
|
||||
/// <param name="wavName">The relative path to the .xwb file</param>
|
||||
/// <param name="soundName">The relative path to the .xsb file</param>
|
||||
public void loadXACTMusicBank(IModHelper helper,string pairName,string wavName, string soundName)
|
||||
{
|
||||
this.musicBanks.Add(pairName,new XACTMusicPair(helper, wavName, soundName));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the music pack pair from the sound pool.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public XACTMusicPair getMusicPack(string name)
|
||||
{
|
||||
foreach(var pack in this.musicBanks)
|
||||
{
|
||||
if (name == pack.Key) return pack.Value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a clone of the loaded sound.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public Sound getSoundClone(string name)
|
||||
{
|
||||
foreach(var sound in this.sounds)
|
||||
{
|
||||
if (sound.Key == name) return sound.Value.clone();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the sound with the associated name.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public Sound getSound(string name)
|
||||
{
|
||||
Sound s;
|
||||
bool exists=this.sounds.TryGetValue(name,out s);
|
||||
if (exists)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Plays the sound with the associated name.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public void playSound(string name)
|
||||
{
|
||||
Sound s;
|
||||
bool exists = this.sounds.TryGetValue(name, out s);
|
||||
if (exists)
|
||||
{
|
||||
s.play();
|
||||
previousSound = new KeyValuePair<string, Sound>(name, s);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the sound with the associated name.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public void stopSound(string name)
|
||||
{
|
||||
Sound s;
|
||||
bool exists = this.sounds.TryGetValue(name, out s);
|
||||
if (exists)
|
||||
{
|
||||
s.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the previously playing sound.
|
||||
/// </summary>
|
||||
public void stopPreviousSound()
|
||||
{
|
||||
if (previousSound.Key != "")
|
||||
{
|
||||
previousSound.Value.stop();
|
||||
previousSound = new KeyValuePair<string, Sound>("", null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the previously playing sound and plays a new sound.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public void swapSounds(string name)
|
||||
{
|
||||
if (previousSound.Key == "")
|
||||
{
|
||||
playSound(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
stopSound(previousSound.Key);
|
||||
playSound(name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,237 @@
|
|||
using Microsoft.Xna.Framework.Audio;
|
||||
using SimpleSoundManager.Framework;
|
||||
using StardewModdingAPI;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SimpleSoundManager.Framework
|
||||
{
|
||||
public class WavSound : Sound
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Used to actually play the song.
|
||||
/// </summary>
|
||||
DynamicSoundEffectInstance dynamicSound;
|
||||
/// <summary>
|
||||
/// Used to keep track of where in the song we are.
|
||||
/// </summary>
|
||||
int position;
|
||||
/// <summary>
|
||||
/// ???
|
||||
/// </summary>
|
||||
int count;
|
||||
/// <summary>
|
||||
/// Used to store the info for the song.
|
||||
/// </summary>
|
||||
byte[] byteArray;
|
||||
|
||||
public List<string> sounds;
|
||||
|
||||
public string path;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a raw disk path to the wav file.
|
||||
/// </summary>
|
||||
/// <param name="pathToWavFile"></param>
|
||||
public WavSound(string pathToWavFile)
|
||||
{
|
||||
this.path = pathToWavFile;
|
||||
LoadWavFromFileToStream();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A constructor that takes a mod helper and a relative path to a wav file.
|
||||
/// </summary>
|
||||
/// <param name="modHelper"></param>
|
||||
/// <param name="pathInModDirectory"></param>
|
||||
public WavSound(IModHelper modHelper, string pathInModDirectory)
|
||||
{
|
||||
string path = Path.Combine(modHelper.DirectoryPath, pathInModDirectory);
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor that is more flexible than typing an absolute path.
|
||||
/// </summary>
|
||||
/// <param name="modHelper">The mod helper for the mod you wish to use to load the music files from.</param>
|
||||
/// <param name="pathPieces">The list of folders and files that make up a complete path.</param>
|
||||
public WavSound(IModHelper modHelper, List<string> pathPieces)
|
||||
{
|
||||
string s = modHelper.DirectoryPath;
|
||||
foreach(var str in pathPieces)
|
||||
{
|
||||
s = Path.Combine(s, str);
|
||||
}
|
||||
this.path = s;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads the .wav file from disk and plays it.
|
||||
/// </summary>
|
||||
public void LoadWavFromFileToStream()
|
||||
{
|
||||
// Create a new SpriteBatch, which can be used to draw textures.
|
||||
|
||||
string file = this.path;
|
||||
System.IO.Stream waveFileStream = File.OpenRead(file); //TitleContainer.OpenStream(file);
|
||||
|
||||
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(10000));
|
||||
|
||||
}
|
||||
|
||||
void DynamicSound_BufferNeeded(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
dynamicSound.SubmitBuffer(byteArray, position, count);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
position += count;
|
||||
if (position + count > byteArray.Length)
|
||||
{
|
||||
position = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to pause the current song.
|
||||
/// </summary>
|
||||
public void pause()
|
||||
{
|
||||
if (dynamicSound != null) dynamicSound.Pause();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to play a song.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public void play()
|
||||
{
|
||||
if (this.isPlaying() == true) return;
|
||||
dynamicSound.BufferNeeded += new EventHandler<EventArgs>(DynamicSound_BufferNeeded);
|
||||
dynamicSound.Play();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Used to resume the currently playing song.
|
||||
/// </summary>
|
||||
public void resume()
|
||||
{
|
||||
if (dynamicSound == null) return;
|
||||
dynamicSound.Resume();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to stop the currently playing song.
|
||||
/// </summary>
|
||||
public void stop()
|
||||
{
|
||||
|
||||
if (dynamicSound != null)
|
||||
{
|
||||
dynamicSound.Stop(true);
|
||||
dynamicSound.BufferNeeded -= new EventHandler<EventArgs>(DynamicSound_BufferNeeded);
|
||||
position = 0;
|
||||
count = 0;
|
||||
byteArray = new byte[0];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to change from one playing song to another;
|
||||
/// </summary>
|
||||
/// <param name="songName"></param>
|
||||
public void swap(string pathToNewWavFile)
|
||||
{
|
||||
this.stop();
|
||||
this.path = pathToNewWavFile;
|
||||
this.play();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the song is currently playing.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool isPlaying()
|
||||
{
|
||||
if (this.dynamicSound == null) return false;
|
||||
if (this.dynamicSound.State == SoundState.Playing) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the song is currently paused.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool isPaused()
|
||||
{
|
||||
if (this.dynamicSound == null) return false;
|
||||
if (this.dynamicSound.State == SoundState.Paused) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the song is currently stopped.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool isStopped()
|
||||
{
|
||||
if (this.dynamicSound == null) return false;
|
||||
if (this.dynamicSound.State == SoundState.Stopped) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
public Sound clone()
|
||||
{
|
||||
return new WavSound(this.path);
|
||||
}
|
||||
|
||||
public void restart()
|
||||
{
|
||||
this.stop();
|
||||
this.play();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
using Microsoft.Xna.Framework.Audio;
|
||||
using StardewModdingAPI;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SimpleSoundManager.Framework
|
||||
{
|
||||
public class XACTSound : Sound
|
||||
{
|
||||
public WaveBank waveBank;
|
||||
public ISoundBank soundBank;
|
||||
public string soundName;
|
||||
WaveBank vanillaWaveBank;
|
||||
ISoundBank vanillaSoundBank;
|
||||
Cue song;
|
||||
|
||||
/// <summary>
|
||||
/// Make a new Sound Manager to play and manage sounds in a modded wave bank.
|
||||
/// </summary>
|
||||
/// <param name="newWaveBank">The reference to the wave bank in the mod's asset folder.</param>
|
||||
/// <param name="newSoundBank">The reference to the sound bank in the mod's asset folder.</param>
|
||||
public XACTSound(WaveBank newWaveBank, ISoundBank newSoundBank,string soundName)
|
||||
{
|
||||
this.waveBank = newWaveBank;
|
||||
this.soundBank = newSoundBank;
|
||||
|
||||
vanillaSoundBank = Game1.soundBank;
|
||||
vanillaWaveBank = Game1.waveBank;
|
||||
this.soundName = soundName;
|
||||
song = this.soundBank.GetCue(this.soundName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Play a sound from the mod's wave bank.
|
||||
/// </summary>
|
||||
/// <param name="soundName">The name of the sound in the mod's wave bank. This will fail if the sound doesn't exists. This is also case sensitive.</param>
|
||||
public void play(string soundName)
|
||||
{
|
||||
Game1.waveBank = this.waveBank;
|
||||
Game1.soundBank = this.soundBank;
|
||||
|
||||
if (this.song == null) return;
|
||||
|
||||
this.song.Play();
|
||||
|
||||
Game1.waveBank = this.vanillaWaveBank;
|
||||
Game1.soundBank = this.vanillaSoundBank;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pauses the first instance of this sound.
|
||||
/// </summary>
|
||||
/// <param name="soundName"></param>
|
||||
public void pause(string soundName)
|
||||
{
|
||||
if (this.song == null) return;
|
||||
this.song.Pause();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resume the first instance of the sound that has this name.
|
||||
/// </summary>
|
||||
public void resume(string soundName)
|
||||
{
|
||||
if (this.song == null) return;
|
||||
this.song.Resume();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Stop the first instance of the sound that has this name.
|
||||
/// </summary>
|
||||
/// <param name="soundName"></param>
|
||||
public void stop(string soundName)
|
||||
{
|
||||
if (this.song == null) return;
|
||||
this.song.Stop(AudioStopOptions.Immediate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resumes a paused song.
|
||||
/// </summary>
|
||||
public void resume()
|
||||
{
|
||||
this.resume(soundName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Plays this song.
|
||||
/// </summary>
|
||||
public void play()
|
||||
{
|
||||
this.play(this.soundName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pauses this song.
|
||||
/// </summary>
|
||||
public void pause()
|
||||
{
|
||||
this.pause(this.soundName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops this somg.
|
||||
/// </summary>
|
||||
public void stop()
|
||||
{
|
||||
this.stop(this.soundName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restarts this song.
|
||||
/// </summary>
|
||||
public void restart()
|
||||
{
|
||||
this.stop();
|
||||
this.play();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a clone of this song.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Sound clone()
|
||||
{
|
||||
return new XACTSound(this.waveBank, this.soundBank, this.soundName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
using Microsoft.Xna.Framework.Audio;
|
||||
using StardewModdingAPI;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SimpleSoundManager.Framework
|
||||
{
|
||||
public class XACTMusicPair
|
||||
{
|
||||
public WaveBank waveBank;
|
||||
public ISoundBank soundBank;
|
||||
|
||||
/// <summary>
|
||||
/// Create a xwb and xsb music pack pair.
|
||||
/// </summary>
|
||||
/// <param name="helper">The mod helper from the mod that will handle loading in the file.</param>
|
||||
/// <param name="wavBankPath">A relative path to the .xwb file in the mod helper's mod directory.</param>
|
||||
/// <param name="soundBankPath">A relative path to the .xsb file in the mod helper's mod directory.</param>
|
||||
public XACTMusicPair(IModHelper helper,string wavBankPath, string soundBankPath)
|
||||
{
|
||||
wavBankPath = Path.Combine(helper.DirectoryPath, wavBankPath);
|
||||
soundBankPath = Path.Combine(helper.DirectoryPath, soundBankPath);
|
||||
|
||||
|
||||
waveBank = new WaveBank(Game1.audioEngine, wavBankPath);
|
||||
soundBank = new SoundBankWrapper(new SoundBank(Game1.audioEngine, soundBankPath));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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("SimpleSoundManager")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("SimpleSoundManager")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[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("7b1e9a54-ed9e-47aa-bbaa-98a6e7cb527a")]
|
||||
|
||||
// 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")]
|
|
@ -0,0 +1,24 @@
|
|||
**SimpleSoundManager** is a [Stardew Valley](http://stardewvalley.net/) mod which lets SMAPI mods
|
||||
use custom wave/sound banks for their mods. This allows for things such as playing music/sounds at
|
||||
a time of day, when an object is interacted with, etc.
|
||||
|
||||
Compatible with Stardew Valley 1.2+ on Linux, Mac, and Windows.
|
||||
|
||||
## Installation
|
||||
1. [Install the latest version of SMAPI](https://github.com/Pathoschild/SMAPI/releases).
|
||||
2. Install [this mod from Nexus mods](https://www.nexusmods.com/stardewvalley/mods/1410).
|
||||
3. Run the game using SMAPI.
|
||||
|
||||
## Usage
|
||||
1. Download this mod and reference it when making your mod.
|
||||
2. Create new wave/sound banks using XACT.
|
||||
3. Create a new SoundManager in your mod.
|
||||
4. Play sounds to your heart's content.
|
||||
|
||||
## Versions
|
||||
1.0:
|
||||
* Initial release.
|
||||
|
||||
1.0.1:
|
||||
* Enabled update checks in SMAPI 2.0+.
|
||||
* Fixed compatibility with SMAPI 2.0.
|
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{7B1E9A54-ED9E-47AA-BBAA-98A6E7CB527A}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SimpleSoundManager</RootNamespace>
|
||||
<AssemblyName>SimpleSoundManager</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|AnyCPU'">
|
||||
<OutputPath>bin\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|x86'">
|
||||
<OutputPath>bin\x86\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Framework\Sound.cs" />
|
||||
<Compile Include="Framework\SoundManager.cs" />
|
||||
<Compile Include="Framework\WavSound.cs" />
|
||||
<Compile Include="Framework\XactMusicPair.cs" />
|
||||
<Compile Include="Framework\XACTSound.cs" />
|
||||
<Compile Include="SimpleSoundManagerMod.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="manifest.json" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="README.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\deploy.targets" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>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}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,14 @@
|
|||
using StardewModdingAPI;
|
||||
|
||||
namespace SimpleSoundManager
|
||||
{
|
||||
public class SimpleSoundManagerMod : Mod
|
||||
{
|
||||
internal static IModHelper ModHelper;
|
||||
|
||||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
ModHelper = helper;
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"Name": "Simple Sound Manager",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "2.0.0",
|
||||
"Description": "A simple framework to play sounds from wave banks.",
|
||||
"UniqueID": "Omegasis.SimpleSoundManager",
|
||||
"EntryDll": "SimpleSoundManager.dll",
|
||||
"MinimumApiVersion": "2.0",
|
||||
"UpdateKeys": [ "Nexus:1410" ]
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
1ef37e74c2d3c9be63fcc5fc24c5b0b4a4b35324
|
|
@ -0,0 +1,5 @@
|
|||
C:\Users\iD Student\Desktop\Stardew\Stardew_Valley_Mods-Development\GeneralMods\SimpleSoundManager\obj\Debug\SimpleSoundManager.csproj.CoreCompileInputs.cache
|
||||
C:\Users\iD Student\Desktop\Stardew\Stardew_Valley_Mods-Development\GeneralMods\SimpleSoundManager\bin\Debug\SimpleSoundManager.dll
|
||||
C:\Users\iD Student\Desktop\Stardew\Stardew_Valley_Mods-Development\GeneralMods\SimpleSoundManager\bin\Debug\SimpleSoundManager.pdb
|
||||
C:\Users\iD Student\Desktop\Stardew\Stardew_Valley_Mods-Development\GeneralMods\SimpleSoundManager\obj\Debug\SimpleSoundManager.dll
|
||||
C:\Users\iD Student\Desktop\Stardew\Stardew_Valley_Mods-Development\GeneralMods\SimpleSoundManager\obj\Debug\SimpleSoundManager.pdb
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
|
||||
</packages>
|
Loading…
Reference in New Issue