From 396670ea591fabfd1ba9ea46e8e2c4cd33a96a14 Mon Sep 17 00:00:00 2001 From: "voigt.m" Date: Sun, 5 Aug 2012 17:54:45 +0200 Subject: [PATCH] player infrastructure --- sona/Makefile.am | 2 ++ sona/main.c | 3 +++ sona/sona-player-impl.c | 6 ++++++ sona/sona-player.gob | 47 +++++++++++++++++++++++++++++++++-------------- 4 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 sona/sona-player-impl.c rewrite sona/sona-player.gob (78%) diff --git a/sona/Makefile.am b/sona/Makefile.am index d8f1e2d..1cb7eba 100644 --- a/sona/Makefile.am +++ b/sona/Makefile.am @@ -29,6 +29,8 @@ sona_SOURCES = \ sona-player.gob.stamp \ sona-player.c \ sona-player.h \ + sona-player-private.h \ + sona-player-impl.c \ main.c BUILT_SOURCES = \ diff --git a/sona/main.c b/sona/main.c index ae84663..d085e73 100644 --- a/sona/main.c +++ b/sona/main.c @@ -1,5 +1,6 @@ #include #include "sona-sequence.h" +#include "sona-player.h" int main () { @@ -12,5 +13,7 @@ int main () sona_sequence_set_step (seq, 1, step); sona_sequence_set_step (seq, 2, step); g_debug ("%d", sona_sequence_get_n_steps (seq)); + SonaPlayer *player = sona_player_new (120); + sona_player_play_sequence (player, seq, FALSE); return 0; } diff --git a/sona/sona-player-impl.c b/sona/sona-player-impl.c new file mode 100644 index 0000000..8444df2 --- /dev/null +++ b/sona/sona-player-impl.c @@ -0,0 +1,6 @@ +#include "sona-player-private.h" + +void sona_player_on_play_sequence (SonaPlayer *self, SonaSequence *seq, gboolean loop) +{ + g_message ("play"); +} diff --git a/sona/sona-player.gob b/sona/sona-player.gob dissimilarity index 78% index 2c5e755..38b9bc7 100644 --- a/sona/sona-player.gob +++ b/sona/sona-player.gob @@ -1,14 +1,33 @@ -class Sona:Player from G:Object { - - private guint bpm = 120; - property UINT bpm - set { self->_priv->bpm = g_value_get_int (VAL); } - get { g_value_set_int (VAL, self->_priv->bpm); }; - - public SonaPlayer * - new (void) { - SonaPlayer *self = GET_NEW; - return self; - } - -} \ No newline at end of file +%headertop{ +#include "sona-sequence.h" +%} + +%privateheader{ +void sona_player_on_play_sequence (SonaPlayer *self, SonaSequence *seq, gboolean loop); +%} + +class Sona:Player from G:Object { + + private guint bpm; + property UINT bpm + (default_value = 120, + export) + set { self->_priv->bpm = g_value_get_uint (VAL); } + get { g_value_set_uint (VAL, self->_priv->bpm); }; + + public + Sona:Player * + new (guint bpm) { + SonaPlayer *me = GET_NEW; + sona_player_set_bpm (me, bpm); + return me; + } + + public + void + play_sequence (self, Sona:Sequence *seq (check null type), gboolean loop) + { + sona_player_on_play_sequence (self, seq, loop); + } + +} \ No newline at end of file -- 2.11.4.GIT