From nobody Tue Feb 10 10:03:23 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1769538590; cv=none; d=zohomail.com; s=zohoarc; b=lOz/AMHa0zHc1vU10PFRhSDepXYs3xBom/mxV9hM/TtzjZOogaeLpyvKJ3Ze2rfYUZsoeoBKZ3CNNYOclvsCT0ZJ0gvbcZMgWwkee+ItuH6s3pvufEu54t2rqzLK5BXONz4h23GaA3MAoZmbgnLeV4tdKyzlxngzjZrtWNTZUXU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769538590; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cncirRWqxnV/aMGqhBJFl/3SjgKGGKTbkjCS1elG0+s=; b=ETpqkuxtFCmaL01wyn2meTTay2ZXq3Vl9UwuINnKA5atSYPg9cwEYAlrVeVna1Q4/fonNWVGPk358SXK11Xsc2GYy2faEzFu+kAHmQSKs7iOLW1uGrXV1kY+Sdow9wEC/I6Z9/WKvo3QHU0Ev3LVzAJxLNrs6a+Qr7nK3TWnUlQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769538590075773.1396063170846; Tue, 27 Jan 2026 10:29:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vknmz-00078s-Eg; Tue, 27 Jan 2026 13:27:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vknmp-0006th-CR for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:27:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vknmm-0003HO-P1 for qemu-devel@nongnu.org; Tue, 27 Jan 2026 13:27:35 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-602-KHjrDHeEOVGjdOJToXHDng-1; Tue, 27 Jan 2026 13:27:28 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8CE4E1944EBB; Tue, 27 Jan 2026 18:27:27 +0000 (UTC) Received: from localhost (unknown [10.45.242.23]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DF093195419A; Tue, 27 Jan 2026 18:27:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769538451; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cncirRWqxnV/aMGqhBJFl/3SjgKGGKTbkjCS1elG0+s=; b=ENl16soivC/O19m8Ykp+1xhLedlvOBC2R+8dAcA3GaFJf4l4tIeEXeyG/hxO+5o6rZQ4sG uXOII4V8vGFEm15tZob1R+BhhKLyxhaNPnrGriW/fz/1xtpsUk3VkULaJSozWneea8JJ6h 3YTrmdQXbpDcZQPx+7ZjCdfJjSjY9qo= X-MC-Unique: KHjrDHeEOVGjdOJToXHDng-1 X-Mimecast-MFC-AGG-ID: KHjrDHeEOVGjdOJToXHDng_1769538447 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 21/43] audio/dsound: replace custom logging with error_report & trace Date: Tue, 27 Jan 2026 22:24:48 +0400 Message-ID: <20260127182516.289834-22-marcandre.lureau@redhat.com> In-Reply-To: <20260127182516.289834-1-marcandre.lureau@redhat.com> References: <20260127182516.289834-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1769538592522154100 From: Marc-Andr=C3=A9 Lureau The DirectSound audio backend uses its own logging infrastructure (AUD_log, AUD_vlog, dolog) and the AUDIO_CAP macro. This approach is inconsistent with the rest of QEMU and makes the output harder to filter and configure. Replace the custom logging with standard QEMU error reporting. Signed-off-by: Marc-Andr=C3=A9 Lureau --- audio/dsound_template.h | 72 ++++++++++----------- audio/audio_win_int.c | 31 +++++----- audio/dsoundaudio.c | 134 ++++++++++++++++------------------------ audio/trace-events | 5 ++ 4 files changed, 108 insertions(+), 134 deletions(-) diff --git a/audio/dsound_template.h b/audio/dsound_template.h index 022a7307c99..af4019bcb34 100644 --- a/audio/dsound_template.h +++ b/audio/dsound_template.h @@ -53,9 +53,9 @@ static int glue (dsound_unlock_, TYPE) ( { HRESULT hr; =20 - hr =3D glue (IFACE, _Unlock) (buf, p1, blen1, p2, blen2); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not unlock " NAME "\n"); + hr =3D glue(IFACE, _Unlock)(buf, p1, blen1, p2, blen2); + if (FAILED(hr)) { + dsound_logerr(hr, "Could not unlock " NAME); return -1; } =20 @@ -85,35 +85,35 @@ static int glue (dsound_lock_, TYPE) ( #endif hr =3D glue(IFACE, _Lock)(buf, pos, len, p1p, blen1p, p2p, blen2p, fla= g); =20 - if (FAILED (hr)) { + if (FAILED(hr)) { #ifndef DSBTYPE_IN if (hr =3D=3D DSERR_BUFFERLOST) { - if (glue (dsound_restore_, TYPE) (buf, s)) { - dsound_logerr (hr, "Could not lock " NAME "\n"); + if (glue(dsound_restore_, TYPE)(buf, s)) { + dsound_logerr(hr, "Could not lock " NAME); } goto fail; } #endif - dsound_logerr (hr, "Could not lock " NAME "\n"); + dsound_logerr(hr, "Could not lock " NAME); goto fail; } =20 if ((p1p && *p1p && (*blen1p % info->bytes_per_frame)) || (p2p && *p2p && (*blen2p % info->bytes_per_frame))) { - dolog("DirectSound returned misaligned buffer %ld %ld\n", - *blen1p, *blen2p); + error_report("dsound: returned misaligned buffer %ld %ld", + *blen1p, *blen2p); glue(dsound_unlock_, TYPE)(buf, *p1p, p2p ? *p2p : NULL, *blen1p, blen2p ? *blen2p : 0); goto fail; } =20 if (p1p && !*p1p && *blen1p) { - dolog("warning: !p1 && blen1=3D%ld\n", *blen1p); + warn_report("dsound: !p1 && blen1=3D%ld", *blen1p); *blen1p =3D 0; } =20 if (p2p && !*p2p && *blen2p) { - dolog("warning: !p2 && blen2=3D%ld\n", *blen2p); + warn_report("dsound: !p2 && blen2=3D%ld", *blen2p); *blen2p =3D 0; } =20 @@ -143,14 +143,14 @@ static void dsound_fini_out (HWVoiceOut *hw) #endif =20 if (ds->FIELD) { - hr =3D glue (IFACE, _Stop) (ds->FIELD); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not stop " NAME "\n"); + hr =3D glue(IFACE, _Stop)(ds->FIELD); + if (FAILED(hr)) { + dsound_logerr(hr, "Could not stop " NAME); } =20 - hr =3D glue (IFACE, _Release) (ds->FIELD); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not release " NAME "\n"); + hr =3D glue(IFACE, _Release)(ds->FIELD); + if (FAILED(hr)) { + dsound_logerr(hr, "Could not release " NAME); } ds->FIELD =3D NULL; } @@ -182,7 +182,8 @@ static int dsound_init_out(HWVoiceOut *hw, struct audse= ttings *as) #endif =20 if (!s->FIELD2) { - dolog ("Attempt to initialize voice without " NAME2 " object\n"); + error_report("dsound: Attempt to initialize voice without " + NAME2 " object"); return -1; } =20 @@ -212,28 +213,28 @@ static int dsound_init_out(HWVoiceOut *hw, struct aud= settings *as) ); #endif =20 - if (FAILED (hr)) { - dsound_logerr2 (hr, typ, "Could not create " NAME "\n"); + if (FAILED(hr)) { + dsound_logerr2(hr, typ, "Could not create " NAME); return -1; } =20 - hr =3D glue (IFACE, _GetFormat) (ds->FIELD, &wfx, sizeof (wfx), NULL); - if (FAILED (hr)) { - dsound_logerr2 (hr, typ, "Could not get " NAME " format\n"); + hr =3D glue(IFACE, _GetFormat)(ds->FIELD, &wfx, sizeof(wfx), NULL); + if (FAILED(hr)) { + dsound_logerr2(hr, typ, "Could not get " NAME " format"); goto fail0; } =20 -#ifdef DEBUG_DSOUND - dolog (NAME "\n"); - print_wave_format (&wfx); -#endif + trace_dsound_wave_format( + wfx.wFormatTag, wfx.nChannels, + wfx.nSamplesPerSec, wfx.nAvgBytesPerSec, + wfx.nBlockAlign, wfx.wBitsPerSample, wfx.cbSize); =20 memset (&bc, 0, sizeof (bc)); bc.dwSize =3D sizeof (bc); =20 - hr =3D glue (IFACE, _GetCaps) (ds->FIELD, &bc); - if (FAILED (hr)) { - dsound_logerr2 (hr, typ, "Could not get " NAME " format\n"); + hr =3D glue(IFACE, _GetCaps)(ds->FIELD, &bc); + if (FAILED(hr)) { + dsound_logerr2(hr, typ, "Could not get " NAME " caps"); goto fail0; } =20 @@ -247,18 +248,13 @@ static int dsound_init_out(HWVoiceOut *hw, struct aud= settings *as) audio_pcm_init_info (&hw->info, &obt_as); =20 if (bc.dwBufferBytes % hw->info.bytes_per_frame) { - dolog ( - "GetCaps returned misaligned buffer size %ld, alignment %d\n", - bc.dwBufferBytes, hw->info.bytes_per_frame - ); + warn_report("dsound: GetCaps returned misaligned buffer size %ld, " + "alignment %d", bc.dwBufferBytes, hw->info.bytes_per_f= rame); } hw->size_emul =3D bc.dwBufferBytes; hw->samples =3D bc.dwBufferBytes / hw->info.bytes_per_frame; =20 -#ifdef DEBUG_DSOUND - dolog ("caps %ld, desc %ld\n", - bc.dwBufferBytes, bd.dwBufferBytes); -#endif + trace_dsound_buffer_bytes(bc.dwBufferBytes, bd.dwBufferBytes); return 0; =20 fail0: diff --git a/audio/audio_win_int.c b/audio/audio_win_int.c index 44a8ff24a6f..ecd599c87de 100644 --- a/audio/audio_win_int.c +++ b/audio/audio_win_int.c @@ -2,12 +2,12 @@ =20 #include "qemu/osdep.h" =20 -#define AUDIO_CAP "win-int" #include #include #include =20 #include "qemu/audio.h" +#include "qemu/error-report.h" #include "audio_int.h" #include "audio_win_int.h" =20 @@ -53,7 +53,7 @@ int waveformat_from_audio_settings (WAVEFORMATEX *wfx, break; =20 default: - dolog("Internal logic error: Bad audio format %d\n", as->fmt); + error_report("dsound: Internal logic error: Bad audio format %d", = as->fmt); return -1; } =20 @@ -64,7 +64,7 @@ int waveformat_to_audio_settings (WAVEFORMATEX *wfx, struct audsettings *as) { if (!wfx->nSamplesPerSec) { - dolog ("Invalid wave format, frequency is zero\n"); + error_report("dsound: Invalid wave format, frequency is zero"); return -1; } as->freq =3D wfx->nSamplesPerSec; @@ -79,10 +79,9 @@ int waveformat_to_audio_settings (WAVEFORMATEX *wfx, break; =20 default: - dolog ( - "Invalid wave format, number of channels is not 1 or 2, but %d= \n", - wfx->nChannels - ); + error_report("dsound: Invalid wave format, " + "number of channels is not 1 or 2, but %d", + wfx->nChannels); return -1; } =20 @@ -101,9 +100,9 @@ int waveformat_to_audio_settings (WAVEFORMATEX *wfx, break; =20 default: - dolog("Invalid PCM wave format, bits per sample is not " - "8, 16 or 32, but %d\n", - wfx->wBitsPerSample); + error_report("dsound: Invalid PCM wave format, bits per sample= is not " + "8, 16 or 32, but %d", + wfx->wBitsPerSample); return -1; } } else if (wfx->wFormatTag =3D=3D WAVE_FORMAT_IEEE_FLOAT) { @@ -113,15 +112,15 @@ int waveformat_to_audio_settings (WAVEFORMATEX *wfx, break; =20 default: - dolog("Invalid IEEE_FLOAT wave format, bits per sample is not " - "32, but %d\n", - wfx->wBitsPerSample); + error_report("dsound: Invalid IEEE_FLOAT wave format, " + "bits per sample is not 32, but %d", + wfx->wBitsPerSample); return -1; } } else { - dolog("Invalid wave format, tag is not PCM and not IEEE_FLOAT, " - "but %d\n", - wfx->wFormatTag); + error_report("dsound: Invalid wave format, " + "tag is not PCM and not IEEE_FLOAT, but %d", + wfx->wFormatTag); return -1; } =20 diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index afd901518cc..2f17ab49730 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -28,8 +28,7 @@ =20 #include "qemu/osdep.h" #include "qemu/audio.h" - -#define AUDIO_CAP "dsound" +#include "qemu/error-report.h" #include "audio_int.h" #include "qemu/module.h" #include "qapi/error.h" @@ -40,6 +39,7 @@ #include #include =20 +#include "trace.h" #include "audio_win_int.h" =20 #define TYPE_AUDIO_DSOUND "audio-dsound" @@ -55,9 +55,6 @@ struct AudioDsound { struct audsettings settings; }; =20 - -/* #define DEBUG_DSOUND */ - typedef struct { HWVoiceOut hw; LPDIRECTSOUNDBUFFER dsound_buffer; @@ -214,56 +211,37 @@ static void dsound_log_hresult(HRESULT hr) const char *str =3D dserror(hr); =20 if (str) { - AUD_log (AUDIO_CAP, "Reason: %s\n", str); + error_printf(" Reason: %s", str); } else { - AUD_log (AUDIO_CAP, "Reason: Unknown (HRESULT: 0x%lx)\n", hr); + error_printf(" Reason: Unknown (HRESULT: 0x%lx)", hr); } } =20 -static void G_GNUC_PRINTF (2, 3) dsound_logerr ( - HRESULT hr, - const char *fmt, - ... - ) +static void G_GNUC_PRINTF(2, 3) dsound_logerr(HRESULT hr, const char *fmt,= ...) { va_list ap; =20 - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - dsound_log_hresult (hr); + error_printf("dsound: "); + va_start(ap, fmt); + error_vprintf(fmt, ap); + va_end(ap); + dsound_log_hresult(hr); + error_printf("\n"); } =20 -static void G_GNUC_PRINTF (3, 4) dsound_logerr2 ( - HRESULT hr, - const char *typ, - const char *fmt, - ... - ) +static void G_GNUC_PRINTF(3, 4) dsound_logerr2(HRESULT hr, const char *typ, + const char *fmt, ...) { va_list ap; =20 - AUD_log (AUDIO_CAP, "Could not initialize %s\n", typ); - va_start (ap, fmt); - AUD_vlog (AUDIO_CAP, fmt, ap); - va_end (ap); - - dsound_log_hresult (hr); + error_printf("dsound: Could not initialize %s: ", typ); + va_start(ap, fmt); + error_vprintf(fmt, ap); + va_end(ap); + dsound_log_hresult(hr); + error_printf("\n"); } =20 -#ifdef DEBUG_DSOUND -static void print_wave_format (WAVEFORMATEX *wfx) -{ - dolog ("tag =3D %d\n", wfx->wFormatTag); - dolog ("nChannels =3D %d\n", wfx->nChannels); - dolog ("nSamplesPerSec =3D %ld\n", wfx->nSamplesPerSec); - dolog ("nAvgBytesPerSec =3D %ld\n", wfx->nAvgBytesPerSec); - dolog ("nBlockAlign =3D %d\n", wfx->nBlockAlign); - dolog ("wBitsPerSample =3D %d\n", wfx->wBitsPerSample); - dolog ("cbSize =3D %d\n", wfx->cbSize); -} -#endif =20 static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb, AudioDsound *s) { @@ -272,7 +250,7 @@ static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb,= AudioDsound *s) hr =3D IDirectSoundBuffer_Restore (dsb); =20 if (hr !=3D DS_OK) { - dsound_logerr (hr, "Could not restore playback buffer\n"); + dsound_logerr(hr, "Could not restore playback buffer"); return -1; } return 0; @@ -290,7 +268,7 @@ static int dsound_get_status_out (LPDIRECTSOUNDBUFFER d= sb, DWORD *statusp, =20 hr =3D IDirectSoundBuffer_GetStatus (dsb, statusp); if (FAILED (hr)) { - dsound_logerr (hr, "Could not get playback buffer status\n"); + dsound_logerr(hr, "Could not get playback buffer status"); return -1; } =20 @@ -309,7 +287,7 @@ static int dsound_get_status_in (LPDIRECTSOUNDCAPTUREBU= FFER dscb, =20 hr =3D IDirectSoundCaptureBuffer_GetStatus (dscb, statusp); if (FAILED (hr)) { - dsound_logerr (hr, "Could not get capture buffer status\n"); + dsound_logerr(hr, "Could not get capture buffer status"); return -1; } =20 @@ -340,11 +318,7 @@ static void dsound_clear_sample (HWVoiceOut *hw, LPDIR= ECTSOUNDBUFFER dsb, len1 =3D blen1 / hw->info.bytes_per_frame; len2 =3D blen2 / hw->info.bytes_per_frame; =20 -#ifdef DEBUG_DSOUND - dolog ("clear %p,%ld,%ld %p,%ld,%ld\n", - p1, blen1, len1, - p2, blen2, len2); -#endif + trace_dsound_clear_sample(p1, blen1, len1, p2, blen2, len2); =20 if (p1 && len1) { audio_pcm_info_clear_buf (&hw->info, p1, len1); @@ -366,40 +340,40 @@ static void dsound_enable_out(HWVoiceOut *hw, bool en= able) LPDIRECTSOUNDBUFFER dsb =3D ds->dsound_buffer; =20 if (!dsb) { - dolog ("Attempt to control voice without a buffer\n"); + error_report("dsound: Attempt to control voice without a buffer"); return; } =20 if (enable) { - if (dsound_get_status_out (dsb, &status, s)) { + if (dsound_get_status_out(dsb, &status, s)) { return; } =20 if (status & DSBSTATUS_PLAYING) { - dolog ("warning: Voice is already playing\n"); + warn_report("dsound: Voice is already playing"); return; } =20 - dsound_clear_sample (hw, dsb, s); + dsound_clear_sample(hw, dsb, s); =20 - hr =3D IDirectSoundBuffer_Play (dsb, 0, 0, DSBPLAY_LOOPING); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not start playing buffer\n"); + hr =3D IDirectSoundBuffer_Play(dsb, 0, 0, DSBPLAY_LOOPING); + if (FAILED(hr)) { + dsound_logerr(hr, "Could not start playing buffer"); return; } } else { - if (dsound_get_status_out (dsb, &status, s)) { + if (dsound_get_status_out(dsb, &status, s)) { return; } =20 if (status & DSBSTATUS_PLAYING) { - hr =3D IDirectSoundBuffer_Stop (dsb); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not stop playing buffer\n"); + hr =3D IDirectSoundBuffer_Stop(dsb); + if (FAILED(hr)) { + dsound_logerr(hr, "Could not stop playing buffer"); return; } } else { - dolog ("warning: Voice is not playing\n"); + warn_report("dsound: Voice is not playing"); } } } @@ -414,7 +388,7 @@ static size_t dsound_buffer_get_free(HWVoiceOut *hw) hr =3D IDirectSoundBuffer_GetCurrentPosition( dsb, &ppos, ds->first_time ? &wpos : NULL); if (FAILED(hr)) { - dsound_logerr(hr, "Could not get playback buffer position\n"); + dsound_logerr(hr, "Could not get playback buffer position"); return 0; } =20 @@ -441,7 +415,7 @@ static void *dsound_get_buffer_out(HWVoiceOut *hw, size= _t *size) err =3D dsound_lock_out(dsb, &hw->info, hw->pos_emul, req_size, &ret, = NULL, &act_size, NULL, false, AUDIO_DSOUND(hw->s)); if (err) { - dolog("Failed to lock buffer\n"); + error_report("dsound: Failed to lock buffer"); *size =3D 0; return NULL; } @@ -457,7 +431,7 @@ static size_t dsound_put_buffer_out(HWVoiceOut *hw, voi= d *buf, size_t len) int err =3D dsound_unlock_out(dsb, buf, NULL, len, 0); =20 if (err) { - dolog("Failed to unlock buffer!!\n"); + error_report("dsound: Failed to unlock buffer"); return 0; } hw->pos_emul =3D (hw->pos_emul + len) % hw->size_emul; @@ -473,40 +447,40 @@ static void dsound_enable_in(HWVoiceIn *hw, bool enab= le) LPDIRECTSOUNDCAPTUREBUFFER dscb =3D ds->dsound_capture_buffer; =20 if (!dscb) { - dolog ("Attempt to control capture voice without a buffer\n"); + error_report("dsound: Attempt to control capture voice without a b= uffer"); return; } =20 if (enable) { - if (dsound_get_status_in (dscb, &status)) { + if (dsound_get_status_in(dscb, &status)) { return; } =20 if (status & DSCBSTATUS_CAPTURING) { - dolog ("warning: Voice is already capturing\n"); + warn_report("dsound: Voice is already capturing"); return; } =20 /* clear ?? */ =20 - hr =3D IDirectSoundCaptureBuffer_Start (dscb, DSCBSTART_LOOPING); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not start capturing\n"); + hr =3D IDirectSoundCaptureBuffer_Start(dscb, DSCBSTART_LOOPING); + if (FAILED(hr)) { + dsound_logerr(hr, "Could not start capturing"); return; } } else { - if (dsound_get_status_in (dscb, &status)) { + if (dsound_get_status_in(dscb, &status)) { return; } =20 if (status & DSCBSTATUS_CAPTURING) { - hr =3D IDirectSoundCaptureBuffer_Stop (dscb); - if (FAILED (hr)) { - dsound_logerr (hr, "Could not stop capturing\n"); + hr =3D IDirectSoundCaptureBuffer_Stop(dscb); + if (FAILED(hr)) { + dsound_logerr(hr, "Could not stop capturing"); return; } } else { - dolog ("warning: Voice is not capturing\n"); + warn_report("dsound: Voice is not capturing"); } } } @@ -523,7 +497,7 @@ static void *dsound_get_buffer_in(HWVoiceIn *hw, size_t= *size) =20 hr =3D IDirectSoundCaptureBuffer_GetCurrentPosition(dscb, NULL, &rpos); if (FAILED(hr)) { - dsound_logerr(hr, "Could not get capture buffer position\n"); + dsound_logerr(hr, "Could not get capture buffer position"); *size =3D 0; return NULL; } @@ -544,7 +518,7 @@ static void *dsound_get_buffer_in(HWVoiceIn *hw, size_t= *size) err =3D dsound_lock_in(dscb, &hw->info, hw->pos_emul, req_size, &ret, = NULL, &act_size, NULL, false, AUDIO_DSOUND(hw->s)); if (err) { - dolog("Failed to lock buffer\n"); + error_report("dsound: Failed to lock buffer"); *size =3D 0; return NULL; } @@ -560,7 +534,7 @@ static void dsound_put_buffer_in(HWVoiceIn *hw, void *b= uf, size_t len) int err =3D dsound_unlock_in(dscb, buf, NULL, len, 0); =20 if (err) { - dolog("Failed to unlock buffer!!\n"); + error_report("dsound: Failed to unlock buffer"); return; } hw->pos_emul =3D (hw->pos_emul + len) % hw->size_emul; @@ -577,7 +551,7 @@ static void audio_dsound_finalize(Object *obj) =20 hr =3D IDirectSound_Release (s->dsound); if (FAILED (hr)) { - dsound_logerr (hr, "Could not release DirectSound\n"); + dsound_logerr(hr, "Could not release DirectSound"); } s->dsound =3D NULL; =20 @@ -587,7 +561,7 @@ static void audio_dsound_finalize(Object *obj) =20 hr =3D IDirectSoundCapture_Release (s->dsound_capture); if (FAILED (hr)) { - dsound_logerr (hr, "Could not release DirectSoundCapture\n"); + dsound_logerr(hr, "Could not release DirectSoundCapture"); } s->dsound_capture =3D NULL; } diff --git a/audio/trace-events b/audio/trace-events index 737e3e60694..b2f29666700 100644 --- a/audio/trace-events +++ b/audio/trace-events @@ -23,6 +23,11 @@ dbus_audio_register(const char *s, const char *dir) "sen= der =3D %s, dir =3D %s" dbus_audio_put_buffer_out(size_t pos, size_t size) "buf_pos =3D %zu, buf_s= ize =3D %zu" dbus_audio_read(size_t len) "len =3D %zu" =20 +# dsoundaudio.c +dsound_clear_sample(void *p1, uint32_t blen1, uint32_t len1, void *p2, uin= t32_t blen2, uint32_t len2) "p1=3D%p, blen1=3D%u, len1=3D%u, p2=3D%p, blen2= =3D%u, len2=3D%u" +dsound_wave_format(uint16_t wFormatTag, uint16_t nChannels, uint32_t nSamp= lesPerSec, uint32_t nAvgBytesPerSec, uint16_t nBlockAlign, uint16_t wBitsPe= rSample, uint16_t cbSize) "wFormatTag=3D%u, nChannels=3D%u, nSamplesPerSec= =3D%u, nAvgBytesPerSec=3D%u, nBlockAlign=3D%u, wBitsPerSample=3D%u, cbSize= =3D%u" +dsound_buffer_bytes(uint32_t caps_bytes, uint32_t desc_bytes) "caps_bytes= =3D%u, desc_bytes=3D%u" + # pwaudio.c pw_state_changed(int nodeid, const char *s) "node id: %d stream state: %s" pw_read(int32_t avail, uint32_t index, size_t len) "avail=3D%d index=3D%u = len=3D%zu" --=20 2.52.0