mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
修复 CoreAudioAPI
This commit is contained in:
parent
61080ac8e3
commit
74d2ff9e89
@ -477,7 +477,7 @@ namespace VPet_Simulator.Windows
|
||||
public float AudioPlayingVolume()
|
||||
{
|
||||
if (AudioPlayingVolumeOK == null)
|
||||
{
|
||||
{//第一调用检查是否支持
|
||||
try
|
||||
{
|
||||
float vol = 0;
|
||||
@ -499,6 +499,8 @@ namespace VPet_Simulator.Windows
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
try
|
||||
{//后续容错可能是偶发性
|
||||
using (var enumerator = new MMDeviceEnumerator())
|
||||
{
|
||||
using (var meter = AudioMeterInformation.FromDevice(enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia)))
|
||||
@ -507,6 +509,11 @@ namespace VPet_Simulator.Windows
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 音乐检测器
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user