AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Dynamisches Array oder Klasse als Array auslegen

Dynamisches Array oder Klasse als Array auslegen

Ein Thema von EWeiss · begonnen am 22. Sep 2006 · letzter Beitrag vom 30. Sep 2006
 
EWeiss
(Gast)

n/a Beiträge
 
#3

Re: Dynamisches Array oder Klasse als Array auslegen

  Alt 22. Sep 2006, 20:37
Danke marabu.

Werde mir das mal zu gemüte führen..
Anbei nochmal die ganze klasse (Delphi style angepasst)

Delphi-Quellcode:
Type
  //WinampDSPInfo Klasse
  PWinampDSPInfo = ^TWinampDSPInfo;
  TWinampDSPInfo = record
     csH : TRTLCriticalSection; // CRITICAL_SECTION
     handle : DWORD;                      // DSP handle
     NumberOfModules : UINT;                      // number of modules in the dsp
     hDll : HWND;                // the dll instance
     pModule : PWinampDSPHeader;       // module header
     pDSP :   PWinampDSPModule;       // current selected dsp module
     hchannel : DWORD;                      // channel associated to dsp
    module : DWORD;                      // curent selected dsp module
     hdsp : HDSP;                         // optional dsp handle
     DSP_Window_Emu : HWND;             // related fake window handle
     DSP_Atom_Emu : ATOM;                   // related fake window atom
     songTitle : array[0..MAX_PATH-1] of char; // the playing song title
     fileName : array[0..MAX_PATH-1] of char; // the playing file name
     info : BASS_CHANNELINFO;       // channel info
  end;
Delphi-Quellcode:
implementation

var
 winampDSP : PWinampDSPInfo = nil;
Der sinn des arrays liegt darin das bei jeden aufruf eines neuen DSP Plugins
eine neue Instanz von winampDSP gebildet werden soll das geschieht hier.

Original
Code:
void AddDSP(WINAMPPLUGINPROPDSP *winampDsp)
{
   DWORD a;
   for (a=0;a<winampDSPcounter;a++)
        if (!winampDSP[a]) break;

   if (a==winampDSPcounter)
   { 
      // no empty slot, so add a new one
      winampDSP = (WINAMPPLUGINPROPDSP**)realloc(winampDSP, (winampDSPcounter+1)*sizeof(WINAMPPLUGINPROPDSP*));
      winampDSPcounter++;
   }
   winampDsp->handle = ++winampDSPhandle;
   // insert the new Winamp DSP
   winampDSP[a] = winampDsp;
}
Übersetzt
Delphi-Quellcode:
procedure AddDSP(winampDsp: PWinampDSPInfo);
var
  a: DWORD;

begin
   for a := 0 to winampDSPcounter do
        if (not winampDSP[a]) then break;

   if a = winampDSPcounter then
   Begin
      // no empty slot, so add a new one
// winampDSP := ReallocMem(winampDSP, (winampDSPcounter + 1) SizeOf(PWinampDSPInfo);
      winampDSPcounter;
   end;
   winampDsp^.handle := winampDSPhandle;
   // insert the new Winamp DSP
// winampDSP[a] := winampDsp;
end;
Hier sind meine beiden Probleme.
ReallocMem ärger bei 'SizeOf'
und halt das berüchtigte array winampDSP[a] := winampDsp;

Vielleicht kannst ja mal drüberfliegen was da nicht in Ordnung ist.

gruß
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:11 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz