Skip to content

Commit

Permalink
Fix issues found by SonarCloud (#7)
Browse files Browse the repository at this point in the history
* Fix issues found by SonarCloud
Remove unnecessary locks

* Show call duration

* Update exe file metadata
  • Loading branch information
alexrster authored Dec 20, 2018
1 parent 3466dc2 commit 604cf9f
Show file tree
Hide file tree
Showing 42 changed files with 909 additions and 1,424 deletions.
16 changes: 10 additions & 6 deletions AudioLibrary.PjSIP/AudioDevice.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
using AudioLibrary.Interfaces;
using AudioLibrary.PjSIP.ManagedWatcher;

Expand All @@ -15,8 +12,9 @@ internal class AudioDevice : IAudioDevice
public event Action<IAudioDevice> MuteChanged;

internal int Index { get; private set; }

public Audio Audio { get; private set; }
public string Name { get; set; }
public string Name { get; private set; }
public bool PlaybackSupport { get; private set; }
public bool RecordingSupport { get; private set; }

Expand All @@ -38,13 +36,19 @@ public int Volume
{
if (PlaybackSupport) Audio.SpeakerVolume = value;
else Audio.MicVolume = value;

VolumeChanged?.Invoke(this);
}
}

public bool Mute
{
get { return Audio.MicMute; }
set { Audio.MicMute = value; }
set
{
Audio.MicMute = value;
MuteChanged?.Invoke(this);
}
}

internal AudioDevice(Audio audio, Imports.PjAudioDeviceInfo audioDeviceInfo, int index)
Expand Down
5 changes: 5 additions & 0 deletions AudioLibrary.WMME/AudioLibrary.WMME.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<NoWarn>3009,3003,3001</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -40,6 +41,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<NoWarn>3009,3003</NoWarn>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
Expand Down Expand Up @@ -72,6 +74,9 @@
<Compile Include="Native\Win32.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="VolumeAudioLineControl.cs" />
<Compile Include="WaveOut.cs" />
<Compile Include="WaveOutBuffer.cs" />
<Compile Include="WaveStream.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AudioLibrary\AudioLibrary.csproj">
Expand Down
7 changes: 4 additions & 3 deletions AudioLibrary.WMME/AudioLine.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using System;
using System.Collections.Generic;
using AudioLibrary.Interfaces;
using System.Runtime.InteropServices;
using AudioLibrary.WMME.Native;
using System.Diagnostics;

namespace AudioLibrary.WMME
{
Expand Down Expand Up @@ -284,7 +285,7 @@ private void SetVolumeOnChannel(Channel channel, int newVolume)
}
catch (Exception e)
{
// TODO: Log error
Trace.TraceError("Unable to set volume on channel {0} #{1}: {2}", Name, Id, e.Message);
}
}

Expand Down Expand Up @@ -329,7 +330,7 @@ internal void ReloadValues()
}
catch (Exception e)
{
// TODO: log error
Trace.TraceError("Unable to reload values on audio line {0} #{1}: {2}", Name, Id, e.Message);
}

RaiseVolumeChangedEvent(this);
Expand Down
Loading

0 comments on commit 604cf9f

Please sign in to comment.