mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:37:33 +00:00
37 lines
876 B
ObjectPascal
37 lines
876 B
ObjectPascal
program dmr_bindings_test;
|
|
|
|
{$MODE Delphi}
|
|
|
|
uses
|
|
SysUtils, DMRBindings;
|
|
|
|
var
|
|
Decoder: Pointer;
|
|
Bits: array[0..DMR_AMBE_BITS - 1] of Byte;
|
|
PCM: array[0..DMR_PCM_SAMPLES - 1] of Single;
|
|
Info: TDMRMbeResult;
|
|
begin
|
|
if not DMRLoad then
|
|
begin
|
|
WriteLn(DMRLastError);
|
|
Halt(1);
|
|
end;
|
|
// Several simultaneous slice decoders share one dynamically loaded adapter.
|
|
if not DMRLoad then Halt(4);
|
|
DMRUnload;
|
|
if not DMRLoaded then Halt(5);
|
|
Decoder := DMRMbeCreate(3);
|
|
if Decoder = nil then Halt(2);
|
|
try
|
|
FillChar(Bits, SizeOf(Bits), 0);
|
|
Bits[0] := 2; // ABI must reject values other than 0/1 before mbelib.
|
|
if DMRMbeDecode(Decoder, @Bits[0], @PCM[0], @Info) <> -2 then Halt(3);
|
|
DMRMbeReset(Decoder);
|
|
finally
|
|
DMRMbeDestroy(Decoder);
|
|
DMRUnload;
|
|
end;
|
|
if DMRLoaded then Halt(6);
|
|
WriteLn('DMR native bindings tests passed');
|
|
end.
|