qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: marcandre.lureau@redhat.com
To: qemu-devel@nongnu.org
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
	"Thomas Huth" <huth@tuxfamily.org>,
	"Akihiko Odaki" <odaki@rsg.ci.i.u-tokyo.ac.jp>,
	"Alexandre Ratchov" <alex@caoua.org>,
	dirty.ice.hu@gmail.com,
	"Christian Schoenebeck" <qemu_oss@crudebyte.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Volker Rümelin" <vr_qemu@t-online.de>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [RFC 02/24] audio: remove obsolete/obscure functions
Date: Mon,  1 Dec 2025 15:22:43 +0400	[thread overview]
Message-ID: <20251201112309.4163921-3-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20251201112309.4163921-1-marcandre.lureau@redhat.com>

From: Marc-André Lureau <marcandre.lureau@redhat.com>

AUD_init_time_stamp_{in,out} and AUD_get_elapsed_usec_{in,out} are only
used by the adlib device. The result isn't actually being used since
ADLIB_KILL_TIMERS was set some 20y ago. Let's drop this dead code now.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 audio/audio_template.h | 34 ----------------------------------
 include/qemu/audio.h   |  6 ------
 hw/audio/adlib.c       | 18 +-----------------
 3 files changed, 1 insertion(+), 57 deletions(-)

diff --git a/audio/audio_template.h b/audio/audio_template.h
index 7a8c431f2d..1ab3c47fd7 100644
--- a/audio/audio_template.h
+++ b/audio/audio_template.h
@@ -569,40 +569,6 @@ bool glue(AUD_is_active_, TYPE)(SW *sw)
     return sw ? sw->active : 0;
 }
 
-void glue (AUD_init_time_stamp_, TYPE) (SW *sw, QEMUAudioTimeStamp *ts)
-{
-    if (!sw) {
-        return;
-    }
-
-    ts->old_ts = sw->hw->ts_helper;
-}
-
-uint64_t glue (AUD_get_elapsed_usec_, TYPE) (SW *sw, QEMUAudioTimeStamp *ts)
-{
-    uint64_t delta, cur_ts, old_ts;
-
-    if (!sw) {
-        return 0;
-    }
-
-    cur_ts = sw->hw->ts_helper;
-    old_ts = ts->old_ts;
-    /* dolog ("cur %" PRId64 " old %" PRId64 "\n", cur_ts, old_ts); */
-
-    if (cur_ts >= old_ts) {
-        delta = cur_ts - old_ts;
-    } else {
-        delta = UINT64_MAX - old_ts + cur_ts;
-    }
-
-    if (!delta) {
-        return 0;
-    }
-
-    return muldiv64 (delta, sw->hw->info.freq, 1000000);
-}
-
 #undef TYPE
 #undef HW
 #undef SW
diff --git a/include/qemu/audio.h b/include/qemu/audio.h
index c56af895d6..2562710bec 100644
--- a/include/qemu/audio.h
+++ b/include/qemu/audio.h
@@ -71,9 +71,6 @@ int  AUD_get_buffer_size_out (SWVoiceOut *sw);
 void AUD_set_active_out(SWVoiceOut *sw, bool on);
 bool AUD_is_active_out(SWVoiceOut *sw);
 
-void     AUD_init_time_stamp_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts);
-uint64_t AUD_get_elapsed_usec_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts);
-
 #define AUDIO_MAX_CHANNELS 16
 typedef struct Volume {
     bool mute;
@@ -112,9 +109,6 @@ size_t AUD_read (SWVoiceIn *sw, void *pcm_buf, size_t size);
 void AUD_set_active_in(SWVoiceIn *sw, bool on);
 bool AUD_is_active_in(SWVoiceIn *sw);
 
-void     AUD_init_time_stamp_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts);
-uint64_t AUD_get_elapsed_usec_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts);
-
 void audio_cleanup(void);
 
 typedef struct st_sample st_sample;
diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c
index 19d3a5f128..2a2fe7d04f 100644
--- a/hw/audio/adlib.c
+++ b/hw/audio/adlib.c
@@ -34,8 +34,6 @@
 
 #define DEBUG 0
 
-#define ADLIB_KILL_TIMERS 1
-
 #define ADLIB_DESC "Yamaha YM3812 (OPL2)"
 
 #if DEBUG
@@ -71,7 +69,6 @@ struct AdlibState {
     uint64_t dexp[2];
     SWVoiceOut *voice;
     int left, pos, samples;
-    QEMUAudioTimeStamp ats;
     FM_OPL *opl;
     PortioList port_list;
 };
@@ -88,19 +85,7 @@ static void adlib_kill_timers (AdlibState *s)
 
     for (i = 0; i < 2; ++i) {
         if (s->ticking[i]) {
-            uint64_t delta;
-
-            delta = AUD_get_elapsed_usec_out (s->voice, &s->ats);
-            ldebug (
-                "delta = %f dexp = %f expired => %d",
-                delta / 1000000.0,
-                s->dexp[i] / 1000000.0,
-                delta >= s->dexp[i]
-                );
-            if (ADLIB_KILL_TIMERS || delta >= s->dexp[i]) {
-                adlib_stop_opl_timer (s, i);
-                AUD_init_time_stamp_out (s->voice, &s->ats);
-            }
+            adlib_stop_opl_timer(s, i);
         }
     }
 }
