Adds possibility for non-syncing audio.

This commit is contained in:
Themaister 2010-08-19 15:52:43 +02:00
parent 083ccd7d3a
commit f9a177880e
2 changed files with 12 additions and 4 deletions

View File

@ -73,7 +73,7 @@ static const bool force_aspect = true;
////////////////////////
// If you change this to something other than the HQ filters, make sure that you build the filter module in config.mk.
#define VIDEO_FILTER FILTER_GRAYSCALE
#define VIDEO_FILTER FILTER_HQ2X
////////////////
@ -85,7 +85,7 @@ static const unsigned out_rate = 96000;
// Input samplerate from libSNES.
// Lower this (slightly) if you are experiencing frequent audio dropouts and vsync is enabled.
static const unsigned in_rate = 31950;
static const unsigned in_rate = 31940;
// Audio device (e.g. hw:0,0 or /dev/audio). If NULL, will use defaults.
static const char* audio_device = "hw:0";
@ -93,6 +93,9 @@ static const char* audio_device = "hw:0";
// Desired audio latency in milliseconds. Might not be honored if driver can't provide given latency.
static const int out_latency = 16;
// Will sync audio. (recommended)
static const bool audio_sync = true;
// Defines the quality (and cpu reqirements) of samplerate conversion.
#define SAMPLERATE_QUALITY SRC_LINEAR

View File

@ -88,9 +88,9 @@ void set_fast_forward_button(bool new_button_state)
{
syncing_state = !syncing_state;
if (video_active)
driver.video->set_nonblock_state(driver.video_data, syncing_state);
driver.video->set_nonblock_state(driver.video_data, (audio_sync) ? syncing_state : true);
if (audio_active)
driver.audio->set_nonblock_state(driver.audio_data, syncing_state);
driver.audio->set_nonblock_state(driver.audio_data, (audio_sync) ? syncing_state : true);
if (syncing_state)
audio_chunk_size = AUDIO_CHUNK_SIZE_NONBLOCKING;
else
@ -117,8 +117,13 @@ static void init_audio(void)
if ( driver.audio_data == NULL )
audio_active = false;
if (!audio_sync && audio_active)
driver.audio->set_nonblock_state(driver.audio_data, true);
int err;
source = src_new(SAMPLERATE_QUALITY, 2, &err);
if (!source)
audio_active = false;
}
static void uninit_audio(void)