Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   C++ nach Delphi (https://www.delphipraxis.net/81009-c-nach-delphi.html)

totti14 19. Nov 2006 00:07


C++ nach Delphi
 
Hallöchen,
Ich habe eine kleines C++ File welches ich gerne nach Pascal übersetzen würde.
Leider habe ich von C nur ein paar Grundkenntnisse.
Könnte mir jemand diese beiden Schnipsel mal Übersetzen /Erklären:
Danke schonmal
Thorsten



Code:
//filter.cpp
FILTER::FILTER()
{
filter_type = FLAT_FILTER;
filter_function = NO_FILTERING;
order = 1;
num_of_sections = 1;
fs = SAMPLE_RATE;
fc = fs/2.0;

bq = new BIQUAD *;
*bq = new BIQUAD;

(*bq)->DesignBiquad(FLAT,fs,fc,0.0,0.0);
}
//-----------------------------
void FILTER::Allocate(void)
{
u32 ci;

bq = new BIQUAD *[num_of_sections];

for(ci = 0;ci < FILTER::num_of_sections;ci++) FILTER::bq[ci] = new BIQUAD;
}

void FILTER::Deallocate(void)
{
u32 ci;

for(ci = 0;ci < FILTER::num_of_sections;ci++) delete bq[ci];

delete bq;
}
//-----------------------------
FILTER::~FILTER()
{
FILTER::Deallocate();
}
//=====================================================================
//Filter.h
class FILTER
{
FILTER_TYPE filter_type;
FILTER_FUNCTION filter_function;

u32 order;          // order
u32 num_of_sections; // number of biquad sections in filter
f64 fs;            // sample rate
f64 fc;            // cutoff

BIQUAD **bq; // array of pointers

    void Deallocate(void);
    void Allocate(void);

public:
    FILTER();
    ~FILTER();
    void DesignFilter(FILTER_TYPE filter_type,FILTER_FUNCTION filter_function, f64 fs, f64 fc, u32 order);    
    };

Sunlight7 19. Nov 2006 01:34

Re: C++ nach Delphi
 
Hallo,

da Du noch n Neuling bist, ganz nett erklärt:
Editiere bitten den Beitrag und füge die C-Codetags hinzu, damit man das besser lesen kann :wink:


Alle Zeitangaben in WEZ +1. Es ist jetzt 19:47 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz