fix syntax

This commit is contained in:
2026-02-17 09:15:15 -06:00
parent f310c18b84
commit 4e1b63fd0e
52 changed files with 2169 additions and 1754 deletions

View File

@@ -35,16 +35,16 @@ var player = soundwave.create({
// Load and cache PCM data from a file path
audio.pcm = function pcm(file) {
file = res.find_sound(file)
if (!file) return null
var path = res.find_sound(file)
if (!path) return null
// Check player's cache first
if (player.pcm_cache[file]) return player.pcm_cache[file]
var buf = io.slurp(file)
if (player.pcm_cache[path]) return player.pcm_cache[path]
var buf = io.slurp(path)
if (!buf) return null
return player.decode(buf, file)
return player.decode(buf, path)
}
// Play a sound file, returns voice object
@@ -73,11 +73,12 @@ feeder.resume_device()
// Audio pump - called periodically to fill the audio buffer
function pump() {
var mixed = null
while (feeder.queued() < CHUNK_BYTES * 3) {
var mixed = player.pull(FRAMES_PER_CHUNK)
mixed = player.pull(FRAMES_PER_CHUNK)
feeder.put(mixed)
}
$delay(pump, 1/240)
}