-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add spatial audio attach to camera, mesh or transform node feature #16161
base: audio-engine-v2
Are you sure you want to change the base?
Conversation
... because the `preloadedCount` property is easily confused with the `preloadCount` property.
# Conflicts: # packages/dev/core/src/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.ts # packages/dev/core/src/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.ts # packages/dev/core/src/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.ts # packages/dev/core/src/AudioV2/abstractAudio/subProperties/spatialAudioListener.ts # packages/dev/core/src/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.ts
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.
Copilot reviewed 5 out of 13 changed files in this pull request and generated 3 comments.
Files not reviewed (8)
- packages/dev/core/src/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.ts: Evaluated as low risk
- packages/dev/core/src/AudioV2/webAudio/webAudioEngine.ts: Evaluated as low risk
- packages/dev/core/src/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.ts: Evaluated as low risk
- packages/dev/core/src/AudioV2/abstractAudio/subProperties/spatialAudioListener.ts: Evaluated as low risk
- packages/dev/core/src/AudioV2/abstractAudio/subProperties/spatialAudio.ts: Evaluated as low risk
- packages/dev/core/src/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.ts: Evaluated as low risk
- packages/dev/core/src/AudioV2/abstractAudio/spatialAttachers/abstractSpatialAudioAttacher.ts: Evaluated as low risk
- packages/dev/core/src/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.ts: Evaluated as low risk
Comments suppressed due to low confidence (1)
packages/dev/core/src/AudioV2/abstractAudio/spatialAttachers/spatialAudioAttacher.ts:9
- [nitpick] The constants in
_SpatialAudioAttachedEntity
should follow a consistent naming convention. Consider using uppercase for the constants.
export const _SpatialAudioAttachedEntity = {
return null; | ||
} | ||
|
||
private async _resetAttachedEntity(entity: Nullable<AbstractMesh | Camera | TransformNode>, attacherClassName: string): Promise<void> { |
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.
The method _resetAttachedEntity
does not handle potential errors from asynchronous operations. Add error handling to ensure robustness.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
|
||
/** @internal */ | ||
public set camera(camera: Nullable<Camera>) { | ||
if (this._camera === this.camera) { |
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.
The comparison should be if (this._camera === camera) {
.
if (this._camera === this.camera) { | |
if (this._camera === camera) { |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
super.update(); | ||
|
||
if (force) { | ||
this._camera?.computeWorldMatrix(); |
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.
The computeWorldMatrix
method should be called with the force
parameter: this._camera?.computeWorldMatrix(force);
.
this._camera?.computeWorldMatrix(); | |
this._camera?.computeWorldMatrix(force); |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
Thank you.
Sent from Yahoo Mail for iPhone
On Saturday, February 8, 2025, 1:16 PM, Copilot ***@***.***> wrote:
@Copilot commented on this pull request.
Copilot reviewed 5 out of 13 changed files in this pull request and generated 3 comments.
Files not reviewed (8)
- packages/dev/core/src/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.ts: Evaluated as low risk
- packages/dev/core/src/AudioV2/webAudio/webAudioEngine.ts: Evaluated as low risk
- packages/dev/core/src/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.ts: Evaluated as low risk
- packages/dev/core/src/AudioV2/abstractAudio/subProperties/spatialAudioListener.ts: Evaluated as low risk
- packages/dev/core/src/AudioV2/abstractAudio/subProperties/spatialAudio.ts: Evaluated as low risk
- packages/dev/core/src/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.ts: Evaluated as low risk
- packages/dev/core/src/AudioV2/abstractAudio/spatialAttachers/abstractSpatialAudioAttacher.ts: Evaluated as low risk
- packages/dev/core/src/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.ts: Evaluated as low risk
Comments suppressed due to low confidence (1)
packages/dev/core/src/AudioV2/abstractAudio/spatialAttachers/spatialAudioAttacher.ts:9
- [nitpick] The constants in _SpatialAudioAttachedEntity should follow a consistent naming convention. Consider using uppercase for the constants.
export const _SpatialAudioAttachedEntity = {
In packages/dev/core/src/AudioV2/abstractAudio/spatialAttachers/spatialAudioAttacher.ts:
+ return this._attachedEntity
+ ? _CreateSpatialAudioCameraAttacherAsync(this._attachedEntity as Camera, this._spatialAudioNode, this._attachmentType, this._minUpdateTime)
+ : null;
+ case _SpatialAudioAttachedEntity.MESH:
+ return this._attachedEntity
+ ? _CreateSpatialAudioMeshAttacherAsync(this._attachedEntity as AbstractMesh, this._spatialAudioNode, this._attachmentType, this._minUpdateTime)
+ : null;
+ case _SpatialAudioAttachedEntity.TRANSFORM_NODE:
+ return this._attachedEntity
+ ? _CreateSpatialAudioTransformNodeAttacherAsync(this._attachedEntity as TransformNode, this._spatialAudioNode, this._attachmentType, this._minUpdateTime)
+ : null;
+ }
+ return null;
+ }
+
+ private async _resetAttachedEntity(entity: Nullable<AbstractMesh | Camera | TransformNode>, attacherClassName: string): Promise<void> {
The method _resetAttachedEntity does not handle potential errors from asynchronous operations. Add error handling to ensure robustness.
In packages/dev/core/src/AudioV2/abstractAudio/spatialAttachers/spatialAudioCameraAttacher.ts:
+}
+
+/** @internal */
+export class _SpatialAudioCameraAttacher extends _AbstractSpatialAudioAttacher {
+ protected _camera: Nullable<Camera> = null;
+
+ /** @internal */
+ public constructor(camera: Camera, spatialAudioNode: ISpatialAudioNode, attachmentType: SpatialAudioAttachmentType, minUpdateTime: number) {
+ super(spatialAudioNode, attachmentType, minUpdateTime);
+
+ this.camera = camera;
+ }
+
+ /** @internal */
+ public set camera(camera: Nullable<Camera>) {
+ if (this._camera === this.camera) {
The comparison should be if (this._camera === camera) {.
⬇️ Suggested change- if (this._camera === this.camera) {
+ if (this._camera === camera) {
In packages/dev/core/src/AudioV2/abstractAudio/spatialAttachers/spatialAudioCameraAttacher.ts:
+ public override dispose(): void {
+ super.dispose();
+ this._clearCamera();
+ }
+
+ /** @internal */
+ public getClassName(): string {
+ return "_SpatialAudioCameraAttacher";
+ }
+
+ /** @internal */
+ public override update(force = false): void {
+ super.update();
+
+ if (force) {
+ this._camera?.computeWorldMatrix();
The computeWorldMatrix method should be called with the force parameter: this._camera?.computeWorldMatrix(force);.
⬇️ Suggested change- this._camera?.computeWorldMatrix();
+ this._camera?.computeWorldMatrix(force);
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
This change implements the "attach" feature for the spatial audio listener and sound sources.