Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
bsenote.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __BSE_NOTE_H__
3 #define __BSE_NOTE_H__
4 
5 #include <bse/bseglobals.hh>
6 #include <bse/bseenums.hh>
7 
8 // == Sfi imports ==
9 #define BSE_MIN_NOTE SFI_MIN_NOTE
10 #define BSE_MAX_NOTE SFI_MAX_NOTE
11 #define BSE_KAMMER_NOTE SFI_KAMMER_NOTE
12 #define BSE_NOTE_VOID SFI_NOTE_VOID
13 #define BSE_NOTE_UNPARSABLE SFI_NOTE_VOID
14 #define BSE_NOTE_CLAMP SFI_NOTE_CLAMP
15 #define BSE_NOTE_IS_VALID SFI_NOTE_IS_VALID
16 #define BSE_NOTE_MAKE_VALID SFI_NOTE_MAKE_VALID
17 #define BSE_KAMMER_OCTAVE SFI_KAMMER_OCTAVE
18 #define BSE_MIN_OCTAVE SFI_MIN_OCTAVE
19 #define BSE_MAX_OCTAVE SFI_MAX_OCTAVE
20 #define bse_note_to_string sfi_note_to_string
21 #define bse_note_examine sfi_note_examine
22 
23 // == Construct Notes ==
24 #define BSE_NOTE_OCTAVE(n) SFI_NOTE_OCTAVE (n)
25 #define BSE_NOTE_SEMITONE(n) SFI_NOTE_SEMITONE (n)
26 #define BSE_NOTE_GENERIC(o,ht_i) SFI_NOTE_GENERIC (o, ht_i)
27 #define BSE_NOTE_C(o) (BSE_NOTE_GENERIC ((o), 0))
28 #define BSE_NOTE_Cis(o) (BSE_NOTE_GENERIC ((o), 1))
29 #define BSE_NOTE_Des(o) (BSE_NOTE_Cis (o))
30 #define BSE_NOTE_D(o) (BSE_NOTE_GENERIC ((o), 2))
31 #define BSE_NOTE_Dis(o) (BSE_NOTE_GENERIC ((o), 3))
32 #define BSE_NOTE_Es(o) (BSE_NOTE_Dis (o))
33 #define BSE_NOTE_E(o) (BSE_NOTE_GENERIC ((o), 4))
34 #define BSE_NOTE_F(o) (BSE_NOTE_GENERIC ((o), 5))
35 #define BSE_NOTE_Fis(o) (BSE_NOTE_GENERIC ((o), 6))
36 #define BSE_NOTE_Ges(o) (BSE_NOTE_Fis (o))
37 #define BSE_NOTE_G(o) (BSE_NOTE_GENERIC ((o), 7))
38 #define BSE_NOTE_Gis(o) (BSE_NOTE_GENERIC ((o), 8))
39 #define BSE_NOTE_As(o) (BSE_NOTE_Gis (o))
40 #define BSE_NOTE_A(o) (BSE_NOTE_GENERIC ((o), 9))
41 #define BSE_NOTE_Ais(o) (BSE_NOTE_GENERIC ((o), 10))
42 #define BSE_NOTE_Bes(o) (BSE_NOTE_Ais (o))
43 #define BSE_NOTE_B(o) (BSE_NOTE_GENERIC ((o), 11))
44 #define BSE_NOTE_SHIFT(n,ht_i) SFI_NOTE_SHIFT (n, ht_i)
45 #define BSE_NOTE_OCTAVE_UP(n) (BSE_NOTE_SHIFT ((n), +12))
46 #define BSE_NOTE_OCTAVE_DOWN(n) (BSE_NOTE_SHIFT ((n), -12))
47 
48 // Internals, use Bse::Server API instead
49 int bse_note_from_freq (Bse::MusicalTuning musical_tuning, double freq);
50 int bse_note_from_freq_bounded (Bse::MusicalTuning musical_tuning, double freq);
51 int bse_note_fine_tune_from_note_freq (Bse::MusicalTuning musical_tuning, int note, double freq);
52 double bse_note_to_freq (Bse::MusicalTuning musical_tuning, int note);
53 double bse_note_to_tuned_freq (Bse::MusicalTuning musical_tuning, int note, int fine_tune);
54 
55 Bse::NoteDescription bse_note_description (Bse::MusicalTuning musical_tuning, int note, int finetune);
56 int bse_note_from_string (const std::string &note_string);
57 
58 
59 /* --- freq array --- */
60 typedef struct BseFreqArray BseFreqArray;
61 BseFreqArray* bse_freq_array_new (guint prealloc);
62 void bse_freq_array_free (BseFreqArray *farray);
63 guint bse_freq_array_n_values (BseFreqArray *farray);
64 gdouble bse_freq_array_get (BseFreqArray *farray,
65  guint index);
66 void bse_freq_array_insert (BseFreqArray *farray,
67  guint index,
68  gdouble value);
69 void bse_freq_array_append (BseFreqArray *farray,
70  gdouble value);
71 #define bse_freq_array_prepend(a,v) bse_freq_array_insert ((a), 0, (v))
72 void bse_freq_array_set (BseFreqArray *farray,
73  guint index,
74  gdouble value);
75 /* find match_freq in inclusive_set (NULL acts as wildcard) and don't
76  * find match_freq in exclusive_set (NULL acts as empty set).
77  */
78 gboolean bse_freq_arrays_match_freq (gfloat match_freq,
79  BseFreqArray *inclusive_set,
80  BseFreqArray *exclusive_set);
81 
82 #endif /* __BSE_NOTE_H__ */
A note description provides all needed details about a specific note. ".
Definition: bseapi.idl:442
STL class.