file renderer: Add encoding quality API

Based on a patch by willem179@users.sf.net.

Signed-off-by: David Henningsson <diwic@ubuntu.com>
This commit is contained in:
David Henningsson 2014-11-05 13:10:51 +01:00
parent 4bbc44d22b
commit d519d93285
2 changed files with 18 additions and 0 deletions

View file

@ -67,6 +67,7 @@ FLUIDSYNTH_API void delete_fluid_audio_driver(fluid_audio_driver_t* driver);
FLUIDSYNTH_API fluid_file_renderer_t *new_fluid_file_renderer(fluid_synth_t* synth);
FLUIDSYNTH_API int fluid_file_renderer_process_block(fluid_file_renderer_t* dev);
FLUIDSYNTH_API void delete_fluid_file_renderer(fluid_file_renderer_t* dev);
FLUIDSYNTH_API int fluid_file_set_encoding_quality(fluid_file_renderer_t* dev, double q);
#ifdef __cplusplus
}

View file

@ -290,6 +290,7 @@ new_fluid_file_renderer(fluid_synth_t* synth)
/* Turn on clipping and normalization of floats (-1.0 - 1.0) */
sf_command (dev->sndfile, SFC_SET_CLIPPING, NULL, SF_TRUE);
sf_command (dev->sndfile, SFC_SET_NORM_FLOAT, NULL, SF_TRUE);
#else
dev->file = fopen(filename, "wb");
if (dev->file == NULL) {
@ -306,6 +307,22 @@ new_fluid_file_renderer(fluid_synth_t* synth)
return NULL;
}
/**
* Set vbr encoding quality (only available with libsndfile support)
* @param dev File renderer object.
* @since 1.1.7
*/
int
fluid_file_set_encoding_quality(fluid_file_renderer_t* r, double q)
{
#if LIBSNDFILE_SUPPORT
if (sf_command (r->sndfile, SFC_SET_VBR_ENCODING_QUALITY, &q, sizeof (double)) == 0)
return FLUID_OK;
else
#endif
return FLUID_FAILED;
}
/**
* Close file and destroy a file renderer object.
* @param dev File renderer object.