Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
bsesnet.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_SNET_H__
3 #define __BSE_SNET_H__
4 
5 #include <bse/bsesuper.hh>
6 
7 
8 
9 /* --- object type macros --- */
10 #define BSE_TYPE_SNET (BSE_TYPE_ID (BseSNet))
11 #define BSE_SNET(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BSE_TYPE_SNET, BseSNet))
12 #define BSE_SNET_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), BSE_TYPE_SNET, BseSNetClass))
13 #define BSE_IS_SNET(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_SNET))
14 #define BSE_IS_SNET_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_SNET))
15 #define BSE_SNET_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BSE_TYPE_SNET, BseSNetClass))
16 #define BSE_SNET_USER_SYNTH(src) ((BSE_OBJECT_FLAGS (src) & BSE_SNET_FLAG_USER_SYNTH) != 0)
17 
18 typedef enum /*< skip >*/
19 {
20  BSE_SNET_FLAG_USER_SYNTH = 1 << (BSE_SUPER_FLAGS_USHIFT + 0)
21 } BseSNetFlags;
22 #define BSE_SNET_FLAGS_USHIFT (BSE_SUPER_FLAGS_USHIFT + 1)
23 
24 struct BseSNetPort {
25  gchar *name;
26  guint context : 31;
27  guint input : 1;
28  BseModule *src_omodule; /* output */
29  guint src_ostream;
30  BseModule *dest_imodule; /* input */
31  guint dest_istream;
32 };
33 
34 struct BseSNet : BseSuper {
35  SfiRing *sources; /* of type BseSource* */
36  SfiRing *isources; /* internal (protected) sources */
37  GSList *iport_names;
38  GSList *oport_names;
39  GBSearchArray *port_array; /* of type BseSNetPort* */
40  GSList *tmp_context_children;
41  guint port_unregistered_id;
42 };
44 {};
45 
47  BseMidiReceiver *midi_receiver;
48  guint midi_channel;
49  guint voice_id;
50 };
51 
52 guint bse_snet_create_context (BseSNet *snet,
53  BseMidiContext mcontext,
54  BseTrans *trans);
55 guint bse_snet_context_clone_branch (BseSNet *self,
56  guint context,
57  BseSource *context_merger,
58  BseMidiContext mcontext,
59  BseTrans *trans);
60 gboolean bse_snet_context_is_branch (BseSNet *self,
61  guint context_id);
62 void bse_snet_intern_child (BseSNet *self,
63  gpointer child);
64 BseMidiContext bse_snet_get_midi_context (BseSNet *snet,
65  guint context_handle);
66 const gchar* bse_snet_iport_name_register (BseSNet *snet,
67  const gchar *tmpl_name);
68 gboolean bse_snet_iport_name_registered (BseSNet *snet,
69  const gchar *name);
70 void bse_snet_iport_name_unregister (BseSNet *snet,
71  const gchar *name);
72 const gchar* bse_snet_oport_name_register (BseSNet *snet,
73  const gchar *tmpl_name);
74 gboolean bse_snet_oport_name_registered (BseSNet *snet,
75  const gchar *name);
76 void bse_snet_oport_name_unregister (BseSNet *snet,
77  const gchar *name);
78 void bse_snet_set_iport_src (BseSNet *snet,
79  const gchar *port_name,
80  guint snet_context,
81  BseModule *omodule,
82  guint ostream,
83  BseTrans *trans);
84 void bse_snet_set_iport_dest (BseSNet *snet,
85  const gchar *port_name,
86  guint snet_context,
87  BseModule *imodule,
88  guint istream,
89  BseTrans *trans);
90 void bse_snet_set_oport_src (BseSNet *snet,
91  const gchar *port_name,
92  guint snet_context,
93  BseModule *omodule,
94  guint ostream,
95  BseTrans *trans);
96 void bse_snet_set_oport_dest (BseSNet *snet,
97  const gchar *port_name,
98  guint snet_context,
99  BseModule *imodule,
100  guint istream,
101  BseTrans *trans);
102 
103 namespace Bse {
104 
105 class SNetImpl : public SuperImpl, public virtual SNetIface {
106 protected:
107  virtual ~SNetImpl ();
108 public:
109  explicit SNetImpl (BseObject*);
110  virtual bool supports_user_synths () override;
111  virtual bool auto_activate () const override;
112  virtual void auto_activate (bool) override;
113  virtual Error can_create_source (const String &module_type) override;
114  virtual SourceIfaceP create_source (const String &module_type) override;
115  virtual Error remove_source (SourceIface &module) override;
116 };
117 
118 } // Bse
119 
120 #endif /* __BSE_SNET_H__ */
The Bse namespace contains all functions of the synthesis engine.
Definition: bstbseutils.cc:91
Definition: bsesnet.hh:105
Definition: bsesnet.hh:24
Definition: bsesnet.hh:46
Definition: bsesnet.hh:34
Definition: bsesuper.hh:23
Definition: gbsearcharray.hh:37
Definition: bsesuper.hh:29
STL class.
void bse_snet_intern_child(BseSNet *self, gpointer child)
Definition: bsesnet.cc:87
Definition: bseobject.hh:57
Definition: bsesuper.hh:40
Definition: bsesource.hh:82
Definition: sfiring.hh:21
Definition: bsesnet.hh:43