feat: Implemented audio effects
This commit is contained in:
parent
fe0ab3b498
commit
edbc390d14
125 changed files with 1137 additions and 217 deletions
24
scripts/generate-audio-sprites.ts
Normal file
24
scripts/generate-audio-sprites.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import audioSprite from 'audiosprite';
|
||||
import { $, which } from 'bun';
|
||||
import fs from "node:fs/promises";
|
||||
import path from 'node:path';
|
||||
|
||||
var files = await Array.fromAsync(new Bun.Glob('*.{ogg,wav}').scan({ cwd: './src/sounds' }));
|
||||
console.log("Loaded", files.join(","));
|
||||
|
||||
await new Promise((resolve) =>
|
||||
{
|
||||
audioSprite(
|
||||
files.map(f => path.join(path.resolve('./src/sounds'), f)),
|
||||
{
|
||||
output: path.resolve('./src/mainview/assets/sounds'),
|
||||
path: path.resolve('./src/sounds'),
|
||||
format: 'howler',
|
||||
export: 'ogg'
|
||||
}, async function (err, obj: any)
|
||||
{
|
||||
if (err) return console.error(err);
|
||||
delete obj.urls;
|
||||
Bun.file('./src/mainview/assets/sounds.json').write(JSON.stringify(obj, null, 2)).then(r => resolve(true));
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue