[beast: 50/73] BSE: SF2: move mutex to C++ soundfont repo c++ impl class



commit d2af94a422cb78b09cfb249b52f6d8f50e58bf17
Author: Stefan Westerfeld <stefan space twc de>
Date:   Mon Dec 5 16:47:57 2016 +0100

    BSE: SF2: move mutex to C++ soundfont repo c++ impl class
    
    Signed-off-by: Stefan Westerfeld <stefan space twc de>

 bse/bsesoundfontrepo.cc |   10 ++++------
 bse/bsesoundfontrepo.hh |    2 +-
 2 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/bse/bsesoundfontrepo.cc b/bse/bsesoundfontrepo.cc
index ba7d99b..b82dd59 100644
--- a/bse/bsesoundfontrepo.cc
+++ b/bse/bsesoundfontrepo.cc
@@ -70,9 +70,7 @@ BSE_BUILTIN_TYPE (BseSoundFontRepo)
 static void
 bse_sound_font_repo_finalize (GObject *object)
 {
-  BseSoundFontRepo *sfrepo = BSE_SOUND_FONT_REPO (object);
   G_OBJECT_CLASS (parent_class)->finalize (object);
-  sfrepo->fluid_synth_mutex.~Mutex();
 }
 
 static void
@@ -100,8 +98,6 @@ bse_sound_font_repo_class_init (BseSoundFontRepoClass *klass)
 static void
 bse_sound_font_repo_init (BseSoundFontRepo *sfrepo)
 {
-  new (&sfrepo->fluid_synth_mutex) Bse::Mutex();
-
   sfrepo->fluid_settings = new_fluid_settings();
   sfrepo->fluid_synth = new_fluid_synth (sfrepo->fluid_settings);
   sfrepo->fluid_events = NULL;
@@ -324,14 +320,16 @@ bse_sound_font_repo_list_all_presets (BseSoundFontRepo *sfrepo,
 fluid_synth_t *
 bse_sound_font_repo_lock_fluid_synth (BseSoundFontRepo *sfrepo)
 {
-  sfrepo->fluid_synth_mutex.lock();
+  Bse::SoundFontRepoImpl *sfrepo_impl = sfrepo->as<Bse::SoundFontRepoImpl *>();
+  sfrepo_impl->fluid_synth_mutex.lock();
   return sfrepo->fluid_synth;
 }
 
 void
 bse_sound_font_repo_unlock_fluid_synth (BseSoundFontRepo *sfrepo)
 {
-  sfrepo->fluid_synth_mutex.unlock();
+  Bse::SoundFontRepoImpl *sfrepo_impl = sfrepo->as<Bse::SoundFontRepoImpl *>();
+  sfrepo_impl->fluid_synth_mutex.unlock();
 }
 
 int
diff --git a/bse/bsesoundfontrepo.hh b/bse/bsesoundfontrepo.hh
index 58ed04b..81613a9 100644
--- a/bse/bsesoundfontrepo.hh
+++ b/bse/bsesoundfontrepo.hh
@@ -26,7 +26,6 @@ struct BseFluidEvent {
 };
 
 struct BseSoundFontRepo : BseSuper {
-  Bse::Mutex        fluid_synth_mutex;
   fluid_settings_t  *fluid_settings;
   fluid_synth_t     *fluid_synth;
   SfiRing           *fluid_events;
@@ -58,6 +57,7 @@ namespace Bse {
 
 class SoundFontRepoImpl : public SuperImpl, public virtual SoundFontRepoIface {
 public:
+  Bse::Mutex        fluid_synth_mutex;
   struct ChannelState {
     std::vector<float>  values_left;
     std::vector<float>  values_right;


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