howler-plugin-effect-chain icon indicating copy to clipboard operation
howler-plugin-effect-chain copied to clipboard

Property 'addEffect' does not exist on type 'HowlerGlobal'

Open koraysels opened this issue 6 years ago • 1 comments

I am getting this error in a Typescript project. (howler v2.0.15)

Property 'addEffect' does not exist on type 'HowlerGlobal'

my code is as follows:

import { Howl, Howler } from 'howler';
import 'howler-plugin-effect-chain';
import Tuna from 'tunajs';

const tuna = new Tuna(Howler.ctx);
const chorus = new tuna.Chorus({});
Howler.addEffect(chorus);

koraysels avatar Sep 17 '18 15:09 koraysels

Hi @koraysels. The example is missing an instantiation of a Howl object. This is due to the internals of howler: it is only fully initialised after creating a Howl.

import { Howl, Howler } from 'howler';
import 'howler-plugin-effect-chain';
import Tuna from 'tunajs';

const sound = new Howl({ src: 'somefile.mp3' });

const tuna = new Tuna(Howler.ctx);
const chorus = new tuna.Chorus({});
Howler.addEffect(chorus);

Adding line 5 there should fix the issue. Let me know if it works, and I'll update the README.

alexanderwallin avatar Sep 18 '18 14:09 alexanderwallin