A couple of code snippets:
in nSupport.h:
inline std::string IntToStr(int intval) {
std::stringstream st;
st << intval;
return st.str();
}
/*Accounts for Delphi's 1-based index*/
inline std::string Copy(const std::string& in, int begin1b, int amount) {
in.substr(begin1b-1, amount);
}
inline bool FileExists(std::string file_name) {
std::fstream filetest(file_name.c_str(), std::ios_base::in | std::ios_base::binary);
if (filetest.is_open())
{
filetest.close();
return true;
}
return false;
}
Also, note that where you have the Copy calls, you're replacing the Length(string) for sizeof(string). That's wrong. use string.length().
in nCore.h, stdint is not present in VS 2008 and below
#if defined _MSC_VER
#if _MSC_VER > 1500
#include <stdint>
#else
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef signed long long int int64_t;
typedef unsigned long long int uint64_t;
#endif
#endif
I also needed to redefine the way you declared the FFTW interface, like this:
fftw_interface.h
typedef void * (* FUN_Plan_DFT_r2c_1d) (int, double* , double* , unsigned int );
typedef void* (* FUN_Plan_DFT_1d)(int, double* , double* , int , unsigned int );
typedef void (* FUN_Execute)(void* );
typedef void (* FUN_Destroy_Plan)(void* );
struct FFTW_Rec
{
FUN_Plan_DFT_r2c_1d Plan_DFT_r2c_1d;
FUN_Plan_DFT_1d Plan_DFT_1d;
FUN_Execute Execute;
FUN_Destroy_Plan Destroy_Plan;
void* Plans [ MAX_FFT_BIT_LENGTH + 1 ];
};
fftw_interface.cpp
FFTW.Plan_DFT_r2c_1d = (FUN_Plan_DFT_r2c_1d) GetProcAddress(FFTW_DLL_Handle, "fftw_plan_dft_r2c_1d");
FFTW.Plan_DFT_1d = (FUN_Plan_DFT_1d) GetProcAddress(FFTW_DLL_Handle, "fftw_plan_dft_1d");
FFTW.Execute = (FUN_Execute) GetProcAddress(FFTW_DLL_Handle, "fftw_execute");
FFTW.Destroy_Plan = (FUN_Destroy_Plan) GetProcAddress(FFTW_DLL_Handle, "fftw_destroy_plan");
Also, i had to add some includes here and there ( <cmath> mostly )
At last, i'm not sure if it will be of help, or it will add to confusion, but these two source files might help on the file loading
riff.cpp
riff.hpp
That's a .wav file load/save in a mixture of C and C++. (Not the best code anyway, it was scheduled for improvement, but since it works, it has been kept)