-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce AudioSystem to write back the current state of an audio source #6135
base: dev
Are you sure you want to change the base?
Conversation
After the CI passes: WebThis branch can be previewed at:
Desktop:If you have the launcher installed (download launcher) you can press open on the following link: SDK 6/7:More |
@@ -6,6 +6,7 @@ | |||
using DCL.ECSRuntime; | |||
using RPC.Context; | |||
using System.Collections.Generic; | |||
using UnityEngine; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is a leftover?
using DCL.Controllers; | ||
using DCL.ECS7.InternalComponents; | ||
using DCL.ECSRuntime; | ||
using DCL.Helpers; | ||
using DCL.Models; | ||
using DCL.SettingsCommon; | ||
using System.Collections.Generic; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using Cysharp.Threading.Tasks;
and using System.Collections.Generic;
are not needed, maybe a left over?
using DCL.ECSComponents; | ||
using DCL.ECSRuntime; | ||
using System.Collections.Generic; | ||
using UnityEngine; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove UnityEngine and DCL.ECSRuntime 👌
var audioSourceComponentList = audioSourceComponent.GetForAll(); | ||
|
||
// Loop through every audio source component | ||
foreach (var component in audioSourceComponentList) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be worth it to switch from a foreach
to a for
loop to reduce allocations. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlejandroAlvarezMelucciDCL you are right! The IEnumerator call will allocate, good spot
wrappedComponent.WrappedComponent.Model.AudioClipUrl ??= model.audioClipUrl; | ||
wrappedComponent.WrappedComponent.Model.CurrentTime = model.audioSource.time; | ||
|
||
if (componentsWriter.TryGetValue(scene.sceneData.sceneNumber, out var writer)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can re-order this check to the beginning to avoid doing all the above in case the componentsWriter
doesn't have a writer for the given sceneNumber
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhmmm it would be weird to have a scene without a components writer, to be honest
What does this PR change?
Introduces AudioSourceSystem that can write back the state of an audio source.
Our Code Review Standards
https://github.com/decentraland/unity-renderer/blob/master/docs/code-review-standards.md
Copilot summary
copilot:summary