优化音频流数据不够时的数据设置

This commit is contained in:
ALIENJACK\alien 2024-07-10 17:04:55 +08:00
parent 65978580be
commit 1fd27d7fb7
4 changed files with 21 additions and 18 deletions

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEngine;
namespace MyNes.Core
{

View File

@ -167,8 +167,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ac8cd27a180bf3e489b2ca27c821bffe, type: 3}
m_Name:
m_EditorClassIdentifier:
VideoCom: {fileID: 0}
AudioCom: {fileID: 0}
VideoCom: {fileID: 730321753}
AudioCom: {fileID: 1379369700}
--- !u!1 &455467288
GameObject:
m_ObjectHideFlags: 0

View File

@ -34,22 +34,18 @@ namespace AxibugEmuOnline.Client
m_as.Play();
}
float lastData = 0;
void OnAudioFilterRead(float[] data, int channels)
{
while (_buffer.Count >= data.Length / 2)
{
//Thread.Sleep(10);
break;
}
int step = channels;
for (int i = 0; i < data.Length; i += step)
{
var rawData = _buffer.Count > 0 ? _buffer.Dequeue() : 0;
var rawFloat = rawData / 124f;
var rawFloat = _buffer.Count > 0 ? (_buffer.Dequeue() / 124f) : lastData;
data[i] = rawFloat;
for (int fill = 1; fill < step; fill++)
data[i + fill] = rawFloat;
lastData = rawFloat;
}
}

View File

@ -155,13 +155,18 @@ PlayerSettings:
useHDRDisplay: 0
hdrBitDepth: 0
m_ColorGamuts: 00000000
targetPixelDensity: 0
targetPixelDensity: 30
resolutionScalingMode: 0
resetResolutionOnWindowResize: 0
androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1
applicationIdentifier: {}
buildNumber: {}
applicationIdentifier:
Standalone: com.DefaultCompany.AxibugEmuOnline.Client
buildNumber:
Standalone: 0
VisionOS: 0
iPhone: 0
tvOS: 0
overrideDefaultApplicationIdentifier: 0
AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 22
@ -180,12 +185,12 @@ PlayerSettings:
strictShaderVariantMatching: 0
VertexChannelCompressionMask: 4054
iPhoneSdkVersion: 988
iOSTargetOSVersionString:
iOSTargetOSVersionString: 12.0
tvOSSdkVersion: 0
tvOSRequireExtendedGameController: 0
tvOSTargetOSVersionString:
tvOSTargetOSVersionString: 12.0
VisionOSSdkVersion: 0
VisionOSTargetOSVersionString:
VisionOSTargetOSVersionString: 1.0
uIPrerenderedIcon: 0
uIRequiresPersistentWiFi: 0
uIRequiresFullScreen: 1
@ -313,7 +318,7 @@ PlayerSettings:
locationUsageDescription:
microphoneUsageDescription:
bluetoothUsageDescription:
macOSTargetOSVersion:
macOSTargetOSVersion: 10.13.0
switchNMETAOverride:
switchNetLibKey:
switchSocketMemoryPoolSize: 6144
@ -563,7 +568,8 @@ PlayerSettings:
scriptingDefineSymbols: {}
additionalCompilerArguments: {}
platformArchitecture: {}
scriptingBackend: {}
scriptingBackend:
Standalone: 1
il2cppCompilerConfiguration: {}
il2cppCodeGeneration: {}
managedStrippingLevel: {}