Wolfram wrote:My Problem is, I don't understand what Convs[ i ] = new CDSPBlockConvolver() means
What ist Convs[ i ] in this case?
Is it possible to translate this to PB?
Converting C++ code to PB without understating the C++ code itself, is not gonna work well.
I took a quick look at the library you posted and it doesn't seem like a easy task to convert it.
Here's some tips:
CDSPResampler.h - Line: 203
Code: Select all
Convs[ i ] = new CDSPBlockConvolver(
CDSPFIRFilterCache :: getLPFilter( 0.5, tb, ReqAtten,
ReqPhase, 2.0 ), 2, 1, PrevLatencyFrac );
"Convs" is an array of pointers.
CDSPResampler.h - Line: 462
Code: Select all
CPtrKeeper< CDSPBlockConvolver* > Convs[ ConvCountMax ]; ///< Convolvers.
This is the array implementation:
r8bbase.h - Line: 477
Code: Select all
class CPtrKeeper
{
R8BNOCTOR( CPtrKeeper );
public:
CPtrKeeper()
: Object( NULL )
{
}
/**
* Constructor assigns a pointer to object to *this keeper.
*
* @param aObject Pointer to object to keep, can be NULL.
*/
template< class T2 >
CPtrKeeper( T2 const aObject )
: Object( aObject )
{
}
~CPtrKeeper()
{
delete Object;
}
/**
* Function assigns a pointer to object to *this keeper. A previously
* keeped pointer will be reset and object deleted.
*
* @param aObject Pointer to object to keep, can be NULL.
*/
template< class T2 >
void operator = ( T2 const aObject )
{
reset();
Object = aObject;
}
/**
* @return Pointer to keeped object, NULL if no object is being kept.
*/
T operator -> () const
{
return( Object );
}
/**
* @return Pointer to keeped object, NULL if no object is being kept.
*/
operator T () const
{
return( Object );
}
/**
* Function resets the keeped pointer and deletes the keeped object.
*/
void reset()
{
T DelObj = Object;
Object = NULL;
delete DelObj;
}
/**
* @return Function returns the keeped pointer and resets it in *this
* keeper without object deletion.
*/
T unkeep()
{
T ResObject = Object;
Object = NULL;
return( ResObject );
}
private:
T Object; ///< Pointer to keeped object.
///<
};
In PureBasic:
Code: Select all
Structure CPtrKeeper Align #PB_Structure_AlignC
*Object.Integer ; Pointer to keeped object.
EndStructure
Here's a couple steps on where to start.
1. Convert "R8B_BASECLASSÂȘ if defined
2. Convert "CDSPFIRFilterCache"
3. Convert "CDSPProcessor"
4. Convert "CDSPBlockConvolver"
5. etc.........
Bottom line is, it's too much work to it manually, so you either code some sort of Automatic Converter, make a C-Style Wrapper or
simply use it in C++