Fix some fading problems
This commit is contained in:
@@ -44,6 +44,7 @@ export default class Resonator {
|
|||||||
stream(path, type = SourceType.MasterSource) {
|
stream(path, type = SourceType.MasterSource) {
|
||||||
const element = new Audio(path);
|
const element = new Audio(path);
|
||||||
element.crossOrigin = 'anonymous';
|
element.crossOrigin = 'anonymous';
|
||||||
|
element.volume = 1;
|
||||||
const source = new StreamingSource(this.graph, this.scene, this.context, element, type);
|
const source = new StreamingSource(this.graph, this.scene, this.context, element, type);
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
@@ -140,7 +140,7 @@ export default class AudioSource {
|
|||||||
if (!this.node) {
|
if (!this.node) {
|
||||||
this.play();
|
this.play();
|
||||||
}
|
}
|
||||||
this.gain.gain.setValueAtTime(0, this.context.getContext().currentTime);
|
this.gain.gain.setValueAtTime(0.0001, this.context.getContext().currentTime);
|
||||||
this.gain.gain.exponentialRampToValueAtTime(this.volume, this.context.getContext().currentTime + time);
|
this.gain.gain.exponentialRampToValueAtTime(this.volume, this.context.getContext().currentTime + time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -84,7 +84,7 @@ export class StreamingSource {
|
|||||||
if (!this.node) {
|
if (!this.node) {
|
||||||
this.play();
|
this.play();
|
||||||
}
|
}
|
||||||
this.gain.gain.setValueAtTime(0, this.context.getContext().currentTime);
|
this.gain.gain.setValueAtTime(0.0001, this.context.getContext().currentTime);
|
||||||
this.gain.gain.exponentialRampToValueAtTime(this.getVolume(), this.context.getContext().currentTime + time);
|
this.gain.gain.exponentialRampToValueAtTime(this.getVolume(), this.context.getContext().currentTime + time);
|
||||||
}
|
}
|
||||||
fadeOut(time) {
|
fadeOut(time) {
|
||||||
|
Reference in New Issue
Block a user