Fixed performance issue for system sounds and main volume
This commit is contained in:
parent
1fea2a2e11
commit
06266daa92
@ -54,6 +54,14 @@ public class AudioHelper
|
|||||||
|
|
||||||
static object _lock = new object();
|
static object _lock = new object();
|
||||||
|
|
||||||
|
public void ResetCache()
|
||||||
|
{
|
||||||
|
lock(_lock)
|
||||||
|
{
|
||||||
|
_current = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public IAudioSession GetActiveSession(FallbackBehavior fallbackBehavior)
|
public IAudioSession GetActiveSession(FallbackBehavior fallbackBehavior)
|
||||||
{
|
{
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
@ -67,11 +75,11 @@ public class AudioHelper
|
|||||||
|
|
||||||
if(_current == null)
|
if(_current == null)
|
||||||
{
|
{
|
||||||
if(fallbackBehavior == FallbackBehavior.SystemSounds)
|
if(fallbackBehavior == FallbackBehavior.SystemSounds && _current is not SystemSoundsAudioSession)
|
||||||
{
|
{
|
||||||
_current = GetSystemSounds();
|
_current = GetSystemSounds();
|
||||||
}
|
}
|
||||||
else if(fallbackBehavior == FallbackBehavior.SystemVolume)
|
else if(fallbackBehavior == FallbackBehavior.SystemVolume && _current is not SystemVolumeAudioSession)
|
||||||
{
|
{
|
||||||
_current = GetSystemVolume();
|
_current = GetSystemVolume();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user