Skip to content

Commit

Permalink
More tolerance for Spotify window, tweak isPlaying
Browse files Browse the repository at this point in the history
  • Loading branch information
Xeroday committed Jul 24, 2018
1 parent c11fe20 commit 1fa58a5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion EZBlocker/EZBlocker/AudioUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static float GetPeakVolume(ISimpleAudioVolume v)

IAudioMeterInformation meter = (IAudioMeterInformation)v;
meter.GetPeakValue(out float peak);
return peak;
return peak * 100;
}

public static ISimpleAudioVolume GetVolumeControl(Process p)
Expand Down
4 changes: 2 additions & 2 deletions EZBlocker/EZBlocker/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// 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.7.1.1")]
[assembly: AssemblyFileVersion("1.7.1.1")]
[assembly: AssemblyVersion("1.7.1.2")]
[assembly: AssemblyFileVersion("1.7.1.2")]
4 changes: 2 additions & 2 deletions EZBlocker/EZBlocker/SpotifyHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ public SpotifyHook()

public bool IsPlaying()
{
return !WindowName.Equals("") && !WindowName.Equals("Drag") && AudioUtils.GetPeakVolume(VolumeControl) > 0;
return !WindowName.Equals("") && !WindowName.Equals("Drag") && (AudioUtils.GetPeakVolume(VolumeControl) > 0 || WindowName.Contains(" - "));
}

public bool IsAdPlaying()
{
if (IsPlaying())
{
if (WindowName.Equals("Spotify") && SpotifyAdTolerance < 1) // Prevent user pausing Spotify from being detected as ad (PeakVolume needs time to adjust)
if (WindowName.Equals("Spotify") && SpotifyAdTolerance < 3) // Prevent user pausing Spotify from being detected as ad (PeakVolume needs time to adjust)
{
Debug.WriteLine("Tolerance " + SpotifyAdTolerance);
SpotifyAdTolerance++;
Expand Down

0 comments on commit 1fa58a5

Please sign in to comment.