[retro-gtk] environment: Return the played samples in on_audio_sample_batch()



commit c65b2de75b7cc54917b041a842047fcdcdb5ae5f
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon Jan 20 01:55:53 2020 +0500

    environment: Return the played samples in on_audio_sample_batch()
    
    From analyzing RetroArch, it seems this function is supposed to return
    the number of played frames, while we currently return 0 there. This
    breaks, in particular, the beetle-ngp core which enters an infinite loop
    trying to play audio.

 retro-gtk/retro-environment.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/retro-gtk/retro-environment.c b/retro-gtk/retro-environment.c
index 7a8cd23..c2a2351 100644
--- a/retro-gtk/retro-environment.c
+++ b/retro-gtk/retro-environment.c
@@ -613,7 +613,7 @@ on_audio_sample (gint16 left,
 
 static gsize
 on_audio_sample_batch (gint16 *data,
-                       int     frames)
+                       gint    frames)
 {
   RetroCore *self;
 
@@ -623,16 +623,14 @@ on_audio_sample_batch (gint16 *data,
     g_return_val_if_reached (0);
 
   if (retro_core_is_running_ahead (self))
-    // FIXME What should be returned?
-    return 0;
+    return frames;
 
   if (self->sample_rate <= 0.0)
     return 0;
 
   g_signal_emit_by_name (self, "audio_output", data, frames * 2, self->sample_rate);
 
-  // FIXME What should be returned?
-  return 0;
+  return frames;
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]