[beast: 1/3] BSE: move Song.bpm into bseapi.idl



commit 0594577ad2844b4809f39f7473b2f4a53511dcb4
Author: Tim Janik <timj gnu org>
Date:   Sun Aug 16 14:12:25 2015 +0200

    BSE: move Song.bpm into bseapi.idl

 bse/bseapi.idl |    3 +++
 bse/bsesong.cc |   31 ++++++++++++++++---------------
 bse/bsesong.hh |   24 +++++++++++++-----------
 3 files changed, 32 insertions(+), 26 deletions(-)
---
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index 55e0a32..31805a4 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -561,6 +561,9 @@ interface Song : SNet {
   // int32 loop_left     = Range ("Loop Left", "", STORAGE, -1, MAXINT31, 384, -1);
   // int32 loop_right    = Range ("Loop Right", "", STORAGE, -1, MAXINT31, 384, -1);
   // int32 tick_pointer  = Range ("Tick Pointer", "", STORAGE, -1, MAXINT31, 384, -1);
+  group _("Timing") {
+    float64 bpm           = Range  ("BPM", "Beats per minute", STANDARD  ":scale", MIN_BPM, MAX_BPM, 10, 
120);
+  };
 };
 
 /// Interface for editable PCM wave samples.
diff --git a/bse/bsesong.cc b/bse/bsesong.cc
index 540b174..f67f71c 100644
--- a/bse/bsesong.cc
+++ b/bse/bsesong.cc
@@ -24,7 +24,6 @@ enum
   PROP_TPQN,
   PROP_NUMERATOR,
   PROP_DENOMINATOR,
-  PROP_BPM,
   PROP_PNET,
   PROP_AUTO_ACTIVATE,
   PROP_LOOP_ENABLED,
@@ -161,10 +160,6 @@ bse_song_set_property (GObject      *object,
             bse_part_set_semitone_table ((BsePart*) ring->data, bse_semitone_table_from_tuning 
(self->musical_tuning));
         }
       break;
-    case PROP_BPM:
-      self->bpm = sfi_value_get_real (value);
-      bse_song_update_tpsi_SL (self);
-      break;
     case PROP_PNET:
       if (!self->postprocess || !BSE_SOURCE_PREPARED (self->postprocess))
         {
@@ -271,9 +266,6 @@ bse_song_get_property (GObject     *object,
     case PROP_MUSICAL_TUNING:
       g_value_set_enum (value, self->musical_tuning);
       break;
-    case PROP_BPM:
-      sfi_value_set_real (value, self->bpm);
-      break;
     case PROP_PNET:
       bse_value_set_object (value, self->pnet);
       break;
@@ -760,13 +752,6 @@ bse_song_class_init (BseSongClass *klass)
                              PROP_DENOMINATOR,
                              sfi_pspec_int ("denominator", _("Denominator"), _("Measure denominator, must be 
a power of 2"),
                                             timing.denominator, 1, 256, 0, SFI_PARAM_STANDARD));
-  bse_object_class_add_param (object_class, _("Timing"),
-                             PROP_BPM,
-                             sfi_pspec_real ("bpm", _("Beats per minute"), NULL,
-                                             timing.bpm,
-                                             BSE_MIN_BPM, BSE_MAX_BPM,
-                                              10,
-                                             SFI_PARAM_STANDARD ":scale"));
   bse_object_class_add_param (object_class, _("MIDI Instrument"),
                               PROP_PNET,
                               bse_param_spec_object ("pnet", _("Postprocessor"), _("Synthesis network to be 
used as postprocessor"),
@@ -958,4 +943,20 @@ SongImpl::get_timing (int tick)
   return timing;
 }
 
+double
+SongImpl::bpm () const
+{
+  BseSong *self = const_cast<SongImpl*> (this)->as<BseSong*>();
+  return self->bpm;
+}
+
+void
+SongImpl::bpm (double val)
+{
+  BseSong *self = as<BseSong*>();
+  self->bpm = val;
+  bse_song_update_tpsi_SL (self);
+  // changed ("bpm");
+}
+
 } // Bse
diff --git a/bse/bsesong.hh b/bse/bsesong.hh
index afe61ae..d0d4dba 100644
--- a/bse/bsesong.hh
+++ b/bse/bsesong.hh
@@ -26,7 +26,7 @@ struct BseSong : BseSNet {
   guint                    tpqn;               /* ticks per querter note */
   guint                    numerator;
   guint                    denominator;
-  gfloat            bpm;
+  float             bpm;
   BseMusicalTuningType musical_tuning;
   SfiRing          *parts;              /* of type BsePart* */
   SfiRing          *busses;             /* of type BseBus* */
@@ -72,17 +72,19 @@ namespace Bse {
 
 class SongImpl : public SNetImpl, public virtual SongIface {
 protected:
-  virtual    ~SongImpl                ();
+  virtual            ~SongImpl                ();
 public:
-  explicit    SongImpl                (BseObject*);
-  SongTiming  get_timing              (int tick);
-  TrackIfaceP find_any_track_for_part (PartIface &part) override;
-  BusIfaceP   create_bus              () override;
-  void        remove_bus              (BusIface &bus) override;
-  PartIfaceP  create_part             () override;
-  void        remove_part             (PartIface &part) override;
-  TrackIfaceP create_track            () override;
-  void        remove_track            (TrackIface &track) override;
+  explicit            SongImpl                (BseObject*);
+  virtual double      bpm                     () const override;
+  virtual void        bpm                     (double val) override;
+  virtual SongTiming  get_timing              (int tick);
+  virtual TrackIfaceP find_any_track_for_part (PartIface &part) override;
+  virtual BusIfaceP   create_bus              () override;
+  virtual void        remove_bus              (BusIface &bus) override;
+  virtual PartIfaceP  create_part             () override;
+  virtual void        remove_part             (PartIface &part) override;
+  virtual TrackIfaceP create_track            () override;
+  virtual void        remove_track            (TrackIface &track) override;
 };
 
 } // Bse


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