-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Audio: Add checks for detune on audio buffer for Safari #15588
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
Conversation
src/audio/Audio.js
Outdated
| source.buffer = this.buffer; | ||
| source.detune.value = this.detune; | ||
|
|
||
| if ( source.detune ) { |
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.
What if it is zero? Test for undefined?
src/audio/Audio.js
Outdated
|
|
||
| this.detune = value; | ||
|
|
||
| if ( !this.source.detune ) return; |
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.
if ( ! this.source.detune ) return;
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 would add a warning here:
console.warn( 'THREE.Audio: AudioBufferSourceNode.detune not supported by the browser.' );|
Updated. |
|
|
||
| source.buffer = this.buffer; | ||
| source.detune.value = this.detune; | ||
| this.setDetune( this.detune ); |
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 there is a problem if you set detune like this. Since isPlaying is still false at this line, the value is actually not assigned to the AudioBufferSourceNode.
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.
Definitely worth investigating, but I'll merge this for now so we no longer break in iOS 12.
|
Thanks! |
Fixes #15566