Skip to content

Commit

Permalink
Microphone: high latency scenarios should occur much less often, Spli…
Browse files Browse the repository at this point in the history
…tter/Mixer: render both sides
  • Loading branch information
ludzeller committed Jan 3, 2023
1 parent a783948 commit 73fdefc
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Assets/Materials/diagramSymbols/multipleMixerNode.mat
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Material:
m_InvalidKeywords: []
m_LightmapFlags: 5
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
m_DoubleSidedGI: 1
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
Expand Down Expand Up @@ -83,7 +83,7 @@ Material:
- _Blend: 0
- _BlendOp: 0
- _BumpScale: 1
- _Cull: 2
- _Cull: 0
- _Cutoff: 0.347
- _DetailNormalMapScale: 1
- _DstBlend: 10
Expand Down
4 changes: 2 additions & 2 deletions Assets/Materials/diagramSymbols/multipleSplitterNode.mat
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Material:
m_InvalidKeywords: []
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_DoubleSidedGI: 1
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
Expand Down Expand Up @@ -83,7 +83,7 @@ Material:
- _Blend: 0
- _BlendOp: 0
- _BumpScale: 1
- _Cull: 2
- _Cull: 0
- _Cutoff: 0.476
- _DetailNormalMapScale: 1
- _DstBlend: 10
Expand Down
2 changes: 1 addition & 1 deletion Assets/Resources/Prefabs/MultiMix.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1708237867706996}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: 0, z: 0.0217}
m_LocalPosition: {x: 0, y: 0, z: 0.0203}
m_LocalScale: {x: 0.02660795, y: 0.026607996, z: 0.053216}
m_ConstrainProportionsScale: 0
m_Children: []
Expand Down
2 changes: 1 addition & 1 deletion Assets/Resources/Prefabs/MultiSplit.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1708237867706996}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: 0, z: 0.0217}
m_LocalPosition: {x: 0, y: 0, z: 0.02025}
m_LocalScale: {x: 0.02660795, y: 0.026607996, z: 0.053216}
m_ConstrainProportionsScale: 0
m_Children: []
Expand Down
26 changes: 24 additions & 2 deletions Assets/Scripts/Microphone/MicrophoneSignalGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,32 @@ public override void Awake() {
}

void Start() {
source = GetComponent<AudioSource>();
source = GetComponent<AudioSource>();
OVRManager.TrackingAcquired += trackingAcquired;
OVRManager.TrackingAcquired += trackingLost;
SelectMic(0);
}

void OnApplicationFocus(bool hasFocus)
{
if(hasFocus) SelectMic(0); // restart mic in order to clear its buffer and avoid severe latency
}

void OnApplicationPause(bool isPaused)
{
if (!isPaused) SelectMic(0); // restart mic in order to clear its buffer and avoid severe latency
}


public void trackingAcquired(){
SelectMic(0); // restart mic in order to clear its buffer and avoid severe latency
}

public void trackingLost(){
SelectMic(0); // restart mic in order to clear its buffer and avoid severe latency
}


Coroutine _MicActivateRoutine;
void SelectMic(int num) {
if (num >= Microphone.devices.Length) {
Expand All @@ -83,7 +105,7 @@ IEnumerator MicActivateRoutine(int num) {
Microphone.End(Microphone.devices[curMicID]);
curMicID = num;

micClip = Microphone.Start(Microphone.devices[num], true, 1, AudioSettings.outputSampleRate);
micClip = Microphone.Start(Microphone.devices[num], true, 3, AudioSettings.outputSampleRate);

yield return null;
if (micClip != null) {
Expand Down
6 changes: 3 additions & 3 deletions ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ PlayerSettings:
metroSplashScreenUseBackgroundColor: 1
platformCapabilities:
WindowsStoreApps:
EnterpriseAuthentication: False
CodeGeneration: False
VideosLibrary: False
HumanInterfaceDevice: False
Location: False
Expand Down Expand Up @@ -839,10 +839,10 @@ PlayerSettings:
PointOfService: False
RecordedCallsFolder: False
Contacts: False
InternetClient: False
Proximity: False
CodeGeneration: False
BackgroundMediaPlayback: False
InternetClient: False
EnterpriseAuthentication: False
metroTargetDeviceFamilies:
Desktop: False
Holographic: False
Expand Down

0 comments on commit 73fdefc

Please sign in to comment.