Voxengo Premium Membership - All Voxengo Plugins For a Fixed One-Time Fee
Forums     Plugins     r8brain PRO using r8b.dll - header file


Hi,

I need to use the r8b.dll for a C++ project. does anyone has the header file?

Thanks in advance.

Martin


You can do the conversion yourself I suppose.

'PChar' is the same as 'char*'

'LongInt' is the same as 'int'

'Pointer' is the same as 'void*'

'Boolean' is the same as 'bool'

'Char' is the same as 'char'

'packed record' is the same as 'struct', but without alignment.


Thanks for the reply.

But if there is any ready written C++ DLL for use?  I am still not quite clear.

Martin


You may try this:

void r8b_execute( char* InFileName, char* OutFileName, int OutRate, int OutBitDepth, int OutQuality, int Preallocate, int* CancelFlag, TR8BCallback Callback, void* p, TR8BError* err );

void r8b_executeMem( TR8BInputFormat* InFormat, void* OutBuffer, int OutLength, int OutRate, int OutBitDepth, int OutQuality, int* CancelFlag, TR8BCallback Callback, void* p, TR8BError* err, int* ActualOut );

typedef void( *TR8BCallback )( int Position, int Max, void* p );

struct TR8BError // Should be 'packed' (align=1)

{

bool WasError;

char ErrMsg[ 128 ];

};

struct TR8BInputFormat // Should be 'packed'

{

void* Buffer;

int Rate;

int BitDepth;

int Channels;

int IEEE;

int Len;

};


Hi Martinly,

Are you still after using this in C++?

I have gotten it working for MS VC++.net if your interested.

1.  Create a new header file, I've called mine 'r8b mine.h'.  Then put all the folowing into it:

//===================================================================================

// Create a file called something like 'r8b mine.h' and put this in it...

//===================================================================================

typedef void (*TR8BCallback)(int Position, int Max, void* p);

struct TR8BError // Should be 'packed' (align=1) (Not sure about this comment...)

{

bool WasError; // Set to TRUE if an error occurs during function call.

char ErrMsg [128]; // This string will contain the error message.

};

struct TR8BInputFormat // Should be 'packed' (Not sure about this comment...)

{

void* Buffer;

int Rate;

int BitDepth;

int Channels;

int IEEE;

int Len;

};

// Function prototypes...

void r8b_execute (char* InFileName, char* OutFileName, int OutRate

, int OutBitDepth, int OutQuality, int Preallocate

, int* CancelFlag, TR8BCallback Callback, void* p, TR8BError* err);

void r8b_executeMem( TR8BInputFormat* InFormat, void* OutBuffer, int OutLength

, int OutRate, int OutBitDepth, int OutQuality, int* CancelFlag

, TR8BCallback Callback, void* p, TR8BError* err, int* ActualOut );

// This is our function that the R8B funtion

// (e.g. 'r8b_execute') will call during its execution.

void callmeback (int Position, int Max, void* p);

void callmeback (int Position, int Max, void* p)

{

int whatever = 67; // Dummy piece of code for now.  Put break point on this line to see progress!

// Watch values of (int Position, int Max, void* p).  Not sure what 'void* p' is doing...

return;

}

//===================================================================================

// This is the end of our 'r8b mine.h' file.

//===================================================================================

2.  Then add the following to your '#includes' in your dialog cpp file:

#include "r8b mine.h"

3.  Then add this to your program (e.g. to a 'OnBnClicked' handler to begin with).

//==============================================================================

// Start of WAV conversion code.

// A quick reminder of the R8B function prototype for you...

/* r8b_execute

( char* InFileName, char* OutFileName, int OutRate, int OutBitDepth

, int OutQuality, int Preallocate, int* CancelFlag, TR8BCallback Callback

, void* p, TR8BError* err );

*/

// Set up the variables needed by the R8B function.

char* outstring = "C:\\R8B Output.wav"; // Specify an output filename.

char* instring = "C:\\Your Input.wav"; // Specify an input filename.

int cancelflag; // I think you can set this inside the callback function to cancel a conversion.

void* p = NULL; // Don't know what this is for.

TR8BError err ; // This struct will hold an error report.

/*

Now then, this part gets the R8B function into your application.  Start off with the 'r8b.dll' in the root

directory of your C: drive until you're happy (the call to 'LoadLibrary' in a moment

requires you to provide a full path to the destination 'dll').

*/

typedef void (__stdcall *FNCr8b_execute)( char* InFileName, char* OutFileName, int OutRate

, int OutBitDepth, int OutQuality, int Preallocate

, int* CancelFlag, TR8BCallback Callback, void* p, TR8BError* err );

HINSTANCE hLib = LoadLibrary("c:\\r8b.dll");

if(hLib == NULL)

{

//cout << "ERROR: Unable to load library!" << endl;

//getch();

return;

}

FNCr8b_execute r8b_execute1 = (FNCr8b_execute)GetProcAddress(hLib,"r8b_execute");

// Finally, call the R8B function to convert the WAV.

r8b_execute1

( instring, outstring, 22010, 8

, 4, 0, &cancelflag, &callmeback

, p, &err );

FreeLibrary((HMODULE)hLib); // Close the handle to 'dll'

return;

// End of WAV conversion code.

//==============================================================================

Any further probs give us a shout.

Rgds.

This topic was last updated 180 days ago, and thus it was archived.  Replying is disabled for this topic.