@@ -149,7 +134,6 @@ static void timer_handler (void *opaque, int c, double interval_Sec)
 #endif
 
     s->dexp[n] = interval_Sec * 1000000.0;
-    AUD_init_time_stamp_out (s->voice, &s->ats);
 }
 
 static int write_audio (AdlibState *s, int samples)
-- 
2.51.1



  parent reply	other threads:[~2025-12-01 11:24 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01 11:22 [RFC 00/24] audio: add GStreamer backend marcandre.lureau
2025-12-01 11:22 ` [RFC 01/24] rust: patch thiserror to work with meson marcandre.lureau
2025-12-01 11:22 ` marcandre.lureau [this message]
2025-12-10 14:02   ` [RFC 02/24] audio: remove obsolete/obscure functions Akihiko Odaki
2025-12-01 11:22 ` [RFC 03/24] audio/dbus: make "dbus" the default backend when using -display dbus marcandre.lureau
2025-12-10 14:03   ` Akihiko Odaki
2025-12-01 11:22 ` [RFC 04/24] qemu-options.hx: clarify default audio backend selection marcandre.lureau
2025-12-01 11:22 ` [RFC 05/24] audio: introduce AudioDriver marcandre.lureau
2025-12-11  5:22   ` Akihiko Odaki
2025-12-01 11:22 ` [RFC 06/24] audio: simplify audio_init() marcandre.lureau
2025-12-01 11:22 ` [RFC 07/24] audio: move object creation to audio_driver_init() marcandre.lureau
2025-12-01 11:22 ` [RFC 08/24] audio: add QOM module-objects for each backend marcandre.lureau
2025-12-01 13:20   ` BALATON Zoltan
2025-12-01 18:43     ` Marc-André Lureau
2025-12-01 11:22 ` [RFC 09/24] audio: remove set_dbus_server from audio_driver marcandre.lureau
2025-12-01 11:22 ` [RFC 10/24] audio: lookup "audio-" object types, and realize them marcandre.lureau
2025-12-01 11:22 ` [RFC 11/24] audio: switch to module-object, drop audio driver registration marcandre.lureau
2025-12-01 11:22 ` [RFC 12/24] module: remove audio module support marcandre.lureau
2025-12-01 11:22 ` [RFC 13/24] audio: keep a strong reference on the backend marcandre.lureau
2025-12-01 11:22 ` [RFC 14/24] audio: make list type declaration private marcandre.lureau
2025-12-01 11:22 ` [RFC 15/24] audio: make create_pdos() private marcandre.lureau
2025-12-01 11:22 ` [RFC 16/24] replay: remove dependency on audio/ marcandre.lureau
2025-12-01 11:22 ` [RFC 17/24] audio: make all the backend-specific APIs take the be marcandre.lureau
2025-12-01 11:22 ` [RFC 18/24] audio: make AudioBackend truely abstract marcandre.lureau
2025-12-01 11:23 ` [RFC 19/24] audio: split AudioBackend marcandre.lureau
2025-12-01 11:23 ` [RFC 20/24] audio: AUD_ -> audio_be_ marcandre.lureau
2025-12-01 11:23 ` [RFC 21/24] audio-be: add common pre-conditions marcandre.lureau
2025-12-01 11:23 ` [RFC 22/24] audio-be: add some state trace marcandre.lureau
2025-12-01 11:23 ` [RFC 23/24] audio: split AudioDriver code in audio-driver.c marcandre.lureau
2025-12-01 11:23 ` [RFC 24/24] WIP: rust/audio: add GStreamer backend marcandre.lureau
2025-12-01 13:12   ` Markus Armbruster
2025-12-01 18:26     ` Marc-André Lureau
2025-12-01 13:02 ` [RFC 00/24] audio: " BALATON Zoltan
2025-12-01 13:41   ` Christian Schoenebeck
2025-12-01 18:20   ` Marc-André Lureau
2025-12-01 19:30     ` BALATON Zoltan
2025-12-01 19:44       ` Daniel P. Berrangé
2025-12-02 12:01         ` BALATON Zoltan
2025-12-01 20:58     ` Alexandre Ratchov
2025-12-02  7:55       ` Paolo Bonzini
2025-12-02 12:03         ` BALATON Zoltan
2025-12-02 12:25           ` Geoffrey McRae
2025-12-02 12:44             ` Marc-André Lureau
2025-12-02 13:25               ` Geoffrey McRae
2025-12-02 14:14                 ` Marc-André Lureau
2025-12-02 14:33                   ` Neal Gompa
2025-12-02 14:43                   ` Geoffrey McRae
2025-12-02 14:52                   ` Markus Armbruster
2025-12-03  9:19                     ` Akihiko Odaki
2025-12-02 15:39                   ` Christian Schoenebeck
2025-12-03  8:06                   ` Alexandre Ratchov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251201112309.4163921-3-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=alex@caoua.org \
    --cc=dirty.ice.hu@gmail.com \
    --cc=huth@tuxfamily.org \
    --cc=kraxel@redhat.com \
    --cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu_oss@crudebyte.com \
    --cc=vr_qemu@t-online.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).