History

Merge pull request #57 from martinellimarco/master

Fix for #56

Marco Martinelli committed 7 years ago

Commit 4166b802 parents 6b1a111 1630e463 files · +12 −13Browse files

Unified · Split

3 files
  1. Receivers/dotnet-windows/ScreamReader/ScreamReader/ScreamReader.csproj +2 −2
  2. Receivers/dotnet-windows/ScreamReader/ScreamReader/UdpWaveStreamPlayer.cs +9 −10
  3. Receivers/dotnet-windows/ScreamReader/ScreamReader/packages.config +1 −1
Receivers/dotnet-windows/ScreamReader/ScreamReader/ScreamReader.csproj+2−2
@@ -38,8 +38,8 @@ · 37 unmodified lines
3838 <StartupObject />
3939 </PropertyGroup>
4040 <ItemGroup>
41− <Reference Include="NAudio, Version=1.8.5.0, Culture=neutral, processorArchitecture=MSIL">
42− <HintPath>..\packages\NAudio.1.8.5\lib\net35\NAudio.dll</HintPath>
41+ <Reference Include="NAudio, Version=1.9.0.0, Culture=neutral, processorArchitecture=MSIL">
42+ <HintPath>..\packages\NAudio.1.9.0\lib\net35\NAudio.dll</HintPath>
4343 </Reference>
4444 <Reference Include="System" />
4545 <Reference Include="System.Core" />
Receivers/dotnet-windows/ScreamReader/ScreamReader/UdpWaveStreamPlayer.cs+9−10
@@ -41,7 +41,7 @@ namespace ScreamReader · 40 unmodified lines
4141
4242 private UdpClient udpClient;
4343
44− private WaveOut output;
44+ private WasapiOut output;
4545
4646 private int volume;
4747 #endregion
@@ -122,10 +122,7 @@ namespace ScreamReader · 74 unmodified lines
122122
123123 var rsws = new BufferedWaveProvider(new WaveFormat(44100, currentWidth, currentChannels)) { BufferDuration = TimeSpan.FromMilliseconds(200), DiscardOnBufferOverflow = true };
124124
125− this.output = new WaveOut()
126− {
127− DesiredLatency = 200
128− };
125+ this.output = new WasapiOut();
129126 this.Volume = 100;
130127
131128 this.output.Init(rsws);
@@ -151,20 +148,22 @@ namespace ScreamReader · 19 unmodified lines
151148 // TODO find a way to set a channel map in NAudio. I was not able to find any.
152149 // In practice if both the source and the receiver windows machine have the same speakers configuration setted this doesn't matter,
153150 // but in all other cases the channels will be possibly mismatched.
154−
155151 this.output.Stop();
156152 var rate = ((currentRate >= 128) ? 44100 : 48000) * (currentRate % 128);
153+
157154 rsws = new BufferedWaveProvider(new WaveFormat(rate, currentWidth, currentChannels)) { BufferDuration = TimeSpan.FromMilliseconds(200), DiscardOnBufferOverflow = true };
158− this.output = new WaveOut()
159− {
160− DesiredLatency = 200
161− };
155+ this.output = new WasapiOut();
162156 this.Volume = 100;
163157 this.output.Init(rsws);
164158 this.output.Play();
165159 }
166160 rsws.AddSamples(data, 5, data.Length - 5);
167161 } catch (SocketException) { } // Usually when interrupted
162+ catch(Exception e)
163+ {
164+ System.Windows.Forms.MessageBox.Show(e.StackTrace, e.Message);
165+
166+ }
168167 }
169168 }, this.cancellationTokenSource.Token);
170169
Receivers/dotnet-windows/ScreamReader/ScreamReader/packages.config+1−1
@@ -1,4 +1,4 @@
11 <?xml version="1.0" encoding="utf-8"?>
22 <packages>
3− <package id="NAudio" version="1.8.5" targetFramework="net472" />
3+ <package id="NAudio" version="1.9.0" targetFramework="net472" />
44 </packages>

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t