[beast: 7/29] BSE: use Bse::MusicalTuning::* instead of Bse::MUSICAL_TUNING_*



commit f3c4803c5d59994655b8edb47ce26ded9303da05
Author: Tim Janik <timj gnu org>
Date:   Thu Jan 28 16:28:07 2016 +0100

    BSE: use Bse::MusicalTuning::* instead of Bse::MUSICAL_TUNING_*
    
    Signed-off-by: Tim Janik <timj gnu org>

 bse/bsebiquadfilter.cc |    2 +-
 bse/bseitem.cc         |    4 ++--
 bse/bseladspamodule.cc |    4 ++--
 bse/bsemathsignal.cc   |   34 +++++++++++++++++-----------------
 bse/bsemididevice.cc   |    2 +-
 bse/bsemidifile.cc     |    2 +-
 bse/bsepart.cc         |    2 +-
 bse/bsesong.cc         |    2 +-
 bse/bsesource.cc       |    4 ++--
 bse/bsetool.cc         |   12 ++++++------
 bse/tests/misctests.cc |    8 ++++----
 11 files changed, 38 insertions(+), 38 deletions(-)
---
diff --git a/bse/bsebiquadfilter.cc b/bse/bsebiquadfilter.cc
index 58dddc3..6278ac5 100644
--- a/bse/bsebiquadfilter.cc
+++ b/bse/bsebiquadfilter.cc
@@ -123,7 +123,7 @@ bse_biquad_filter_class_init (BseBiquadFilterClass *klass)
                              PROP_NOTE,
                              sfi_pspec_note ("note", _("Note"), _("Filter cutoff frequency as note, "
                                                                    "converted to Hertz according to the 
current musical tuning"),
-                                             bse_note_from_freq (Bse::MUSICAL_TUNING_12_TET, 
BSE_KAMMER_FREQUENCY * 2),
+                                             bse_note_from_freq (Bse::MusicalTuning::OD_12_TET, 
BSE_KAMMER_FREQUENCY * 2),
                                              BSE_MIN_NOTE, BSE_MAX_NOTE,
                                              FALSE,
                                              SFI_PARAM_GUI));
