[retro-gtk/wip/aplazas/0.13: 6/33] core-view: Play sound via a PaPlayer
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk/wip/aplazas/0.13: 6/33] core-view: Play sound via a PaPlayer
- Date: Sat, 23 Sep 2017 10:41:43 +0000 (UTC)
commit b96781b973db9d4551225c54ea6ec00f819ed10e
Author: Adrien Plazas <kekun plazas laposte net>
Date: Mon Sep 4 16:00:24 2017 +0200
core-view: Play sound via a PaPlayer
This avoid the users of retro-gtk to handle sound separately and it will
allow to make PaPlayer private.
demos/retro-demo.c | 7 -------
retro-gtk/retro-core-view.vala | 11 +++++++++--
2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/demos/retro-demo.c b/demos/retro-demo.c
index 8093da8..0082157 100644
--- a/demos/retro-demo.c
+++ b/demos/retro-demo.c
@@ -16,7 +16,6 @@ struct _RetroDemoApplication
RetroInputDeviceManager *input;
RetroMainLoop *loop;
RetroCoreView *view;
- RetroPaPlayer *pa_player;
};
G_DEFINE_TYPE (RetroDemoApplication, retro_demo_application, GTK_TYPE_APPLICATION)
@@ -80,9 +79,6 @@ retro_demo_application_finalize (GObject *object)
if (self->loop != NULL)
g_object_unref (self->loop);
- if (self->pa_player != NULL)
- g_object_unref (self->pa_player);
-
G_OBJECT_CLASS (retro_demo_application_parent_class)->finalize (object);
}
@@ -106,9 +102,6 @@ retro_demo_activate (GApplication *application)
retro_input_device_manager_set_controller_device (self->input, 0, input_device);
g_object_unref (input_device);
- self->pa_player = retro_pa_player_new ();
- retro_pa_player_set_core (self->pa_player, self->core);
-
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (self->view));
diff --git a/retro-gtk/retro-core-view.vala b/retro-gtk/retro-core-view.vala
index fc663b8..8af89ca 100644
--- a/retro-gtk/retro-core-view.vala
+++ b/retro-gtk/retro-core-view.vala
@@ -20,6 +20,7 @@ public class Retro.CoreView : Gtk.EventBox {
private Core core;
internal CairoDisplay display;
+ internal PaPlayer audio_player;
internal HashTable<uint?, bool?> key_state;
internal HashTable<uint?, bool?> mouse_button_state;
@@ -43,6 +44,8 @@ public class Retro.CoreView : Gtk.EventBox {
display.can_focus = false;
add (display);
+ audio_player = new PaPlayer ();
+
key_state = new HashTable<uint?, bool?> (int_hash, int_equal);
mouse_button_state = new HashTable<uint?, bool?> (int_hash, int_equal);
@@ -55,13 +58,17 @@ public class Retro.CoreView : Gtk.EventBox {
}
public void set_core (Core? core) {
- if (this.core != null)
+ if (this.core != null) {
display.set_core (null);
+ audio_player.set_core (null);
+ }
this.core = core;
- if (core != null)
+ if (core != null) {
display.set_core (core);
+ audio_player.set_core (core);
+ }
}
public CairoDisplay get_display () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]