[retro-gtk] retro-core: Stop bufferizing samples
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] retro-core: Stop bufferizing samples
- Date: Thu, 30 Jan 2020 09:29:33 +0000 (UTC)
commit 9809681a6f0b4baecec83d51334f35d0d6554b58
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Tue Jan 21 04:39:50 2020 +0500
retro-core: Stop bufferizing samples
Now that RetroPaPlayer does this, RetroCore doesn't have to anymore.
Reverts commit a901142bea575ee3a782803015cfe97917494913
retro-gtk/retro-core-private.h | 2 --
retro-gtk/retro-core.c | 1 -
retro-gtk/retro-environment.c | 17 ++---------------
3 files changed, 2 insertions(+), 18 deletions(-)
---
diff --git a/retro-gtk/retro-core-private.h b/retro-gtk/retro-core-private.h
index 0796642..dda9124 100644
--- a/retro-gtk/retro-core-private.h
+++ b/retro-gtk/retro-core-private.h
@@ -57,8 +57,6 @@ struct _RetroCore
gssize run_remaining;
gdouble speed_rate;
glong main_loop;
- gint16 *audio_samples;
- gulong audio_samples_length;
};
void retro_core_push_cb_data (RetroCore *self);
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index 7b688ef..f3f9d69 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -191,7 +191,6 @@ retro_core_finalize (GObject *object)
g_free (self->content_directory);
g_free (self->save_directory);
g_clear_object (&self->keyboard_widget);
- g_free (self->audio_samples);
G_OBJECT_CLASS (retro_core_parent_class)->finalize (object);
}
diff --git a/retro-gtk/retro-environment.c b/retro-gtk/retro-environment.c
index c2a2351..c256e42 100644
--- a/retro-gtk/retro-environment.c
+++ b/retro-gtk/retro-environment.c
@@ -6,8 +6,6 @@
#include "retro-input-private.h"
#include "retro-pixdata-private.h"
-#define AUDIO_SAMPLES_LENGTH 512
-
#define RETRO_ENVIRONMENT_EXPERIMENTAL 0x10000
#define RETRO_ENVIRONMENT_PRIVATE 0x20000
#define RETRO_ENVIRONMENT_SET_ROTATION 1
@@ -584,6 +582,7 @@ on_audio_sample (gint16 left,
gint16 right)
{
RetroCore *self;
+ gint16 samples[] = { left, right };
self = retro_core_get_cb_data ();
@@ -596,19 +595,7 @@ on_audio_sample (gint16 left,
if (self->sample_rate <= 0.0)
return;
- if (self->audio_samples == NULL) {
- self->audio_samples = g_malloc (AUDIO_SAMPLES_LENGTH * sizeof (gint16));
- self->audio_samples_length = 0;
- }
-
- self->audio_samples[self->audio_samples_length] = left;
- self->audio_samples[self->audio_samples_length + 1] = right;
- self->audio_samples_length += 2;
-
- if (self->audio_samples_length == AUDIO_SAMPLES_LENGTH) {
- g_signal_emit_by_name (self, "audio_output", self->audio_samples, AUDIO_SAMPLES_LENGTH,
self->sample_rate);
- self->audio_samples_length = 0;
- }
+ g_signal_emit_by_name (self, "audio_output", samples, 2, self->sample_rate);
}
static gsize
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]