From 26500425f6cf97ebec21b6cf0929c2e4c08f46d6 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 22 Aug 2014 16:10:34 +0200 Subject: ao_dsound: raise default buffer size to 200ms, make it configurable --- audio/out/ao_dsound.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'audio/out') diff --git a/audio/out/ao_dsound.c b/audio/out/ao_dsound.c index e313c7d440..e03db481c8 100644 --- a/audio/out/ao_dsound.c +++ b/audio/out/ao_dsound.c @@ -98,6 +98,7 @@ struct priv { int outburst; ///play in multiple of chunks of this size int cfg_device; + int cfg_buffersize; }; static float get_delay(struct ao *ao); @@ -403,11 +404,11 @@ static int init(struct ao *ao) ao->samplerate = rate; ao->format = format; ao->bps = ao->channels.num * rate * af_fmt2bps(format); - int buffersize = ao->bps * 0.100; // space for 100ms + int buffersize = ao->bps * p->cfg_buffersize / 1000; MP_VERBOSE(ao, "Samplerate:%iHz Channels:%i Format:%s\n", rate, ao->channels.num, af_fmt_to_str(format)); - MP_VERBOSE(ao, "Buffersize:%d bytes (%d msec)\n", - buffersize, buffersize / ao->bps * 1000); + MP_VERBOSE(ao, "Buffersize:%d bytes (%f msec)\n", + buffersize, buffersize * 1000.0 / ao->bps); //fill waveformatex ZeroMemory(&wformat, sizeof(WAVEFORMATEXTENSIBLE)); @@ -636,6 +637,7 @@ const struct ao_driver audio_out_dsound = { .priv_size = sizeof(struct priv), .options = (const struct m_option[]) { OPT_INT("device", cfg_device, 0), + OPT_INTRANGE("buffersize", cfg_buffersize, 0, 1, 10000, OPTDEF_INT(200)), {0} }, }; -- cgit v1.2.3