I recomment to copy the whole file to your PB Editor and mark it all as comment.
At first you can do the simple things:
If you find some #define stuff convert it to PB. this way:
Code: Select all
/// Enable/disable anti-alias filter in pitch transposer (0 = disable)
#define SETTING_USE_AA_FILTER 0
/// Pitch transposer anti-alias filter length (8 .. 128 taps, default = 32)
#define SETTING_AA_FILTER_LENGTH 1Code: Select all
#SETTING_USE_AA_FILTER =0
#SETTING_AA_FILTER_LENGTH =1
If you find emums, this is also very simple:
Code: Select all
; /// Supported audio file formats.
; enum FileFormat {
; FF_AUTODETECT,
; FF_WAV,
; FF_OGG,
; FF_FLAC,
; FF_MP3,
; FF_MOD,
; FF_AIFF,
; };Code: Select all
Enumeration
#AUDIERE_FF_AUTODETECT
#AUDIERE_FF_WAV
#AUDIERE_FF_OGG
#AUDIERE_FF_FLAC
#AUDIERE_FF_MP3
#AUDIERE_FF_MOD
#AUDIERE_FF_AIFF
EndEnumerationCode: Select all
typedef struct
{
char fmt[4];
int format_len;
short fixed;
short channel_number;
int sample_rate;
int byte_rate;
short byte_per_sample;
short bits_per_sample;
} WavFormat;
Code: Select all
Structure WavFormat
char.b[4]
formal_len.l
fixed.w
channel_nummer.w
sample_rate.l
byte_rate.l
byte_per_sample.w
bits_per_sample.w
EndStructure
Simple classes looks like this:
Code: Select all
class FIFOSamplePipe
{
public:
virtual short *ptrBegin() const = 0;
virtual void putSamples(const short *samples, const uint numSamples) = 0;
void moveSamples(FIFOSamplePipe &other)
virtual uint receiveSamples(short *output,const uint maxSamples) = 0;
virtual uint numSamples() const = 0;
virtual int isEmpty() const = 0;
virtual void clear() = 0
};Code: Select all
Interface FIFOSamplePipe
ptrBegin() ; word
moveSamples(FIFOSamplePipe_ptrOther) ; void
receiveSamples(output.w,maxSamples.l) ; LONG
numSamples() ; LONG
isEmpty() ; LONG
clear() ; VOID
EndInterface
back.
Note: It is NOT necessarily to convert private methods.
If you find a Class with such a head:
Code: Select all
class FIFOProcessor :public FIFOSamplePipe
{
public:
... fooo
Code: Select all
Interface FIFOProcessor Using FIFOSamplePipe Don't forget to convert also the functions of the dll (doubleclick the dll !!). The Functions will give you the Objects of your class.
It can look like this:
Code: Select all
Procedure.l AUDIERE_OpenDevice(device.l,parameter.l) ; OK
ProcedureReturn CallFunction(#audiere,"_AdrOpenDevice@8",device.l,parameter.l)
EndProcedureCode: Select all
myobj.FIFOProcessor=TheFunction(foo)I also want to tell you some tipps:
1. If a method needs to transfer a DOUBLE type write 2 LONGS and split the value with this procedures:
Code: Select all
Structure dblout
p1.l
p2.l
EndStructure
SendADouble(DoublePart1(yourValue),DoublePart2(yourValue))
; Converts float to double
Procedure DoublePart1(flt.f)
Global _input.f:_input.f=flt
Global _dblout.dblout
!FLD dword[v__input]
!FST qword[v__dblout]
ProcedureReturn _dblout\p1
EndProcedure
Procedure DoublePart2(flt.f)
Global _input.f:_input.f=flt
Global _dblout.dblout
!FLD dword[v__input]
!FST qword[v__dblout]
ProcedureReturn _dblout\p2
EndProcedure
2. If you get back a double value you can get it with this:
Code: Select all
; * Converts DOUBLE(part1,part2) To FLOAT
Procedure.f Float(p1.l,p2.l)
Global _output.f
Global _dblin.dblout
_dblin\p1=p1
_dblin\p2=p2
!FLD qword[v__dblin]
!FST dword[v__output]
ProcedureReturn _output
EndProcedure
This is all information i know to convert c/c++ includes to PB. (don't forget it to save it as .pbi file
Unfortunately there are still a few questions open, maybe some one else can help out:
1. What happends if a class contains 2 methods with the same name ?
2. What happends if a class contains also some code. E.g.:
Code: Select all
virtual uint numSamples() const
{
return output->numSamples();
}
Feel free to enhance this text and distribute it again.
Maybe it will help you to convert your stuff.
MFG
WolfgangS
PS: You can also peek in my audiere.pbi and compare it with the c++ audiere includes


