mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:37:33 +00:00
Optimize web audio mic path: remove redundant copy and heap alloc
WebOnMic: drop intermediate Singles[] array, read PSingle directly. PushAudio: replace per-frame SetLength/array of Byte with pre-allocated FWsAudioBuf field — eliminates heap allocation from the DSP thread. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+8
-5
@@ -6135,16 +6135,19 @@ end;
|
||||
|
||||
procedure TMainForm.WebOnMic(Samples: PSingle; Count: Integer);
|
||||
var
|
||||
Singles: array[0..5759] of Single;
|
||||
Buf: array[0..5759] of Double;
|
||||
i, n: Integer;
|
||||
Buf: array[0..5759] of Double;
|
||||
SP: PSingle;
|
||||
i, n: Integer;
|
||||
begin
|
||||
if not FWDSPReady then Exit;
|
||||
n := Count;
|
||||
if n > Length(Buf) then n := Length(Buf);
|
||||
Move(Samples^, Singles[0], n * SizeOf(Single));
|
||||
SP := Samples;
|
||||
for i := 0 to n - 1 do
|
||||
Buf[i] := Singles[i];
|
||||
begin
|
||||
Buf[i] := SP^;
|
||||
Inc(SP);
|
||||
end;
|
||||
FDSPEngine.PushTXMicSamplesD(Buf, n);
|
||||
end;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user