Skip to content

Commit

Permalink
remove erros for WebGL.
Browse files Browse the repository at this point in the history
  • Loading branch information
hecomi committed Dec 9, 2023
1 parent 91c108d commit 35ef95b
Show file tree
Hide file tree
Showing 22 changed files with 387 additions and 47 deletions.
9 changes: 8 additions & 1 deletion Assets/uLipSync/Editor/uLipSyncMicrophoneEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ namespace uLipSync
[CustomEditor(typeof(uLipSyncMicrophone))]
public class uLipSyncMicrophoneEditor : Editor
{
#if UNITY_WEBGL
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
}
#else
uLipSyncMicrophone mic => target as uLipSyncMicrophone;

public override void OnInspectorGUI()
{
serializedObject.Update();
Expand Down Expand Up @@ -108,6 +114,7 @@ void DrawButtons()

EditorGUILayout.EndHorizontal();
}
#endif
}

}
2 changes: 2 additions & 0 deletions Assets/uLipSync/Runtime/Core/MicUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static List<MicDevice> GetDeviceList()
{
var list = new List<MicDevice>();

#if !UNITY_WEBGL
for (int i = 0; i < Microphone.devices.Length; ++i)
{
var info = new MicDevice
Expand All @@ -28,6 +29,7 @@ public static List<MicDevice> GetDeviceList()
Microphone.GetDeviceCaps(info.name, out info.minFreq, out info.maxFreq);
list.Add(info);
}
#endif

return list;
}
Expand Down
4 changes: 3 additions & 1 deletion Assets/uLipSync/Runtime/uLipSyncMicrophone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace uLipSync
[RequireComponent(typeof(AudioSource))]
public class uLipSyncMicrophone : MonoBehaviour
{
#if !UNITY_WEBGL
const int MaxRetryMilliSec = 1000;

public int index = 0;
Expand All @@ -27,7 +28,7 @@ public class uLipSyncMicrophone : MonoBehaviour
public AudioClip clip
{
get => source ? source.clip : null;
set { if (source) source.clip = value; }
private set { if (source) source.clip = value; }
}

public bool isReady { get; private set; } = false;
Expand Down Expand Up @@ -219,6 +220,7 @@ public void StopRecordAndCreateAudioClip()
source.loop = true;
source.Play();
}
#endif
}

}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 35ef95b

Please sign in to comment.