mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-25 20:48:27 +00:00
add hydra audio capture option
This commit is contained in:
parent
de00212bb6
commit
66fd20ace5
@ -12,6 +12,13 @@ await initHydra();
|
|||||||
|
|
||||||
Then you can use hydra below!
|
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
|
## Usage via npm
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import { getDrawContext } from '@strudel.cycles/core';
|
import { getDrawContext } from '@strudel.cycles/core';
|
||||||
|
|
||||||
export async function initHydra() {
|
export async function initHydra(config) {
|
||||||
if (!document.getElementById('hydra-canvas')) {
|
if (!document.getElementById('hydra-canvas')) {
|
||||||
const { canvas: testCanvas } = getDrawContext();
|
const { canvas: testCanvas } = getDrawContext();
|
||||||
await import('https://unpkg.com/hydra-synth');
|
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.id = 'hydra-canvas';
|
||||||
h.canvas.style.position = 'absolute';
|
h.canvas.style.position = 'absolute';
|
||||||
h.canvas.style.top = '0px';
|
h.canvas.style.top = '0px';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user