feat(dmr): decode and route AMBE voice

This commit is contained in:
2026-07-14 18:55:28 +03:00
parent e0e74b5337
commit 28c434d9a7
7 changed files with 231 additions and 10 deletions
+27
View File
@@ -9,6 +9,20 @@ uses
const
BS_VOICE_SYNC = '131111333113313313113313';
type
TAudioSink = class
public
CallCount: Integer;
SampleCount: Integer;
procedure AudioReady(const PCM: array of Single; Count: Integer);
end;
procedure TAudioSink.AudioReady(const PCM: array of Single; Count: Integer);
begin
Inc(CallCount);
Inc(SampleCount, Count);
end;
procedure FeedSync(D: TDMRDecoder; const Pattern: string; Invert: Boolean);
var
L, R: array of Single;
@@ -95,9 +109,12 @@ end;
var
D: TDMRDecoder;
S: TDMRStatus;
Sink: TAudioSink;
begin
Sink := TAudioSink.Create;
D := TDMRDecoder.Create;
try
D.OnAudio := Sink.AudioReady;
D.SetEnabled(True);
FeedSync(D, BS_VOICE_SYNC, False);
Sleep(50);
@@ -124,8 +141,18 @@ begin
D.SetInverted(False);
D.SetEnabled(True);
TestBurst(D);
D.GetStatus(S);
if S.VocoderAvailable and
((Sink.CallCount <> 3) or
(Sink.SampleCount <> 3 * DMR_VOICE_FRAME_SAMPLES)) then
begin
WriteLn('AMBE callback failed: calls=', Sink.CallCount,
' samples=', Sink.SampleCount);
Halt(5);
end;
WriteLn('DMR front-end sync tests passed');
finally
D.Free;
Sink.Free;
end;
end.