Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
bsewave.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_WAVE_H__
3 #define __BSE_WAVE_H__
4 
5 #include <bse/bsesource.hh>
6 
7 /* --- BSE type macros --- */
8 #define BSE_TYPE_WAVE (BSE_TYPE_ID (BseWave))
9 #define BSE_WAVE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BSE_TYPE_WAVE, BseWave))
10 #define BSE_WAVE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), BSE_TYPE_WAVE, BseWaveClass))
11 #define BSE_IS_WAVE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_WAVE))
12 #define BSE_IS_WAVE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_WAVE))
13 #define BSE_WAVE_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BSE_TYPE_WAVE, BseWaveClass))
14 
15 struct BseWaveEntry {
16  GslWaveChunk *wchunk;
17  gfloat osc_freq;
18  gfloat velocity; /* 0..1 */
19 };
20 struct BseWaveIndex {
21  guint n_entries;
22  BseWaveEntry entries[1]; /* flexible array */
23 };
24 struct BseWave : BseSource {
25  /* requested BseModule indices */
26  guint request_count;
27  GSList *index_list;
28  guint index_dirty : 1;
29  /* locator */
30  guint locator_set : 1;
31  gchar *file_name;
32  gchar *wave_name;
33  /* wave data */
34  gchar **xinfos;
35  /* wave chunks */
36  guint n_wchunks;
37  SfiRing *wave_chunks; /* data=GslWaveChunk* */
38  SfiRing *open_handles; /* data=GslDataHandle* */
39 };
41 {};
42 
43 void bse_wave_clear (BseWave *wave);
44 Bse::Error bse_wave_load_wave_file (BseWave *wave,
45  const gchar *file_name,
46  const gchar *wave_name,
47  BseFreqArray *list_array,
48  BseFreqArray *skip_array,
49  gboolean rename_wave);
50 void bse_wave_add_chunk (BseWave *wave,
51  GslWaveChunk *wchunk);
52 GslWaveChunk* bse_wave_lookup_chunk (BseWave *wave,
53  gfloat mix_freq,
54  gfloat osc_freq,
55  gfloat velocity);
56 void bse_wave_remove_chunk (BseWave *wave,
57  GslWaveChunk *wchunk);
58 void bse_wave_request_index (BseWave *wave);
59 BseWaveIndex* bse_wave_get_index_for_modules (BseWave *wave);
60 void bse_wave_drop_index (BseWave *wave);
61 
62 /* BseWaveIndex is safe to use from BseModules (self-contained constant structure) */
63 GslWaveChunk* bse_wave_index_lookup_best (BseWaveIndex *windex,
64  gfloat osc_freq,
65  gfloat velocity);
66 
67 namespace Bse {
68 
69 class WaveImpl : public SourceImpl, public virtual WaveIface {
70 protected:
71  virtual ~WaveImpl ();
72 public:
73  explicit WaveImpl (BseObject*);
74  virtual double chunk_get_mix_freq (int chunk_index) override;
75  virtual double chunk_get_osc_freq (int chunk_index) override;
76  virtual int n_wave_chunks () override;
77  virtual EditableSampleIfaceP use_editable (int chunk_index) override;
78 };
79 
80 } // Bse
81 
82 #endif /* __BSE_WAVE_H__ */
The Bse namespace contains all functions of the synthesis engine.
Definition: bstbseutils.cc:91
Definition: bsewave.hh:20
Definition: bseobject.hh:57
Definition: bsewave.hh:24
Definition: bsewave.hh:40
Definition: bsewave.hh:15
Definition: bsesource.hh:82
Definition: sfiring.hh:21
Definition: bsesource.hh:90
Definition: bsewave.hh:69
Definition: bsesource.hh:274