Einzelnen Beitrag anzeigen

Wishmaster

Registriert seit: 14. Sep 2002
Ort: Steinbach, MB, Canada
301 Beiträge
 
Delphi XE2 Architect
 
#1

ich brauche hilfe mit Record’s

  Alt 26. Mär 2013, 07:42
Hi, ich brauche hilfe mit Record’s. genauer gesagt, ich versuche eine liste aus eine dll zu exportieren
allerding wird einer der eintrage nicht richtig angezeig,


Delphi-Quellcode:
type
  TDeviceInfo = record
   DeviceName : PWideChar;
   DeviceID : PInteger;
  end;

   PDeviceInfo = Array of TDeviceInfo;
das ist der dll part
Delphi-Quellcode:
function TPlayer.Get_Device_Name(var DeviceInfo : PDeviceInfo; Driver : TDriver_Type): Boolean;
var
  WAS_Info : BASS_WASAPI_DEVICEINFO;
  DS_Info : BASS_DEVICEINFO;
  Device, DefDevice : Integer;
begin
 case Driver of
   Driver_DirectSound:
    begin
     try
       SetLength(DeviceInfo, 1);
       Device:= 0;
      while (BASS_GetDeviceInfo(Device, DS_Info) <> false) do
       begin
        DeviceInfo[Device].DeviceName:= PWideChar(Widestring(DS_Info.name));
        Inc(Device);
       end;

       Result:= true;
     except
      Result:= false;
     end;
    end;
   Driver_WASAPI:
    begin
     // ToDo
    end;
   Driver_ASIO:
    begin
      // ToDo
    end;

 end; //case end;
end;


function Player_Get_Device_Name(Obj : Pointer; var DeviceInfo : PDeviceInfo; DriverType : TDriver_Type) : Boolean; export; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
begin
 try
   Result:= TPlayer(Obj).Get_Device_Name(DeviceInfo, DriverType);
 except
  Result:= false;
 end;
end;


exports
...
 Player_Get_Device_Name
...

hier benutze ich Record's und (dll)
Code:
No sound
Digital Audio (S/PDIF) (ASUS XONAR PHOEBUS Audio Device)  << falsch
Speakers (ASUS XONAR PHOEBUS Audio Device)
Digital Audio (S/PDIF) (ASUS XONAR PHOEBUS Audio Device)
Here I use a TStringlist which gives me back the correct result
Code:
No sound
Headset(SB Tactic(3D) Wrath Wireless)                      << Richtig
Speakers (ASUS XONAR PHOEBUS Audio Device)
Digital Audio (S/PDIF) (ASUS XONAR PHOEBUS Audio Device)


and in this way I retrieve the data

Delphi-Quellcode:

var Obj1 : Pointer;
...
var List : TStrings;
    Rec : PDeviceInfo;
    i : integer;
begin
  if Load_PlayerDll(PlayerDLL) then
   begin
    Obj1:= Player_Create(Application.Handle, '');
    Player_Set_Driver(Obj1, Driver_DirectSound);
    Player_Init_Device(Obj1, -1, 44100, false);

    list := TStringlist.Create;

    Player_Get_Device_Name(Obj1, Rec, Driver_DirectSound);
   for I := 0 to SizeOf(Rec) do
    begin
     List.Add(PWideChar(Rec[i].DeviceName));
    end;

    Devicelist.Items.Assign(List);
    list.Free;
   end;

vielleicht habt ihr ja eine bessere idee wie man das lösen könnte
  Mit Zitat antworten Zitat