rm dupavlue and freevalue

This commit is contained in:
2026-02-25 09:42:27 -06:00
parent ad7ee40fe0
commit 31ce47ec12

6
dsp.c
View File

@@ -29,7 +29,6 @@ JSC_CCALL(dsp_mix_blobs,
JSValue first_blob = JS_GetPropertyNumber(js, blobs_arr, 0);
size_t out_bytes;
float *first_data = (float*)js_get_blob_data(js, &out_bytes, first_blob);
JS_FreeValue(js, first_blob);
if (first_data == (void*)-1) return JS_EXCEPTION;
if (out_bytes == 0) return js_new_blob_stoned_copy(js, NULL, 0);
@@ -43,16 +42,13 @@ JSC_CCALL(dsp_mix_blobs,
size_t blob_len;
float *blob_data = (float*)js_get_blob_data(js, &blob_len, blob_val);
JS_FreeValue(js, blob_val);
if (blob_data == (void*)-1) {
JS_FreeValue(js, vol_val);
free(mix_buf);
return JS_EXCEPTION;
}
double vol = 1.0;
JS_ToFloat64(js, &vol, vol_val);
JS_FreeValue(js, vol_val);
// Mix samples (use min length to avoid overrun)
size_t samples = blob_len / sizeof(float);
@@ -87,8 +83,6 @@ JSC_CCALL(dsp_lpf,
JSValue channels_val = JS_GetPropertyStr(js, argv[1], "channels");
if (!JS_IsNull(cutoff_val)) JS_ToFloat64(js, &cutoff, cutoff_val);
if (!JS_IsNull(channels_val)) JS_ToInt32(js, &channels, channels_val);
JS_FreeValue(js, cutoff_val);
JS_FreeValue(js, channels_val);
if (cutoff < 0.0) cutoff = 0.0;
if (cutoff > 1.0) cutoff = 1.0;