add hydra audio capture option

This commit is contained in:
Ámbar Tenorio Fornés 2023-11-22 12:36:43 +01:00
parent de00212bb6
commit 66fd20ace5
2 changed files with 9 additions and 2 deletions

View File

@ -12,6 +12,13 @@ await initHydra();
Then you can use hydra below!
### Enable audio capture
Use `{audio: true}` param to enable Hydra's audio capture:
```js
await initHydra({audio: true});
```
## Usage via npm
```sh

View File

@ -1,10 +1,10 @@
import { getDrawContext } from '@strudel.cycles/core';
export async function initHydra() {
export async function initHydra(config) {
if (!document.getElementById('hydra-canvas')) {
const { canvas: testCanvas } = getDrawContext();
await import('https://unpkg.com/hydra-synth');
h = new Hydra({detectAudio: false });
h = new Hydra({detectAudio: config?.audio });
h.canvas.id = 'hydra-canvas';
h.canvas.style.position = 'absolute';
h.canvas.style.top = '0px';