private static void DrawPlayControls(RecordingTool t) { if (GUILayout.RepeatButton("<<")) { t.SeekBackwards(); } if (GUILayout.Button("<")) { t.PreviousFrame(); } if (GUILayout.Button(t.IsPlaying?"Pause":"Play")) { t.TogglePlaying(); } if (GUILayout.Button(">")) { t.NextFrame(); } if (GUILayout.RepeatButton(">>")) { t.SeekForwards(); } }
public void Clean() { _rt = null; tgt = null; slot = null; position = null; rotation = null; scale = null; }
public void Clean() { _rt = null; tgt = null; Pool.Return(ref blendShapes); Pool.Return(ref positions); Pool.Return(ref rotations); Pool.Return(ref scales); }
public MetaRecorder(MetaGen component) { metagen_comp = component; streamRecorder = new PoseStreamRecorder(metagen_comp); eyeRecorder = new EyeStreamRecorder(metagen_comp); mouthRecorder = new MouthStreamRecorder(metagen_comp); controllerRecorder = new ControllerStreamRecorder(metagen_comp); voiceRecorder = new VoiceRecorder(metagen_comp); bvhRecorder = new BvhRecorder(metagen_comp); visionRecorder = new VisionRecorder(camera_resolution, metagen_comp); animationRecorder = metagen_comp.Slot.AttachComponent <RecordingTool>(); animationRecorder.metagen_comp = metagen_comp; }
public void OnStart(RecordingTool rt) { _rt = rt; if (position.Value) { positionTrack = rt.animation.AddTrack <CurveFloat3AnimationTrack>(); } if (rotation.Value) { rotationTrack = rt.animation.AddTrack <CurveFloatQAnimationTrack>(); } if (scale.Value) { scaleTrack = rt.animation.AddTrack <CurveFloat3AnimationTrack>(); } }
public void OnStart(RecordingTool rt) { tgt = renderer.Target; if (tgt == null) { return; } slot = tgt.Slot; _rt = rt; scl = recordScales.Value; position = rt.animation.AddTrack <CurveFloat3AnimationTrack>(); rotation = rt.animation.AddTrack <CurveFloatQAnimationTrack>(); if (scl) { scale = rt.animation.AddTrack <CurveFloat3AnimationTrack>(); } }
public void OnStart(RecordingTool rt) { tgt = renderer.Target; localSpace = Pool.BorrowList <bool>(); positions = Pool.BorrowList <CurveFloat3AnimationTrack>(); rotations = Pool.BorrowList <CurveFloatQAnimationTrack>(); scales = Pool.BorrowList <CurveFloat3AnimationTrack>(); blendShapes = Pool.BorrowList <CurveFloatAnimationTrack>(); if (tgt == null) { return; } _rt = rt; scl = recordScales.Value; bs = recordBlendshapes.Value; for (int i = 0; i < tgt.Bones.Count; i++) { bool useLocal = false; Slot bone = tgt.Bones[i]; if (bone != null) { for (int j = 0; j < tgt.Bones.Count; j++) { if (bone.Parent == tgt.Bones[j]) { useLocal = true; break; } } } localSpace.Add(useLocal); positions.Add(rt.animation.AddTrack <CurveFloat3AnimationTrack>()); rotations.Add(rt.animation.AddTrack <CurveFloatQAnimationTrack>()); if (scl) { scales.Add(rt.animation.AddTrack <CurveFloat3AnimationTrack>()); } } if (bs) { for (int i = 0; i < tgt.BlendShapeWeights.Count; i++) { blendShapes.Add(rt.animation.AddTrack <CurveFloatAnimationTrack>()); } } }
public void OnStart(RecordingTool rt) { AnimX animx = rt.animation; Type type = source_field.Target.ValueType; if (type == typeof(float)) { floatTrack = animx.AddTrack <CurveFloatAnimationTrack>(); } if (type == typeof(float2)) { float2Track = animx.AddTrack <CurveFloat2AnimationTrack>(); } if (type == typeof(float2x2)) { float2x2Track = animx.AddTrack <CurveFloat2x2AnimationTrack>(); } if (type == typeof(float3)) { float3Track = animx.AddTrack <CurveFloat3AnimationTrack>(); } if (type == typeof(float3x3)) { float3x3Track = animx.AddTrack <CurveFloat3x3AnimationTrack>(); } if (type == typeof(float4)) { float4Track = animx.AddTrack <CurveFloat4AnimationTrack>(); } if (type == typeof(float4x4)) { float4x4Track = animx.AddTrack <CurveFloat4x4AnimationTrack>(); } if (type == typeof(int)) { intTrack = animx.AddTrack <CurveIntAnimationTrack>(); } if (type == typeof(int2)) { int2Track = animx.AddTrack <CurveInt2AnimationTrack>(); } if (type == typeof(int3)) { int3Track = animx.AddTrack <CurveInt3AnimationTrack>(); } if (type == typeof(int4)) { int4Track = animx.AddTrack <CurveInt4AnimationTrack>(); } if (type == typeof(bool)) { boolTrack = animx.AddTrack <CurveBoolAnimationTrack>(); } if (type == typeof(string)) { stringTrack = animx.AddTrack <CurveStringAnimationTrack>(); } if (type == typeof(char)) { charTrack = animx.AddTrack <CurveCharAnimationTrack>(); } if (type == typeof(color)) { colorTrack = animx.AddTrack <CurveColorAnimationTrack>(); } if (type == typeof(floatQ)) { floatQTrack = animx.AddTrack <CurveFloatQAnimationTrack>(); } if (type == typeof(long)) { longTrack = animx.AddTrack <CurveLongAnimationTrack>(); } if (type == typeof(ulong)) { ulongTrack = animx.AddTrack <CurveUlongAnimationTrack>(); } if (type == typeof(byte)) { byteTrack = animx.AddTrack <CurveByteAnimationTrack>(); } if (type == typeof(double)) { doubleTrack = animx.AddTrack <CurveDoubleAnimationTrack>(); } if (type == typeof(double2)) { double2Track = animx.AddTrack <CurveDouble2AnimationTrack>(); } if (type == typeof(double2x2)) { double2x2Track = animx.AddTrack <CurveDouble2x2AnimationTrack>(); } if (type == typeof(double3)) { double3Track = animx.AddTrack <CurveDouble3AnimationTrack>(); } if (type == typeof(double3x3)) { double3x3Track = animx.AddTrack <CurveDouble3x3AnimationTrack>(); } if (type == typeof(double4)) { double4Track = animx.AddTrack <CurveDouble4AnimationTrack>(); } if (type == typeof(double4x4)) { double4x4Track = animx.AddTrack <CurveDouble4x4AnimationTrack>(); } if (type == typeof(doubleQ)) { doubleQTrack = animx.AddTrack <CurveDoubleQAnimationTrack>(); } if (type == typeof(short)) { shortTrack = animx.AddTrack <CurveShortAnimationTrack>(); } if (type == typeof(ushort)) { ushortTrack = animx.AddTrack <CurveUshortAnimationTrack>(); } if (type == typeof(uint)) { uintTrack = animx.AddTrack <CurveUintAnimationTrack>(); } Slot s = holding_slot; FieldTracker fieldTracker = this; IField field = source_field.Target; if (type == typeof(float)) { fieldTracker.driven_field.Target = RecordedValueProcessor <float> .AttachComponents(s, (IField <float>) field); } if (type == typeof(float2)) { fieldTracker.driven_field.Target = RecordedValueProcessor <float2> .AttachComponents(s, (IField <float2>) field); } if (type == typeof(float2x2)) { fieldTracker.driven_field.Target = RecordedValueProcessor <float2x2> .AttachComponents(s, (IField <float2x2>) field); } if (type == typeof(float3)) { fieldTracker.driven_field.Target = RecordedValueProcessor <float3> .AttachComponents(s, (IField <float3>) field); } if (type == typeof(float3x3)) { fieldTracker.driven_field.Target = RecordedValueProcessor <float3x3> .AttachComponents(s, (IField <float3x3>) field); } if (type == typeof(float4)) { fieldTracker.driven_field.Target = RecordedValueProcessor <float4> .AttachComponents(s, (IField <float4>) field); } if (type == typeof(float4x4)) { fieldTracker.driven_field.Target = RecordedValueProcessor <float4x4> .AttachComponents(s, (IField <float4x4>) field); } if (type == typeof(int)) { fieldTracker.driven_field.Target = RecordedValueProcessor <int> .AttachComponents(s, (IField <int>) field); } if (type == typeof(int2)) { fieldTracker.driven_field.Target = RecordedValueProcessor <int2> .AttachComponents(s, (IField <int2>) field); } if (type == typeof(int3)) { fieldTracker.driven_field.Target = RecordedValueProcessor <int3> .AttachComponents(s, (IField <int3>) field); } if (type == typeof(int4)) { fieldTracker.driven_field.Target = RecordedValueProcessor <int4> .AttachComponents(s, (IField <int4>) field); } if (type == typeof(bool)) { fieldTracker.driven_field.Target = RecordedValueProcessor <bool> .AttachComponents(s, (IField <bool>) field); } if (type == typeof(string)) { fieldTracker.driven_field.Target = RecordedValueProcessor <string> .AttachComponents(s, (IField <string>) field); } if (type == typeof(char)) { fieldTracker.driven_field.Target = RecordedValueProcessor <char> .AttachComponents(s, (IField <char>) field); } if (type == typeof(color)) { fieldTracker.driven_field.Target = RecordedValueProcessor <color> .AttachComponents(s, (IField <color>) field); } if (type == typeof(floatQ)) { fieldTracker.driven_field.Target = RecordedValueProcessor <floatQ> .AttachComponents(s, (IField <floatQ>) field); } if (type == typeof(long)) { fieldTracker.driven_field.Target = RecordedValueProcessor <long> .AttachComponents(s, (IField <long>) field); } if (type == typeof(ulong)) { fieldTracker.driven_field.Target = RecordedValueProcessor <ulong> .AttachComponents(s, (IField <ulong>) field); } if (type == typeof(byte)) { fieldTracker.driven_field.Target = RecordedValueProcessor <byte> .AttachComponents(s, (IField <byte>) field); } if (type == typeof(double)) { fieldTracker.driven_field.Target = RecordedValueProcessor <double> .AttachComponents(s, (IField <double>) field); } if (type == typeof(double2)) { fieldTracker.driven_field.Target = RecordedValueProcessor <double2> .AttachComponents(s, (IField <double2>) field); } if (type == typeof(double2x2)) { fieldTracker.driven_field.Target = RecordedValueProcessor <double2x2> .AttachComponents(s, (IField <double2x2>) field); } if (type == typeof(double3)) { fieldTracker.driven_field.Target = RecordedValueProcessor <double3> .AttachComponents(s, (IField <double3>) field); } if (type == typeof(double3x3)) { fieldTracker.driven_field.Target = RecordedValueProcessor <double3x3> .AttachComponents(s, (IField <double3x3>) field); } if (type == typeof(double4)) { fieldTracker.driven_field.Target = RecordedValueProcessor <double4> .AttachComponents(s, (IField <double4>) field); } if (type == typeof(double4x4)) { fieldTracker.driven_field.Target = RecordedValueProcessor <double4x4> .AttachComponents(s, (IField <double4x4>) field); } if (type == typeof(doubleQ)) { fieldTracker.driven_field.Target = RecordedValueProcessor <doubleQ> .AttachComponents(s, (IField <doubleQ>) field); } if (type == typeof(short)) { fieldTracker.driven_field.Target = RecordedValueProcessor <short> .AttachComponents(s, (IField <short>) field); } if (type == typeof(ushort)) { fieldTracker.driven_field.Target = RecordedValueProcessor <ushort> .AttachComponents(s, (IField <ushort>) field); } if (type == typeof(uint)) { fieldTracker.driven_field.Target = RecordedValueProcessor <uint> .AttachComponents(s, (IField <uint>) field); } //source_field.Target = null; }
public void StartRecording() { //STREAMS if (metagen_comp.recording_streams && !streamRecorder.isRecording) { streamRecorder.StartRecording(); //Record the first frame //streamRecorder.RecordStreams(0f); } //CONTROLLER STREAMS if (metagen_comp.recording_controllers && !controllerRecorder.isRecording) { controllerRecorder.StartRecording(); //Record the first frame //controllerRecorder.RecordStreams(0f); } //EYE STREAMS if (metagen_comp.recording_faces && !eyeRecorder.isRecording) { eyeRecorder.StartRecording(); //Record the first frame //eyeRecorder.RecordStreams(0f); } //MOUTH STREAMS if (metagen_comp.recording_faces && !mouthRecorder.isRecording) { mouthRecorder.StartRecording(); //Record the first frame //mouthRecorder.RecordStreams(0f); } //ANIMATION if (metagen_comp.recording_animation && !animationRecorder.isRecording) { animationRecorder = metagen_comp.Slot.AttachComponent <RecordingTool>(); animationRecorder.metagen_comp = metagen_comp; animationRecorder.StartRecording(); //Record the first frame //animationRecorder.RecordFrame(); } //BVH if (metagen_comp.recording_bvh && !bvhRecorder.isRecording) { bvhRecorder.StartRecording(); } //AUDIO if (metagen_comp.recording_voice && !voiceRecorder.isRecording) { voiceRecorder.StartRecording(); } //HEARING if (metagen_comp.recording_hearing && !metagen_comp.hearingRecorder.isRecording) { metagen_comp.hearingRecorder.StartRecording(); } //VIDEO if (metagen_comp.recording_vision && !visionRecorder.isRecording) { visionRecorder.StartRecording(); //Record the first frame //visionRecorder.RecordVision(); } isRecording = true; }
void OnGUI() { if (!EditorApplication.isPlaying || Settings.s == null) { EditorGUILayout.HelpBox("Please start the scene to use this window.", MessageType.Info); t = null; return; } if (t == null) { t = Instantiate(MapLoader.Loader.controller.recordingToolPrefab); } GUILayout.BeginHorizontal(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); var centeredStyle = new GUIStyle(GUI.skin.label); centeredStyle.alignment = TextAnchor.MiddleCenter; GUILayout.EndHorizontal(); GUILayout.BeginVertical(); GUILayout.Label("Status: " + t.State.ToString()); GUILayout.BeginHorizontal(); if (t.State != RecordingTool.RecordingState.Recording) { if (GUILayout.Button("Start Recording")) { t.StartRecording(); } } else { if (GUILayout.Button("Stop Recording")) { t.StopRecording(); } } EditorGUI.BeginDisabledGroup(t.State != RecordingTool.RecordingState.Playback); DrawPlayControls(t); EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(t.State == RecordingTool.RecordingState.Idle); if (GUILayout.Button("Reset")) { t.Reset(); } GUILayout.EndHorizontal(); t.CurrentTime = GUILayout.HorizontalSlider(t.CurrentTime, 0.0f, t.Data?.Duration ?? 0); GUILayout.Space(20); GUILayout.BeginHorizontal(); GUILayout.Label("Playback Speed"); string playbackSpeed = GUILayout.TextField(t.PlaybackSpeed.ToString("#.##")); float.TryParse(playbackSpeed, out t.PlaybackSpeed); if (GUILayout.Button("-1x")) { t.PlaybackSpeed = -1; } if (GUILayout.Button("0.5x")) { t.PlaybackSpeed = 0.5f; } if (GUILayout.Button("1x")) { t.PlaybackSpeed = 1; } if (GUILayout.Button("2x")) { t.PlaybackSpeed = 2; } GUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); GUILayout.Space(30); GUILayout.EndVertical(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Save to Clipboard")) { GUIUtility.systemCopyBuffer = JsonConvert.SerializeObject(t.Data);; } if (GUILayout.Button("Paste from Clipboard")) { t.Data = JsonConvert.DeserializeObject <RecordingTool.RecordingData>(GUIUtility.systemCopyBuffer); } GUILayout.EndHorizontal(); t.AlignCameraToGame = EditorGUILayout.Toggle("Align Unity's Camera with Game Camera", t.AlignCameraToGame); t.InterpolateTransforms = EditorGUILayout.Toggle("Interpolate object transforms during playback", t.InterpolateTransforms); if (GUILayout.Button("(DEBUG) Show Spawned Always Objects")) { alwaysNameList = new List <string>(); if (t.SpawnedAlwaysObjects != null) { foreach (var spo in t.SpawnedAlwaysObjects.Values) { alwaysNameList.Add(spo.perso.fullName); } } } GUILayout.BeginVertical(); if (alwaysNameList != null) { foreach (var spo in alwaysNameList) { GUILayout.Label(spo); } } GUILayout.EndVertical(); }
private async void StartPlayingInternal() { try { if (generateAnimation) { metagen_comp.World.RunSynchronously(() => { animationRecorder = metagen_comp.Slot.AttachComponent <RecordingTool>(); animationRecorder.metagen_comp = metagen_comp; }); } //Dictionary<RefID, User>.ValueCollection users = metagen_comp.World.AllUsers; avatarManager = new metagen.AvatarManager(); List <UserMetadata> userMetadatas = new List <UserMetadata>(); userMetadatas.Add(new UserMetadata { userId = "U-test", bodyNodes = "", devices = "", headDevice = "", isPublic = true, isRecording = true, platform = "", userRefId = "ID2B00" }); Dictionary <RefID, AudioOutput> audio_outputs = new Dictionary <RefID, AudioOutput>(); foreach (UserMetadata user in userMetadatas) { if (!user.isRecording || !user.isPublic) { continue; //at the moment we only allow playing back of public recording, for privacy reasons. In the future, we'll allow private access to the data } RefID user_id = RefID.Parse(user.userRefId); UniLog.Log(user_id.ToString()); user_ids.Add(user_id); channel = new Channel("127.0.0.1:" + (40052).ToString(), ChannelCredentials.Insecure); client = new DataComm.DataCommClient(channel); output_readers[user_id] = client.GetPose(new Empty()).ResponseStream; fake_proxies[user_id] = new List <Tuple <BodyNode, AvatarObjectSlot> >(); avatar_pose_nodes[user_id] = new List <Tuple <BodyNode, IAvatarObject> >(); avatar_stream_channels[user_id] = new Dictionary <BodyNode, Tuple <bool, bool, bool> >(); proxy_slots[user_id] = new Dictionary <BodyNode, Slot>(); if (avatarManager.avatar_template == null && avatar_template != null) { avatarManager.avatar_template = avatar_template; } Slot avatar = await avatarManager.GetAvatar(); UniLog.Log("AVATAR"); UniLog.Log(avatar.ToString()); avatars[user_id] = avatar; List <IAvatarObject> components = avatar.GetComponentsInChildren <IAvatarObject>(); List <AvatarObjectSlot> root_comps = avatar.GetComponentsInChildren <AvatarObjectSlot>(); boness[user_id] = avatar.GetComponentInChildren <Rig>()?.Bones.ToList(); VRIKAvatar avatarIK = avatar.GetComponentInChildren <VRIKAvatar>(); //READ absolute time //output_readers[user_id].ReadSingle(); //READ number of body nodes int numBodyNodes = 28; //TODO CHECK for (int i = 0; i < numBodyNodes; i++) { //READ body node type //int nodeInt = //READ if scale stream exists bool scale_exists = true; //READ if position stream exists bool pos_exists = true; //READ if rotation stream exists bool rot_exists = true; BodyNode bodyNodeType = VNetcBodyNodeConverter[i]; bool node_found = false; foreach (IAvatarObject comp in components) { foreach (AvatarObjectSlot comp2 in root_comps) { if (comp.Node == bodyNodeType && comp2.Node == bodyNodeType) { UniLog.Log((comp.Node, scale_exists, pos_exists, rot_exists)); if (bodyNodeType == BodyNode.Root) { proxy_slots[user_id][bodyNodeType] = avatar; } else { proxy_slots[user_id][bodyNodeType] = comp.Slot; } comp.Equip(comp2); if (bodyNodeType != BodyNode.Root) { SyncRef <Slot> sourceField = (SyncRef <Slot>)comp.GetType().GetField("_source", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(comp); sourceField.Target = null; FieldDrive <float3> posField = (FieldDrive <float3>)comp.GetType().GetField("_position", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(comp); posField.Target = null; FieldDrive <floatQ> rotField = (FieldDrive <floatQ>)comp.GetType().GetField("_rotation", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(comp); rotField.Target = null; } fake_proxies[user_id].Add(new Tuple <BodyNode, AvatarObjectSlot>(bodyNodeType, comp2)); avatar_pose_nodes[user_id].Add(new Tuple <BodyNode, IAvatarObject>(comp.Node, comp)); comp2.IsTracking.Value = true; if (bodyNodeType == BodyNode.LeftFoot || bodyNodeType == BodyNode.RightFoot) { avatarIK.ForceUseFeetProxies.Value = true; } if (bodyNodeType == BodyNode.LeftLowerLeg || bodyNodeType == BodyNode.RightLowerLeg) { avatarIK.ForceUseKneeProxies.Value = true; } if (bodyNodeType == BodyNode.LeftLowerArm || bodyNodeType == BodyNode.RightLowerArm) { avatarIK.ForceUseElbowProxies.Value = true; } if (bodyNodeType == BodyNode.Chest) { avatarIK.ForceUseChestProxy.Value = true; } if (bodyNodeType == BodyNode.Hips) { avatarIK.ForceUsePelvisProxy.Value = true; } node_found = true; break; } if (node_found) { break; } } } //if (!node_found) throw new Exception("Node " + bodyNodeType.ToString() + " not found in avatar!"); if (!node_found) { fake_proxies[user_id].Add(new Tuple <BodyNode, AvatarObjectSlot>(bodyNodeType, null)); avatar_pose_nodes[user_id].Add(new Tuple <BodyNode, IAvatarObject>(bodyNodeType, null)); } avatar_stream_channels[user_id][bodyNodeType] = new Tuple <bool, bool, bool>(scale_exists, pos_exists, rot_exists); } Slot avatarRootSlot = avatar.GetComponentInChildren <AvatarRoot>()?.Slot; if (avatarRootSlot != null) { avatarRootSlot.LocalPosition = new float3(0, 0, 0); avatarRootSlot.LocalRotation = new floatQ(0, 0, 0, 1); } //READ whether hands are being tracked hands_are_tracked[user_id] = false; //READ whether metacarpals are being tracked //output_readers[user_id].ReadBoolean(); List <HandPoser> these_hand_posers = avatar.GetComponentsInChildren <HandPoser>(null, excludeDisabled: false, includeLocal: false); UniLog.Log("getting finger rotation vars"); finger_slots[user_id] = new Dictionary <BodyNode, Slot>(); hand_posers[user_id] = new Dictionary <Chirality, HandPoser>(); finger_compensations[user_id] = new Dictionary <BodyNode, floatQ>(); foreach (HandPoser hand_poser in these_hand_posers) { UniLog.Log("HI"); hand_posers[user_id][hand_poser.Side] = hand_poser; BodyNode side1 = BodyNode.LeftThumb_Metacarpal.GetSide((Chirality)hand_poser.Side); BodyNode side2 = BodyNode.LeftPinky_Tip.GetSide((Chirality)hand_poser.Side); for (BodyNode nodee = side1; nodee <= side2; ++nodee) { int index = nodee - side1; FingerType fingerType = nodee.GetFingerType(); FingerSegmentType fingerSegmentType = nodee.GetFingerSegmentType(); HandPoser.FingerSegment fingerSegment = hand_poser[fingerType][fingerSegmentType]; if (fingerSegment != null && fingerSegment.Root.Target != null)//&& fingerSegment.RotationDrive.IsLinkValid) { UniLog.Log(nodee.ToString()); finger_slots[user_id][nodee] = fingerSegment.Root.Target; proxy_slots[user_id][nodee] = fingerSegment.Root.Target; finger_compensations[user_id][nodee] = fingerSegment.CoordinateCompensation.Value; fingerSegment.RotationDrive.Target = (IField <floatQ>)null; } } } UniLog.Log("got finger rotation vars"); //AUDIO PLAY audio_outputs[user_id] = null; //UniLog.Log("Setting up audio!"); //avatar.GetComponentInChildren<AudioOutput>().Source.Target = null; //for (int i = 0; i < 2; i++) //{ // string audio_file; // if (i==0) // { // if (!play_hearing) continue; // string[] files = Directory.GetFiles(reading_directory, user_id.ToString() + "*_hearing.ogg"); // audio_file = files.Length > 0 ? files[0] : null; // } else // { // if (!play_voice) continue; // string[] files = Directory.GetFiles(reading_directory, user_id.ToString() + "*_voice.ogg"); // audio_file = files.Length > 0 ? files[0] : null; // } // if (File.Exists(audio_file)) // { // AudioOutput audio_output = avatar.GetComponentInChildren<AudioOutput>(); // if (audio_output.Source.Target != null) audio_output = audio_output.Slot.AttachComponent<AudioOutput>(); // VisemeAnalyzer visemeAnalyzer = avatar.GetComponentInChildren<VisemeAnalyzer>(); // audio_output.Volume.Value = 1f; // audio_output.Enabled = true; // //audio_outputs[user_id] = audio_output; // //AudioX audioData = new AudioX(reading_directory + "/" + user_id.ToString() + "_audio.wav"); // //AssetRef<AudioClip> audioClip = new AssetRef<AudioClip>(); // Uri uri = this.World.Engine.LocalDB.ImportLocalAsset(audio_file, LocalDB.ImportLocation.Original, (string)null); // //ToWorld thing = new ToWorld(); // //var awaiter = thing.GetAwaiter(); // //awaiter.GetResult(); // StaticAudioClip audioClip = audio_output.Slot.AttachAudioClip(uri); // AudioClipPlayer player = audio_output.Slot.AttachComponent<AudioClipPlayer>(); // if (visemeAnalyzer != null) // { // visemeAnalyzer.Source.Target = player; // } // UniLog.Log("attaching clip to player"); // player.Clip.Target = (IAssetProvider<AudioClip>) audioClip; // UniLog.Log("attaching player to audio output"); // audio_output.Source.Target = (IAudioSource) player; // audio_output.Slot.AttachComponent<AudioMetadata>(true, (Action<AudioMetadata>)null).SetFromCurrentWorld(); // player.Play(); // } //} } avatars_finished_loading = true; isPlaying = true; if (generateAnimation) { animationRecorder.StartRecordingAvatars(avatars, audio_outputs); } if (generateBvh) { bvhRecorder.StartRecordingAvatars(avatars); } } catch (Exception e) { UniLog.Log("TwT: " + e.Message); UniLog.Log(e.StackTrace); } }