File tree Expand file tree Collapse file tree 3 files changed +8
-10
lines changed Expand file tree Collapse file tree 3 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -62,9 +62,6 @@ public ulong AdjustedPosition
62
62
{
63
63
get
64
64
{
65
- // figure out ticks per byte (for later)
66
- var byteLatency = ( TimeSpan . TicksPerSecond / Frequency ) ;
67
-
68
65
ulong pos , qpos ;
69
66
int cnt = 0 ;
70
67
while ( ! GetPosition ( out pos , out qpos ) )
@@ -83,14 +80,14 @@ public ulong AdjustedPosition
83
80
// get the current qpc count (in ticks)
84
81
var qposNow = ( ulong ) ( ( Stopwatch . GetTimestamp ( ) * 10000000M ) / Stopwatch . Frequency ) ;
85
82
86
- // find out how many ticks has passed since the device reported the position
87
- var qposDiff = ( qposNow - qpos ) / 100 ;
83
+ // find out how many ticks have passed since the device reported the position
84
+ var qposDiff = qposNow - qpos ;
88
85
89
- // find out how many byte would have played in that time span
90
- var bytes = qposDiff / byteLatency ;
86
+ // find out how many device position units (usually bytes) would have played in that time span
87
+ var posDiff = ( qposDiff * Frequency ) / TimeSpan . TicksPerSecond ;
91
88
92
89
// add it to the position
93
- pos += bytes ;
90
+ pos += posDiff ;
94
91
}
95
92
return pos ;
96
93
}
Original file line number Diff line number Diff line change @@ -274,7 +274,8 @@ public long GetPosition()
274
274
{
275
275
return 0 ;
276
276
}
277
- return ( long ) audioClient . AudioClockClient . AdjustedPosition ;
277
+ var clock = audioClient . AudioClockClient ;
278
+ return ( ( long ) clock . AdjustedPosition * outputFormat . AverageBytesPerSecond ) / ( long ) clock . Frequency ;
278
279
}
279
280
280
281
/// <summary>
Original file line number Diff line number Diff line change 1
1
{
2
2
"msbuild-sdks" : {
3
- "MSBuild.Sdk.Extras" : " 2.0.31 "
3
+ "MSBuild.Sdk.Extras" : " 2.0.54 "
4
4
}
5
5
}
You can’t perform that action at this time.
0 commit comments