diff --git a/bse/bseitem.cc b/bse/bseitem.cc
index 5b1cba9..a3b3728 100644
--- a/bse/bseitem.cc
+++ b/bse/bseitem.cc
@@ -700,7 +700,7 @@ bse_item_has_ancestor (BseItem *item,
 Bse::MusicalTuningType
 bse_item_current_musical_tuning (BseItem *self)
 {
-  assert_return (BSE_IS_ITEM (self), Bse::MUSICAL_TUNING_12_TET);
+  assert_return (BSE_IS_ITEM (self), Bse::MusicalTuning::OD_12_TET);
   /* finding the musical tuning *should* be possible by just visiting
    * an items parents. however, .bse objects are not currently (0.7.1)
    * structured that way, so we get the tuning from the first song in
@@ -714,7 +714,7 @@ bse_item_current_musical_tuning (BseItem *self)
         if (BSE_IS_SONG (slist->data))
           return BSE_SONG (slist->data)->musical_tuning;
     }
-  return Bse::MUSICAL_TUNING_12_TET;
+  return Bse::MusicalTuning::OD_12_TET;
 }
 
 static inline GType
diff --git a/bse/bseladspamodule.cc b/bse/bseladspamodule.cc
index 4b4d091..9d84933 100644
--- a/bse/bseladspamodule.cc
+++ b/bse/bseladspamodule.cc
@@ -173,8 +173,8 @@ bse_ladspa_module_class_init_from_info (BseLadspaModuleClass *ladspa_module_clas
          if (port->concert_a)
            {
              /* when defaulting to A', we probably have note-aligned port values */
-             int min_note = bse_note_from_freq_bounded (Bse::MUSICAL_TUNING_12_TET, minimum);
-             int max_note = bse_note_from_freq_bounded (Bse::MUSICAL_TUNING_12_TET, maximum);
+             int min_note = bse_note_from_freq_bounded (Bse::MusicalTuning::OD_12_TET, minimum);
+             int max_note = bse_note_from_freq_bounded (Bse::MusicalTuning::OD_12_TET, maximum);
              if (max_note - min_note > 2)
                {
                  char *ident2 = g_strconcat (port->ident, "-note", NULL);
diff --git a/bse/bsemathsignal.cc b/bse/bsemathsignal.cc
index c6fbb63..33a7ad8 100644
--- a/bse/bsemathsignal.cc
+++ b/bse/bsemathsignal.cc
@@ -593,42 +593,42 @@ bse_semitone_table_from_tuning (Bse::MusicalTuningType musical_tuning)
     {
       /* Equal Temperament: http://en.wikipedia.org/wiki/Equal_temperament */
     default:
-    case Bse::MUSICAL_TUNING_12_TET:
+    case Bse::MusicalTuning::OD_12_TET:
       return 132 + semitone_table265_equal_temperament_12_tet;
-    case Bse::MUSICAL_TUNING_7_TET:
+    case Bse::MusicalTuning::OD_7_TET:
       return 132 + semitone_table265_equal_temperament_7_tet;
-    case Bse::MUSICAL_TUNING_5_TET:
+    case Bse::MusicalTuning::OD_5_TET:
       return 132 + semitone_table265_equal_temperament_5_tet;
       /* Rational Intonation: http://en.wikipedia.org/wiki/Just_intonation */
-    case Bse::MUSICAL_TUNING_DIATONIC_SCALE:
+    case Bse::MusicalTuning::DIATONIC_SCALE:
       return 132 + semitone_table265_diatonic_scale;
-    case Bse::MUSICAL_TUNING_INDIAN_SCALE:
+    case Bse::MusicalTuning::INDIAN_SCALE:
       return 132 + semitone_table265_indian_scale;
-    case Bse::MUSICAL_TUNING_PYTHAGOREAN_TUNING:
+    case Bse::MusicalTuning::PYTHAGOREAN_TUNING:
       return 132 + semitone_table265_pythagorean_tuning;
-    case Bse::MUSICAL_TUNING_PENTATONIC_5_LIMIT:
+    case Bse::MusicalTuning::PENTATONIC_5_LIMIT:
       return 132 + semitone_table265_pentatonic_5_limit;
-    case Bse::MUSICAL_TUNING_PENTATONIC_BLUES:
+    case Bse::MusicalTuning::PENTATONIC_BLUES:
       return 132 + semitone_table265_pentatonic_blues;
-    case Bse::MUSICAL_TUNING_PENTATONIC_GOGO:
+    case Bse::MusicalTuning::PENTATONIC_GOGO:
       return 132 + semitone_table265_pentatonic_gogo;
       /* Meantone Temperament: http://en.wikipedia.org/wiki/Meantone_temperament */
-    case Bse::MUSICAL_TUNING_QUARTER_COMMA_MEANTONE:
+    case Bse::MusicalTuning::QUARTER_COMMA_MEANTONE:
       return 132 + semitone_table265_quarter_comma_meantone;
-    case Bse::MUSICAL_TUNING_SILBERMANN_SORGE:
+    case Bse::MusicalTuning::SILBERMANN_SORGE:
       return 132 + semitone_table265_silbermann_sorge_temperament;
       /* Well Temperament: http://en.wikipedia.org/wiki/Well_temperament */
-    case Bse::MUSICAL_TUNING_WERCKMEISTER_3:
+    case Bse::MusicalTuning::WERCKMEISTER_3:
       return 132 + semitone_table265_werckmeister3_temperament;
-    case Bse::MUSICAL_TUNING_WERCKMEISTER_4:
+    case Bse::MusicalTuning::WERCKMEISTER_4:
       return 132 + semitone_table265_werckmeister4_temperament;
-    case Bse::MUSICAL_TUNING_WERCKMEISTER_5:
+    case Bse::MusicalTuning::WERCKMEISTER_5:
       return 132 + semitone_table265_werckmeister5_temperament;
-    case Bse::MUSICAL_TUNING_WERCKMEISTER_6:
+    case Bse::MusicalTuning::WERCKMEISTER_6:
       return 132 + semitone_table265_werckmeister6_temperament;
-    case Bse::MUSICAL_TUNING_KIRNBERGER_3:
+    case Bse::MusicalTuning::KIRNBERGER_3:
       return 132 + semitone_table265_kirnberger_temperament;
-    case Bse::MUSICAL_TUNING_YOUNG:
+    case Bse::MusicalTuning::YOUNG:
       return 132 + semitone_table265_young_temperament;
     }
 }
diff --git a/bse/bsemididevice.cc b/bse/bsemididevice.cc
index fcf3c9b..9efd1f9 100644
--- a/bse/bsemididevice.cc
+++ b/bse/bsemididevice.cc
@@ -14,7 +14,7 @@ static void *parent_class = NULL;
 static void
 bse_midi_device_init (BseMidiDevice *self)
 {
-  self->midi_decoder = bse_midi_decoder_new (TRUE, FALSE, Bse::MUSICAL_TUNING_12_TET);
+  self->midi_decoder = bse_midi_decoder_new (TRUE, FALSE, Bse::MusicalTuning::OD_12_TET);
   self->handle = NULL;
 }
 
diff --git a/bse/bsemidifile.cc b/bse/bsemidifile.cc
index 2edf984..94bfe28 100644
--- a/bse/bsemidifile.cc
+++ b/bse/bsemidifile.cc
@@ -167,7 +167,7 @@ bse_midi_file_load (const char   *file_name,
     }
 
   smf = (BseMidiFile*) g_malloc0 (sizeof (BseMidiFile) + header.n_tracks * sizeof (smf->tracks[0]));
-  smf->musical_tuning = Bse::MUSICAL_TUNING_12_TET;
+  smf->musical_tuning = Bse::MusicalTuning::OD_12_TET;
 #if 0
   smf->tpqn = header.division;
   smf->tpqn_rate = 1;
diff --git a/bse/bsepart.cc b/bse/bsepart.cc
index 427f316..9189806 100644
--- a/bse/bsepart.cc
+++ b/bse/bsepart.cc
@@ -127,7 +127,7 @@ bse_part_class_init (BsePartClass *klass)
 static void
 bse_part_init (BsePart *self)
 {
-  self->semitone_table = bse_semitone_table_from_tuning (Bse::MUSICAL_TUNING_12_TET);
+  self->semitone_table = bse_semitone_table_from_tuning (Bse::MusicalTuning::OD_12_TET);
   self->n_ids = 0;
   self->ids = NULL;
   self->last_id = 0;
diff --git a/bse/bsesong.cc b/bse/bsesong.cc
index f2ce9cc..a625d2d 100644
--- a/bse/bsesong.cc
+++ b/bse/bsesong.cc
@@ -556,7 +556,7 @@ bse_song_init (BseSong *self)
   BSE_OBJECT_UNSET_FLAGS (self, BSE_SNET_FLAG_USER_SYNTH);
   BSE_OBJECT_SET_FLAGS (self, BSE_SUPER_FLAG_NEEDS_CONTEXT);
 
-  self->musical_tuning = Bse::MUSICAL_TUNING_12_TET;
+  self->musical_tuning = Bse::MusicalTuning::OD_12_TET;
 
   self->tpqn = timing.tpqn;
   self->numerator = timing.numerator;
diff --git a/bse/bsesource.cc b/bse/bsesource.cc
index 15d4d65..c775d2e 100644
--- a/bse/bsesource.cc
+++ b/bse/bsesource.cc
@@ -1912,8 +1912,8 @@ bse_source_class_base_init (BseSourceClass *klass)
 Bse::MusicalTuningType
 bse_source_prepared_musical_tuning (BseSource *source)
 {
-  assert_return (BSE_IS_SOURCE (source), Bse::MUSICAL_TUNING_12_TET);
-  assert_return (BSE_SOURCE_PREPARED (source), Bse::MUSICAL_TUNING_12_TET);
+  assert_return (BSE_IS_SOURCE (source), Bse::MusicalTuning::OD_12_TET);
+  assert_return (BSE_SOURCE_PREPARED (source), Bse::MusicalTuning::OD_12_TET);
   return bse_item_current_musical_tuning (BSE_ITEM (source)); // FIXME: cache this, once we have 
source->SynthesisContext
 }
 
diff --git a/bse/bsetool.cc b/bse/bsetool.cc
index ab5fa93..00a513b 100644
--- a/bse/bsetool.cc
+++ b/bse/bsetool.cc
@@ -187,8 +187,8 @@ dump_info (const ArgParser &ap)
     char *string = bse_note_to_string (note);
     printout ("%s =%-4d \tfactor=%" FLF "f [%-5s] (freq=%" FLF "f)\n",
               note_name, note,
-              bse_transpose_factor (Bse::MUSICAL_TUNING_12_TET, note - BSE_KAMMER_NOTE),
-              string, bse_note_to_freq (Bse::MUSICAL_TUNING_12_TET, note));
+              bse_transpose_factor (Bse::MusicalTuning::OD_12_TET, note - BSE_KAMMER_NOTE),
+              string, bse_note_to_freq (Bse::MusicalTuning::OD_12_TET, note));
     g_free (string);
   };
   auto print_fine_tune = [] (const char *tune_name, int tune) {
@@ -220,13 +220,13 @@ dump_info (const ArgParser &ap)
     for (j = BSE_MIN_NOTE; j <= BSE_MAX_NOTE; j += 3)
       for (k = BSE_MIN_FINE_TUNE / 2; k <= BSE_MAX_FINE_TUNE / 2; k += 10)
        {
-         double f, freq = bse_note_to_tuned_freq (Bse::MUSICAL_TUNING_12_TET, j, k);
+         double f, freq = bse_note_to_tuned_freq (Bse::MusicalTuning::OD_12_TET, j, k);
          int note, fine_tune;
          printout ("compose  : note=%4d fine_tune=%4d freq=%" FLF "f\n", j, k, freq);
          f = freq;
-         note = bse_note_from_freq (Bse::MUSICAL_TUNING_12_TET, freq);
-         fine_tune = bse_note_fine_tune_from_note_freq (Bse::MUSICAL_TUNING_12_TET, note, freq);
-         freq = bse_note_to_tuned_freq (Bse::MUSICAL_TUNING_12_TET, note, fine_tune);
+         note = bse_note_from_freq (Bse::MusicalTuning::OD_12_TET, freq);
+         fine_tune = bse_note_fine_tune_from_note_freq (Bse::MusicalTuning::OD_12_TET, note, freq);
+         freq = bse_note_to_tuned_freq (Bse::MusicalTuning::OD_12_TET, note, fine_tune);
          printout ("decompose: note=%4d fine_tune=%4d freq=%" FLF "f   (diff=%g)\n", note, fine_tune, freq, 
freq - f);
        }
   if (0)
diff --git a/bse/tests/misctests.cc b/bse/tests/misctests.cc
index fa874c0..8bb370c 100644
--- a/bse/tests/misctests.cc
+++ b/bse/tests/misctests.cc
@@ -42,7 +42,7 @@ static void
 check_equal_tempered_tuning (void)
 {
   TSTART ("Equal Temperament");
-  const double *table = bse_semitone_table_from_tuning (Bse::MUSICAL_TUNING_12_TET); /* returns [-132..+132] 
*/
+  const double *table = bse_semitone_table_from_tuning (Bse::MusicalTuning::OD_12_TET); /* returns 
[-132..+132] */
   const double epsilon = 1e-11;
   for (int i = -132; i <= +132; i++)
     {
@@ -92,7 +92,7 @@ check_freq_vs_notes (Bse::MusicalTuningType musical_tuning)
             printout ("decompose: note=%4d fine_tune=%4d freq=%" FLF "f   (diff=%" FLF "f)\n", note, 
fine_tune, freq, freq - f);
           if (ABS (k) < 11)
             TASSERT (note == j);
-          if (musical_tuning == Bse::MUSICAL_TUNING_12_TET)
+          if (musical_tuning == Bse::MusicalTuning::OD_12_TET)
             TCMP (fabs (freq_error), <, 0.00000000001);   /* equal temperament is fairly accurate */
           else
             TCMP (freq_ratio, <, 1.00057778950655485930); /* detuning should be smaller than a cent */
@@ -133,13 +133,13 @@ main (gint   argc,
   check_cent_tune();
   check_cent_tune_fast();
   check_equal_tempered_tuning();
-  Bse::MusicalTuningType last_tuning = Bse::MUSICAL_TUNING_YOUNG;
+  Bse::MusicalTuningType last_tuning = Bse::MusicalTuning::YOUNG;
   /* check last tuning value by asserting defaulting behavior of succeding values */
   TCMP (bse_semitone_table_from_tuning (Bse::MusicalTuningType (last_tuning + 1)),
         ==,
         bse_semitone_table_from_tuning (Bse::MusicalTuningType (0)));
   /* check monotonic musical tuning systems */
-  for (int j = Bse::MUSICAL_TUNING_12_TET; j <= last_tuning; j++)
+  for (int j = Bse::MusicalTuning::OD_12_TET; j <= last_tuning; j++)
     {
       Bse::MusicalTuningType musical_tuning = Bse::MusicalTuningType (j);
       check_tuning_monotony (musical_tuning);


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