-
hello again,
this is the header file: #ifndef GETAUDIOSAMPLES_H_INCLUDED
#define GETAUDIOSAMPLES_H_INCLUDED
#include </fluidsynth/include/fluidsynth.h>
float *buff[2];
fluid_synth_t* synth;
fluid_settings_t* settings;
fluid_player_t* player;
void setup_synth(char* midi_file, char* sfs[], int nsfs);
void fill_buffers(int n_samples);
#endif // GETAUDIOSAMPLES_H_INCLUDED and the main file is this: #include "GetAudioSamples.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
void setup_synth(char* midi_file, char* sfs[], int nsfs){
settings = new_fluid_settings();
synth = new_fluid_synth(settings);
player = new_fluid_player(synth);
assert(fluid_is_midifile(midi_file));
fluid_player_add(player, midi_file);
for (int i=0;i<nsfs;i++){
fluid_synth_sfload(synth, sfs[i], 0);
fluid_synth_program_select(synth, i, i, 0, 0);
}
}
void fill_buffers(int n_samples){
float left[n_samples], right[n_samples];
// array of buffers used to setup channel mapping
// first make sure to zero out the sample buffers everytime before calling fluid_synth_process()
memset(left, 0, sizeof(left));
memset(right, 0, sizeof(right));
// setup channel mapping for a single stereo channel to which to render all dry audio to
buff[0] = left;
buff[1] = right;
int err = fluid_synth_process(synth, n_samples, 0, NULL, 2, buff);
if(err==FLUID_FAILED){
puts("oops");
}
}
int main()
{
char *sfs[1] = {"C:/Users/amran/Music/sf/piano"};
setup_synth("C:/Users/amran/test.mid", sfs, 1);
fill_buffers(512);
printf("%d", buff[0][0]);
return 0;
} I'm on windows and I got fluidsynth from the latest release. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 19 replies
-
Probably this issue: #874 Should be fixed in upcoming 2.2.2. Try again with this artifact: https://dev.azure.com/tommbrt/d3638885-de4a-4ce7-afe7-f237ae461c07/_apis/build/builds/5611/artifacts?artifactName=fluidsynth-mingw-x64&api-version=6.0&%24format=zip |
Beta Was this translation helpful? Give feedback.
-
You did not link against libfluidsynth. |
Beta Was this translation helpful? Give feedback.
-
You're using pure mingw32: a 32-bit compiler which creates a 32-bit object file and then you want to link against 64-bit libfluidsynth by using a 32-bit linker from 32-bit binutils package, which only supports i386 targets, see Also bad: you're mixing up libraries from at least two mingw locations: |
Beta Was this translation helpful? Give feedback.
You're using pure mingw32: a 32-bit compiler which creates a 32-bit object file and then you want to link against 64-bit libfluidsynth by using a 32-bit linker from 32-bit binutils package, which only supports i386 targets, see
mingw32/bin/ld.exe --help
. That doesn't work. Get mingw32-w64 andgcc getaudiosamples.c -Lfluidsynth-x64/lib/ -lfluidsynth -o test
will work.Also bad: you're mixing up libraries from at least two mingw locations:
c:/mingw/
andC:\Program Files (x86)\CodeBlocks\MinGW
.