Я вызываю функцию C ++ из C #.
Это заголовок функции в C ++:
int src_simple (SRC_DATA *data, int converter_type, int channels) ;
И это эквивалентная функция C #:
[DllImport("libsamplerate-0.dll")]
public static extern int src_simple(ref SRC_DATA sd, int converter_type, int channels);
Это структура SRC_DATA в C ++, а затем в C #:
typedef struct
{ float *data_in, *data_out ;
long input_frames, output_frames ;
long input_frames_used, output_frames_gen ;
int end_of_input ;
double src_ratio ;
} SRC_DATA ;
Это определенная мной структура C #:
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct SRC_DATA
{
public IntPtr data_in, data_out;
public long input_frames, output_frames;
public long input_frames_used, output_frames_gen;
public int end_of_input;
public double src_ratio;
}
Большая проблема заключается в том, что последнийпараметр src_ratio не доставляется должным образом в функцию C ++ (он видит его как 0 или что-то недопустимое).
Верны ли мои заявления?
Спасибо