From patchwork Fri Jun 12 12:33:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?B?Wm9sdMOhbiBLxZF2w6Fnw7M=?= X-Patchwork-Id: 483542 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 18BFF1401DA for ; Fri, 12 Jun 2015 22:37:15 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=jsNQ+QL1; dkim-atps=neutral Received: from localhost ([::1]:51065 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3OCv-000501-94 for incoming@patchwork.ozlabs.org; Fri, 12 Jun 2015 08:37:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3O94-0007Ef-Hb for qemu-devel@nongnu.org; Fri, 12 Jun 2015 08:33:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z3O93-0004EE-Db for qemu-devel@nongnu.org; Fri, 12 Jun 2015 08:33:14 -0400 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:36795) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3O93-0004Ds-4N for qemu-devel@nongnu.org; Fri, 12 Jun 2015 08:33:13 -0400 Received: by wigg3 with SMTP id g3so16018099wig.1 for ; Fri, 12 Jun 2015 05:33:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=olCS69xiXOUcmi4cP63fGje+xRvOHXssIPb//ZUTa7U=; b=jsNQ+QL1cAsXeTCN4Q18iWdYX7DybAuoHepBCIBvF14U0nqDJL6GHgz6tL1zzR4ayb dHldQKRYzB2i9Fvmj0TwxTmCXLay4fexiPLF7hcrv8IU/74ZjavbAEdXzSdyS9xgP1KT 81b6lUuwz4f0uIbogwkCAaKffrhZPM4l38XkeiYTnGUHnZ34ybHZNU9yVmAt8nLDaPKS 3u5e9Dipo8D0W1znjO3DCGUih2c+S9WiTqv27mpqp1t79dzP+D3/PfjE8GFFTioYEBSB viGm+9fTptJ2cms38LgPofRFeXjlRexRH7BqiMfOzWhWcVuxBalZMmVIUp/LW5deJcle 0GdQ== X-Received: by 10.180.98.103 with SMTP id eh7mr6473182wib.75.1434112392529; Fri, 12 Jun 2015 05:33:12 -0700 (PDT) Received: from nullptr.home.dirty-ice.org (94-21-76-230.pool.digikabel.hu. [94.21.76.230]) by mx.google.com with ESMTPSA id m2sm2569153wiy.7.2015.06.12.05.33.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jun 2015 05:33:11 -0700 (PDT) From: "=?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?=" X-Google-Original-From: =?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?= To: qemu-devel@nongnu.org Date: Fri, 12 Jun 2015 14:33:05 +0200 Message-Id: X-Mailer: git-send-email 2.4.2 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::22a Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 04/12] dsoundaudio: remove primary buffer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Enabling this option just creates a playback buffer with the specified settings, and then ignores it. It's probably some outdated hack to set audio formats on windows. (The first created stream dictates all other streams settings, at least on some Windows versions). Setting DAC_FIXED_SETTINGS should have the same effect as setting (the now removed) primary buffer. Signed-off-by: Kővágó, Zoltán --- audio/dsoundaudio.c | 104 ---------------------------------------------------- 1 file changed, 104 deletions(-) diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index 28b98bf..e9472c1 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -42,17 +42,14 @@ /* #define DEBUG_DSOUND */ typedef struct { - int set_primary; int bufsize_in; int bufsize_out; - struct audsettings settings; int latency_millis; } DSoundConf; typedef struct { LPDIRECTSOUND dsound; LPDIRECTSOUNDCAPTURE dsound_capture; - LPDIRECTSOUNDBUFFER dsound_primary_buffer; struct audsettings settings; DSoundConf conf; } dsound; @@ -387,27 +384,10 @@ static void dsound_clear_sample (HWVoiceOut *hw, LPDIRECTSOUNDBUFFER dsb, dsound_unlock_out (dsb, p1, p2, blen1, blen2); } -static void dsound_close (dsound *s) -{ - HRESULT hr; - - if (s->dsound_primary_buffer) { - hr = IDirectSoundBuffer_Release (s->dsound_primary_buffer); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not release primary buffer\n"); - } - s->dsound_primary_buffer = NULL; - } -} - static int dsound_open (dsound *s) { - int err; HRESULT hr; - WAVEFORMATEX wfx; - DSBUFFERDESC dsbd; HWND hwnd; - DSoundConf *conf = &s->conf; hwnd = GetForegroundWindow (); hr = IDirectSound_SetCooperativeLevel ( @@ -422,63 +402,7 @@ static int dsound_open (dsound *s) return -1; } - if (!conf->set_primary) { - return 0; - } - - err = waveformat_from_audio_settings (&wfx, &conf->settings); - if (err) { - return -1; - } - - memset (&dsbd, 0, sizeof (dsbd)); - dsbd.dwSize = sizeof (dsbd); - dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER; - dsbd.dwBufferBytes = 0; - dsbd.lpwfxFormat = NULL; - - hr = IDirectSound_CreateSoundBuffer ( - s->dsound, - &dsbd, - &s->dsound_primary_buffer, - NULL - ); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not create primary playback buffer\n"); - return -1; - } - - hr = IDirectSoundBuffer_SetFormat (s->dsound_primary_buffer, &wfx); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not set primary playback buffer format\n"); - } - - hr = IDirectSoundBuffer_GetFormat ( - s->dsound_primary_buffer, - &wfx, - sizeof (wfx), - NULL - ); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not get primary playback buffer format\n"); - goto fail0; - } - -#ifdef DEBUG_DSOUND - dolog ("Primary\n"); - print_wave_format (&wfx); -#endif - - err = waveformat_to_audio_settings (&wfx, &s->settings); - if (err) { - goto fail0; - } - return 0; - - fail0: - dsound_close (s); - return -1; } static int dsound_ctl_out (HWVoiceOut *hw, int cmd, ...) @@ -823,12 +747,8 @@ static int dsound_run_in (HWVoiceIn *hw) } static DSoundConf glob_conf = { - .set_primary = 0, .bufsize_in = 16384, .bufsize_out = 16384, - .settings.freq = 44100, - .settings.nchannels = 2, - .settings.fmt = AUD_FMT_S16, .latency_millis = 10 }; @@ -935,36 +855,12 @@ static void *dsound_audio_init (void) static struct audio_option dsound_options[] = { { - .name = "SET_PRIMARY", - .tag = AUD_OPT_BOOL, - .valp = &glob_conf.set_primary, - .descr = "Set the parameters of primary buffer" - }, - { .name = "LATENCY_MILLIS", .tag = AUD_OPT_INT, .valp = &glob_conf.latency_millis, .descr = "(undocumented)" }, { - .name = "PRIMARY_FREQ", - .tag = AUD_OPT_INT, - .valp = &glob_conf.settings.freq, - .descr = "Primary buffer frequency" - }, - { - .name = "PRIMARY_CHANNELS", - .tag = AUD_OPT_INT, - .valp = &glob_conf.settings.nchannels, - .descr = "Primary buffer number of channels (1 - mono, 2 - stereo)" - }, - { - .name = "PRIMARY_FMT", - .tag = AUD_OPT_FMT, - .valp = &glob_conf.settings.fmt, - .descr = "Primary buffer format" - }, - { .name = "BUFSIZE_OUT", .tag = AUD_OPT_INT, .valp = &glob_conf.bufsize_out,