mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-26 04:47:35 +00:00
feat(dmr): decode and route AMBE voice
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user