Why is connectToAnalyser not available from BABYLON.Engine.audioEngine?
It works in Playground, but on a local machine in Visual Studio code, the method does not show in auto-completion. The code is like this:
import * as BABYLON from 'babylonjs';
class Music {
private _music: BABYLON.Sound
private _analyser: BABYLON.Analyser
constructor(scene: BABYLON.Scene) {
this._music = new BABYLON.Sound(
"Music",
"//www.babylonjs.com/demos/AudioAnalyser/cosmosis.mp3",
scene, null, { streaming: true, autoplay: true })
this._analyser = new BABYLON.Analyser(scene)
BABYLON.Engine.audioEngine.connectToAnalyser(this._analyser)
this._analyser.FFT_SIZE = 32
this._analyser.SMOOTHING = 0.9
}
update() {
let fft = this._analyser.getByteFrequencyData()
return(fft)
}
}
and the compiler returned errors:
ERROR in D:\myBabylon\Eight\src\my-scene.ts
./src/my-scene.ts
[tsl] ERROR in D:\myBabylon\Eight\src\my-scene.ts(14,36)
TS2339: Property 'connectToAnalyser' does not exist on type 'IAudioEngine'.
Any help is greatly appreciated!