#include <stdio.h>
#include <stdlib.h>
#include <fluidsynth.h>
struct fx_data_t
{
float gain;
} fx_data_t;
int fx_function(void *data, int len,
int nfx, float **fx,
int nout, float **out)
{
struct fx_data_t *fx_data = (struct fx_data_t *) data;
int i, k;
if(fx == 0)
{
{
}
}
else
{
{
}
}
for(i = 0; i < nout; i++)
{
float *out_i = out[i];
for(k = 0; k < len; k++)
{
out_i[k] *= fx_data->gain;
}
}
for(i = 0; i < nfx; i++)
{
float *fx_i = fx[i];
for(k = 0; k < len; k++)
{
fx_i[k] *= fx_data->gain;
}
}
}
int main(int argc, char **argv)
{
int err = 0;
struct fx_data_t fx_data;
if(argc != 3)
{
fprintf(stderr, "Usage: fluidsynth_simple [soundfont] [gain]\n");
return 1;
}
if(settings == NULL)
{
fprintf(stderr, "Failed to create the settings\n");
err = 2;
goto cleanup;
}
if(synth == NULL)
{
fprintf(stderr, "Failed to create the synthesizer\n");
err = 3;
goto cleanup;
}
{
fprintf(stderr, "Failed to load the SoundFont\n");
err = 4;
goto cleanup;
}
fx_data.synth = synth;
fx_data.gain = (float)atof(argv[2]);
if(adriver == NULL)
{
fprintf(stderr, "Failed to create the audio driver\n");
err = 5;
goto cleanup;
}
printf("Press \"Enter\" to stop: ");
fgetc(stdin);
printf("done\n");
cleanup:
if(adriver)
{
}
if(synth)
{
}
if(settings)
{
}
return err;
}
struct _fluid_hashtable_t fluid_settings_t
Configuration settings instance.
Definition: types.h:38
struct _fluid_audio_driver_t fluid_audio_driver_t
Audio driver instance.
Definition: types.h:46
struct _fluid_synth_t fluid_synth_t
Synthesizer instance.
Definition: types.h:39
void delete_fluid_audio_driver(fluid_audio_driver_t *driver)
Deletes an audio driver instance.
Definition: fluid_adriver.c:443
fluid_audio_driver_t * new_fluid_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func, void *data)
Create a new audio driver.
Definition: fluid_adriver.c:407
int fluid_synth_process(fluid_synth_t *synth, int len, int nfx, float *fx[], int nout, float *out[])
Synthesize floating point audio to stereo audio channels (implements the default interface fluid_audi...
Definition: fluid_synth.c:4183
int fluid_synth_noteon(fluid_synth_t *synth, int chan, int key, int vel)
Send a note-on event to a FluidSynth object.
Definition: fluid_synth.c:1274
#define FLUID_FAILED
Value that indicates failure, used by most libfluidsynth functions.
Definition: misc.h:65
#define FLUID_OK
Value that indicates success, used by most libfluidsynth functions.
Definition: misc.h:56
fluid_settings_t * new_fluid_settings(void)
Create a new settings object.
Definition: fluid_settings.c:262
void delete_fluid_settings(fluid_settings_t *settings)
Delete the provided settings object.
Definition: fluid_settings.c:286
int fluid_synth_sfload(fluid_synth_t *synth, const char *filename, int reset_presets)
Load a SoundFont file (filename is interpreted by SoundFont loaders).
Definition: fluid_synth.c:5402
fluid_synth_t * new_fluid_synth(fluid_settings_t *settings)
Create new FluidSynth instance.
Definition: fluid_synth.c:645
void delete_fluid_synth(fluid_synth_t *synth)
Delete a FluidSynth instance.
Definition: fluid_synth.c:1044