Random (small) cleanups.

This commit is contained in:
J.D. Purcell 2017-04-09 23:08:26 -04:00
parent 676da1002d
commit ab155217e7
4 changed files with 8 additions and 11 deletions

View File

@ -31,17 +31,17 @@ namespace BizHawk.Client.Common
public float FullnessRatio public float FullnessRatio
{ {
get { return _rewindBuffer != null ? _rewindBuffer.FullnessRatio : 0; } get { return _rewindBuffer?.FullnessRatio ?? 0; }
} }
public int Count public int Count
{ {
get { return _rewindBuffer != null ? _rewindBuffer.Count : 0; } get { return _rewindBuffer?.Count ?? 0; }
} }
public long Size public long Size
{ {
get { return _rewindBuffer != null ? _rewindBuffer.Size : 0; } get { return _rewindBuffer?.Size ?? 0; }
} }
public bool HasBuffer public bool HasBuffer
@ -116,10 +116,7 @@ namespace BizHawk.Client.Common
private void DoMessage(string message) private void DoMessage(string message)
{ {
if (MessageCallback != null) MessageCallback?.Invoke(message);
{
MessageCallback(message);
}
} }
private void SetRewindParams(bool enabled, int frequency) private void SetRewindParams(bool enabled, int frequency)

View File

@ -103,7 +103,7 @@ namespace BizHawk.Client.EmuHawk
_lastWriteTime = 0; _lastWriteTime = 0;
_lastWriteCursor = 0; _lastWriteCursor = 0;
_deviceBuffer.Play(0, SlimDX.DirectSound.PlayFlags.Looping); _deviceBuffer.Play(0, PlayFlags.Looping);
} }
public void StopSound() public void StopSound()

View File

@ -86,7 +86,7 @@ namespace BizHawk.Client.EmuHawk
currentSamplesPlayed = 0; currentSamplesPlayed = 0;
} }
int samplesAwaitingPlayback = _currentSamplesQueued - currentSamplesPlayed; int samplesAwaitingPlayback = _currentSamplesQueued - currentSamplesPlayed;
int samplesNeeded = (int)Math.Max(BufferSizeSamples - samplesAwaitingPlayback, 0); int samplesNeeded = Math.Max(BufferSizeSamples - samplesAwaitingPlayback, 0);
if (isInitializing || detectedUnderrun) if (isInitializing || detectedUnderrun)
{ {
_sound.HandleInitializationOrUnderrun(detectedUnderrun, ref samplesNeeded); _sound.HandleInitializationOrUnderrun(detectedUnderrun, ref samplesNeeded);

View File

@ -134,9 +134,9 @@ namespace BizHawk.Client.EmuHawk
private static void OnCheckComplete() private static void OnCheckComplete()
{ {
CheckComplete(null, EventArgs.Empty); CheckComplete?.Invoke(null, EventArgs.Empty);
} }
public static event EventHandler CheckComplete = delegate { }; public static event EventHandler CheckComplete;
} }
} }