Skip to content

Commit ba73de9

Browse files
committed
- Fading out weather
- fixed non-stop rain
1 parent 96d945b commit ba73de9

File tree

8 files changed

+36
-11
lines changed

8 files changed

+36
-11
lines changed

SoundCenSe GTK/Misc/Misc.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<OutputType>Library</OutputType>
88
<RootNamespace>Misc</RootNamespace>
99
<AssemblyName>Misc</AssemblyName>
10-
<ReleaseVersion>1.4.0</ReleaseVersion>
10+
<ReleaseVersion>1.4.1</ReleaseVersion>
1111
</PropertyGroup>
1212
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1313
<DebugSymbols>true</DebugSymbols>

SoundCenSe GTK/SoundCenSeGTK.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,6 @@ Global
182182
$0.VersionControlPolicy = $28
183183
$28.inheritsSet = Mono
184184
description = SoundCenSe, a audio engine for Dwarf Fortress, based on ZweiStein's SoundSense
185-
version = 1.4.0
185+
version = 1.4.1
186186
EndGlobalSection
187187
EndGlobal

SoundCenSe GTK/SoundCenSeGTK/MainWindow.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
using SoundCenSeGTK;
99
using System.Linq;
1010
using System.Reflection;
11+
using NLog;
1112

1213
namespace SoundCenSeGTK
1314
{
1415
public partial class MainWindow: Gtk.Window
1516
{
1617
private Dictionary<string,SoundPanelEntry> panelEntries = new Dictionary<string, SoundPanelEntry>();
1718
private static PackDownloader PD = null;
18-
19+
private static Logger logger = LogManager.GetCurrentClassLogger();
1920
public MainWindow()
2021
: base(Gtk.WindowType.Toplevel)
2122
{
@@ -59,7 +60,7 @@ public MainWindow()
5960

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

62-
List<string> temp = new List<string>() { "SFX", "Music", "Weather", "Swords", "Trading" };
63+
List<string> temp = new List<string>() { "SFX", "Music", "Weather", "Swords", "Trade" };
6364
AddSoundPanelEntries(temp);
6465
// ShowAll();
6566

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

115116
runState = RunState.PlayingDF;
116-
SP = new SoundProcessor(allSounds);
117117
Dictionary<string, Sound> oldMusic = GetOldMusic(allSounds);
118+
SP = new SoundProcessor(allSounds);
118119
LL = new LogFileListener(Config.Instance.gamelogPath, true);
119120

120121
LL.GamelogEvent += SP.ProcessLine;
@@ -344,8 +345,9 @@ private void DFRunCheck()
344345
return;
345346
}
346347
}
347-
catch
348+
catch (Exception ex)
348349
{
350+
logger.Info(ex.StackTrace);
349351
}
350352
}
351353
}

SoundCenSe GTK/SoundCenSeGTK/Output/fmodChannelSound.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,10 @@ private RESULT Callback(IntPtr channelraw, CHANNELCONTROL_TYPE controltype, CHAN
144144
// Console.WriteLine("Callback called for " + SoundSoundFile.SoundFile.Filename);
145145
//Console.WriteLine("System ptr: " + FmodSystem.System.getRaw());
146146
//Console.WriteLine("Thread id: " + Thread.CurrentThread.ManagedThreadId + " " + Thread.CurrentThread.IsThreadPoolThread);
147-
Application.Invoke(delegate{OnSoundEnded();});
147+
Application.Invoke(delegate
148+
{
149+
OnSoundEnded();
150+
});
148151
}
149152
//Console.WriteLine("System ptr: " + FmodSystem.System.getRaw());
150153
}
@@ -266,6 +269,16 @@ public void Stop()
266269

267270
public void StopLooping()
268271
{
272+
float freq;
273+
FmodSystem.ERRCHECK(Channel.getFrequency(out freq));
274+
ulong dspC1;
275+
ulong dspC2;
276+
FmodSystem.ERRCHECK(Channel.getDSPClock(out dspC1, out dspC2));
277+
ulong newDelay = Convert.ToUInt64(5000 * freq / 500);
278+
ChannelGroup cg;
279+
Channel.getChannelGroup(out cg);
280+
Channel.addFadePoint(dspC2, this.Volume);
281+
Channel.addFadePoint(dspC2 + newDelay, 0.0f);
269282
}
270283
}
271284
}

SoundCenSe GTK/SoundCenSeGTK/Output/fmodPlayer.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void Dispose()
6666
public void Play(ISound sound, long x, long y, long z)
6767
{
6868
SoundSoundFile sf = new SoundSoundFile((Sound)sound, ((Sound)sound).GetRandomSoundFile());
69-
if (sf.SoundFile == null)
69+
if ((sf.SoundFile == null) && (sf.Sound.loop==Loop.Start_Looping))
7070
{
7171
return;
7272
}
@@ -149,6 +149,16 @@ private void OnPlaySound(string channel, SoundSoundFile sf, float channelVolume,
149149
public void PlaySound(SoundSoundFile sf, string channel, float volume = 1.0f, bool mute = false)
150150
{
151151
FMOD.Sound newSound;
152+
if (sf.Sound.loop == Loop.Stop_Looping)
153+
{
154+
fmodChannelSound chan = FmodChannelPool.Instance.GetSingleChannel(channel.ToLower());
155+
if (chan != null)
156+
{
157+
chan.SoundSoundFile = sf;
158+
chan.StopLooping();
159+
}
160+
}
161+
152162
if (sf.SoundFile == null)
153163
{
154164
sf.SoundFile = ((Sound)sf.Sound).GetRandomSoundFile();

SoundCenSe GTK/SoundCenSeGTK/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
1818
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
1919

20-
[assembly: AssemblyVersion ("1.4.0.*")]
20+
[assembly: AssemblyVersion ("1.4.1.*")]
2121

2222
// The following attributes are used to specify the signing key for the assembly,
2323
// if desired. See the Mono documentation for more information about signing.

SoundCenSe GTK/SoundCenSeGTK/SoundCenSeGTK.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<OutputType>WinExe</OutputType>
88
<RootNamespace>SoundCenSeGTK</RootNamespace>
99
<AssemblyName>SoundCenSeGTK</AssemblyName>
10-
<ReleaseVersion>1.4.0</ReleaseVersion>
10+
<ReleaseVersion>1.4.1</ReleaseVersion>
1111
</PropertyGroup>
1212
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
1313
<DebugSymbols>true</DebugSymbols>

SoundCenSe GTK/SoundCenSeGUI/SoundCenSeGUI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<OutputType>Library</OutputType>
88
<RootNamespace>SoundCenSeGUI</RootNamespace>
99
<AssemblyName>SoundCenSeGUI</AssemblyName>
10-
<ReleaseVersion>1.4.0</ReleaseVersion>
10+
<ReleaseVersion>1.4.1</ReleaseVersion>
1111
</PropertyGroup>
1212
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1313
<DebugSymbols>true</DebugSymbols>

0 commit comments

Comments
 (0)