Add possibility for audio driver to override sample rate.

This commit is contained in:
Themaister 2011-05-23 14:04:31 +02:00
parent 6a3386ad1a
commit 8bc3d3ac5c
2 changed files with 11 additions and 1 deletions

View File

@ -100,6 +100,9 @@ static void* audio_ext_init(const char *device, unsigned rate, unsigned latency)
goto error;
}
if (ext->driver->sample_rate)
g_settings.audio.out_rate = ext->driver->sample_rate(ext->handle);
return ext;
error:

View File

@ -38,7 +38,7 @@ extern "C" {
#define SSNES_ERROR 0
#endif
#define SSNES_AUDIO_API_VERSION 1
#define SSNES_AUDIO_API_VERSION 2
typedef struct ssnes_audio_driver_info
{
@ -103,6 +103,13 @@ typedef struct ssnes_audio_driver
// [-1.0, 1.0].
int (*use_float)(void *data);
// The driver might be forced to use a certain output frequency
// (i.e. Jack), and thus to avoid double resampling, the driver
// can request SSNES to resample to a different sample rate.
// This function can be set to NULL if the driver does not
// desire to override the sample rate.
unsigned (*sample_rate)(void *data);
// Human readable identification string for the driver.
const char *ident;