Skip to content

Commit

Permalink
- Fading out weather
Browse files Browse the repository at this point in the history
- fixed non-stop rain
  • Loading branch information
Algorithman committed Aug 13, 2016
1 parent 96d945b commit ba73de9
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 11 deletions.
2 changes: 1 addition & 1 deletion SoundCenSe GTK/Misc/Misc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<OutputType>Library</OutputType>
<RootNamespace>Misc</RootNamespace>
<AssemblyName>Misc</AssemblyName>
<ReleaseVersion>1.4.0</ReleaseVersion>
<ReleaseVersion>1.4.1</ReleaseVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
2 changes: 1 addition & 1 deletion SoundCenSe GTK/SoundCenSeGTK.sln
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,6 @@ Global
$0.VersionControlPolicy = $28
$28.inheritsSet = Mono
description = SoundCenSe, a audio engine for Dwarf Fortress, based on ZweiStein's SoundSense
version = 1.4.0
version = 1.4.1
EndGlobalSection
EndGlobal
10 changes: 6 additions & 4 deletions SoundCenSe GTK/SoundCenSeGTK/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
using SoundCenSeGTK;
using System.Linq;
using System.Reflection;
using NLog;

namespace SoundCenSeGTK
{
public partial class MainWindow: Gtk.Window
{
private Dictionary<string,SoundPanelEntry> panelEntries = new Dictionary<string, SoundPanelEntry>();
private static PackDownloader PD = null;

private static Logger logger = LogManager.GetCurrentClassLogger();
public MainWindow()
: base(Gtk.WindowType.Toplevel)
{
Expand Down Expand Up @@ -59,7 +60,7 @@ public MainWindow()

cbThreshold.Active = (int)Config.Instance.playbackThreshold;

List<string> temp = new List<string>() { "SFX", "Music", "Weather", "Swords", "Trading" };
List<string> temp = new List<string>() { "SFX", "Music", "Weather", "Swords", "Trade" };
AddSoundPanelEntries(temp);
// ShowAll();

Expand Down Expand Up @@ -113,8 +114,8 @@ private void StartListening(object sender, DwarfFortressRunningEventArgs e)
image1.Pixbuf = Image.LoadFromResource("SoundCenSeGTK.SignalGreen.png").Pixbuf;

runState = RunState.PlayingDF;
SP = new SoundProcessor(allSounds);
Dictionary<string, Sound> oldMusic = GetOldMusic(allSounds);
SP = new SoundProcessor(allSounds);
LL = new LogFileListener(Config.Instance.gamelogPath, true);

LL.GamelogEvent += SP.ProcessLine;
Expand Down Expand Up @@ -344,8 +345,9 @@ private void DFRunCheck()
return;
}
}
catch
catch (Exception ex)
{
logger.Info(ex.StackTrace);
}
}
}
Expand Down
15 changes: 14 additions & 1 deletion SoundCenSe GTK/SoundCenSeGTK/Output/fmodChannelSound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ private RESULT Callback(IntPtr channelraw, CHANNELCONTROL_TYPE controltype, CHAN
// Console.WriteLine("Callback called for " + SoundSoundFile.SoundFile.Filename);
//Console.WriteLine("System ptr: " + FmodSystem.System.getRaw());
//Console.WriteLine("Thread id: " + Thread.CurrentThread.ManagedThreadId + " " + Thread.CurrentThread.IsThreadPoolThread);
Application.Invoke(delegate{OnSoundEnded();});
Application.Invoke(delegate
{
OnSoundEnded();
});
}
//Console.WriteLine("System ptr: " + FmodSystem.System.getRaw());
}
Expand Down Expand Up @@ -266,6 +269,16 @@ public void Stop()

public void StopLooping()
{
float freq;
FmodSystem.ERRCHECK(Channel.getFrequency(out freq));
ulong dspC1;
ulong dspC2;
FmodSystem.ERRCHECK(Channel.getDSPClock(out dspC1, out dspC2));
ulong newDelay = Convert.ToUInt64(5000 * freq / 500);
ChannelGroup cg;
Channel.getChannelGroup(out cg);
Channel.addFadePoint(dspC2, this.Volume);
Channel.addFadePoint(dspC2 + newDelay, 0.0f);
}
}
}
Expand Down
12 changes: 11 additions & 1 deletion SoundCenSe GTK/SoundCenSeGTK/Output/fmodPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void Dispose()
public void Play(ISound sound, long x, long y, long z)
{
SoundSoundFile sf = new SoundSoundFile((Sound)sound, ((Sound)sound).GetRandomSoundFile());
if (sf.SoundFile == null)
if ((sf.SoundFile == null) && (sf.Sound.loop==Loop.Start_Looping))
{
return;
}
Expand Down Expand Up @@ -149,6 +149,16 @@ private void OnPlaySound(string channel, SoundSoundFile sf, float channelVolume,
public void PlaySound(SoundSoundFile sf, string channel, float volume = 1.0f, bool mute = false)
{
FMOD.Sound newSound;
if (sf.Sound.loop == Loop.Stop_Looping)
{
fmodChannelSound chan = FmodChannelPool.Instance.GetSingleChannel(channel.ToLower());
if (chan != null)
{
chan.SoundSoundFile = sf;
chan.StopLooping();
}
}

if (sf.SoundFile == null)
{
sf.SoundFile = ((Sound)sf.Sound).GetRandomSoundFile();
Expand Down
2 changes: 1 addition & 1 deletion SoundCenSe GTK/SoundCenSeGTK/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion ("1.4.0.*")]
[assembly: AssemblyVersion ("1.4.1.*")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
Expand Down
2 changes: 1 addition & 1 deletion SoundCenSe GTK/SoundCenSeGTK/SoundCenSeGTK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>SoundCenSeGTK</RootNamespace>
<AssemblyName>SoundCenSeGTK</AssemblyName>
<ReleaseVersion>1.4.0</ReleaseVersion>
<ReleaseVersion>1.4.1</ReleaseVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
2 changes: 1 addition & 1 deletion SoundCenSe GTK/SoundCenSeGUI/SoundCenSeGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<OutputType>Library</OutputType>
<RootNamespace>SoundCenSeGUI</RootNamespace>
<AssemblyName>SoundCenSeGUI</AssemblyName>
<ReleaseVersion>1.4.0</ReleaseVersion>
<ReleaseVersion>1.4.1</ReleaseVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down

0 comments on commit ba73de9

Please sign in to comment.