[beast: 7/9] BSE: move several Bse.Source accessors into bseapi.idl
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 7/9] BSE: move several Bse.Source accessors into bseapi.idl
- Date: Wed, 16 Aug 2017 23:43:25 +0000 (UTC)
commit a186ca28bcf3d25562d66ef844e5daf16b2310f2
Author: Tim Janik <timj gnu org>
Date: Sat Jul 29 00:14:46 2017 +0200
BSE: move several Bse.Source accessors into bseapi.idl
Signed-off-by: Tim Janik <timj gnu org>
bse/bseapi.idl | 30 ++--
bse/bsesource.cc | 210 ++++++++++++++++++++++
bse/bsesource.hh | 29 +++-
bse/bsesource.proc | 492 ----------------------------------------------------
4 files changed, 247 insertions(+), 514 deletions(-)
---
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index 23575e4..05660f0 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -587,24 +587,24 @@ interface Source : Item {
// MidiControlType get_automation_control (String property_name); ///< Get control type from an automation
property.
bool has_output (int32 ochannel); ///< Check whether a module's output channel is connected.
bool has_outputs (); ///< Check whether a module has output channel connections.
- // String ichannel_blurb (int32 input_channel); ///< Get input channel description.
- // int32 ichannel_get_n_joints (int32 input_channel); ///< Retrieve the number of inputs connected to an
input channel.
- // int32 ichannel_get_ochannel (int32 input_channel, int32 input_joint); ///< Retrieve output channel of
the module connected to a specific joint of an input channel.
- // String ichannel_ident (int32 input_channel); ///< Get canonical input channel name.
- // String ichannel_label (int32 input_channel); ///< Get input channel name.
- // bool is_joint_ichannel (String input_channel); ///< Check if an input channel is a joint
(multi-connect) channel.
- // bool is_joint_ichannel_by_id (int32 input_channel); ///< Check if an input channel is a joint
(multi-connect) channel.
- // bool is_prepared (); ///< Check whether a source is prepared for synthesis processing.
+ String ichannel_blurb (int32 input_channel); ///< Get input channel description.
+ int32 ichannel_get_n_joints (int32 input_channel); ///< Retrieve the number of inputs connected to an
input channel.
+ int32 ichannel_get_ochannel (int32 input_channel, int32 input_joint); ///< Retrieve output channel of the
module connected to a specific joint of an input channel.
+ String ichannel_ident (int32 input_channel); ///< Get canonical input channel name.
+ String ichannel_label (int32 input_channel); ///< Get input channel name.
+ bool is_joint_ichannel (String input_channel); ///< Check if an input channel is a joint (multi-connect)
channel.
+ bool is_joint_ichannel_by_id (int32 input_channel); ///< Check if an input channel is a joint
(multi-connect) channel.
+ bool is_prepared (); ///< Check whether a source is prepared for synthesis processing.
int32 n_ichannels (); ///< Get the number of input channels of a module.
int32 n_ochannels (); ///< Get the number of output channels of a module.
- // String ochannel_blurb (int32 output_channel); ///< Get output channel description.
- // String ochannel_ident (int32 output_channel); ///< Get canonical output channel name.
- // String ochannel_label (int32 output_channel); ///< Get output channel name.
+ String ochannel_blurb (int32 output_channel); ///< Get output channel description.
+ String ochannel_ident (int32 output_channel); ///< Get canonical output channel name.
+ String ochannel_label (int32 output_channel); ///< Get output channel name.
// Error set_automation (String property_name, int32 midi_channel, MidiControlType control_type); ///<
Setup automation parameters for a property.
- // Error set_input (String input_channel, Source omodule, String output_channel); ///< Connect a module
input to another module's output.
- // Error set_input_by_id (int32 input_channel, Source omodule, int32 output_channel); ///< Connect a
module input to another module's output.
- // Error unset_input (String input_channel, Source omodule, String output_channel); ///< Disconnect a
module input.
- // Error unset_input_by_id (int32 input_channel, Source omodule, int32 output_channel); ///< Disconnect a
module input.
+ Error set_input (String input_channel, Source omodule, String output_channel); ///< Connect a module input
to another module's output.
+ Error set_input_by_id (int32 input_channel, Source omodule, int32 output_channel); ///< Connect a module
input to another module's output.
+ Error unset_input (String input_channel, Source omodule, String output_channel); ///< Disconnect a module
input.
+ Error unset_input_by_id (int32 input_channel, Source omodule, int32 output_channel); ///< Disconnect a
module input.
// signal void probes (ProbeSeq a);
// signal void io_changed ();
// float64 pos_x = Range ("Position X", "", STANDARD ":scale");
diff --git a/bse/bsesource.cc b/bse/bsesource.cc
index f1d28fa..8234ab7 100644
--- a/bse/bsesource.cc
+++ b/bse/bsesource.cc
@@ -2094,6 +2094,83 @@ SourceImpl::has_outputs ()
return self->outputs != NULL;
}
+String
+SourceImpl::ichannel_blurb (int input_channel)
+{
+ BseSource *self = as<BseSource*>();
+ assert_return (size_t (input_channel) < BSE_SOURCE_N_ICHANNELS (self), "");
+ return BSE_SOURCE_ICHANNEL_BLURB (self, input_channel);
+}
+
+int
+SourceImpl::ichannel_get_n_joints (int input_channel)
+{
+ BseSource *self = as<BseSource*>();
+ assert_return (size_t (input_channel) < BSE_SOURCE_N_ICHANNELS (self), 0);
+ BseSourceInput *input = BSE_SOURCE_INPUT (self, input_channel);
+ if (BSE_SOURCE_IS_JOINT_ICHANNEL (self, input_channel))
+ return input->jdata.n_joints;
+ else
+ return input->idata.osource ? 1 : 0;
+}
+
+
+int
+SourceImpl::ichannel_get_ochannel (int input_channel, int input_joint)
+{
+ BseSource *self = as<BseSource*>();
+ assert_return (size_t (input_channel) < BSE_SOURCE_N_ICHANNELS (self), INT_MAX);
+ assert_return (input_joint >= 0, INT_MAX);
+ BseSourceInput *input = BSE_SOURCE_INPUT (self, input_channel);
+ if (BSE_SOURCE_IS_JOINT_ICHANNEL (self, input_channel) && size_t (input_joint) < input->jdata.n_joints)
+ return input->jdata.joints[input_joint].ochannel;
+ else if (input_joint < 1)
+ return input->idata.ochannel;
+ else
+ return INT_MAX;
+}
+
+String
+SourceImpl::ichannel_ident (int input_channel)
+{
+ BseSource *self = as<BseSource*>();
+ assert_return (size_t (input_channel) < BSE_SOURCE_N_ICHANNELS (self), 0);
+ return BSE_SOURCE_ICHANNEL_IDENT (self, input_channel);
+}
+
+
+String
+SourceImpl::ichannel_label (int input_channel)
+{
+ BseSource *self = as<BseSource*>();
+ assert_return (size_t (input_channel) < BSE_SOURCE_N_ICHANNELS (self), 0);
+ return BSE_SOURCE_ICHANNEL_LABEL (self, input_channel);
+}
+
+bool
+SourceImpl::is_joint_ichannel (const String &input_channel)
+{
+ BseSource *self = as<BseSource*>();
+ assert_return (input_channel.empty() == false, false);
+ const uint id = bse_source_find_ichannel (self, input_channel.c_str());
+ return id < BSE_SOURCE_N_ICHANNELS (self) ? BSE_SOURCE_IS_JOINT_ICHANNEL (self, id) : false;
+}
+
+bool
+SourceImpl::is_joint_ichannel_by_id (int input_channel)
+{
+ BseSource *self = as<BseSource*>();
+ assert_return (size_t (input_channel) < BSE_SOURCE_N_ICHANNELS (self), false);
+ return BSE_SOURCE_IS_JOINT_ICHANNEL (self, input_channel);
+}
+
+bool
+SourceImpl::is_prepared ()
+{
+ BseSource *self = as<BseSource*>();
+ return BSE_SOURCE_PREPARED (self);
+}
+
int
SourceImpl::n_ichannels()
{
@@ -2108,6 +2185,139 @@ SourceImpl::n_ochannels()
return BSE_SOURCE_N_OCHANNELS (self);
}
+String
+SourceImpl::ochannel_blurb (int output_channel)
+{
+ BseSource *self = as<BseSource*>();
+ assert_return (size_t (output_channel) < BSE_SOURCE_N_OCHANNELS (self), "");
+ return BSE_SOURCE_OCHANNEL_BLURB (self, output_channel);
+}
+
+String
+SourceImpl::ochannel_ident (int output_channel)
+{
+ BseSource *self = as<BseSource*>();
+ assert_return (size_t (output_channel) < BSE_SOURCE_N_OCHANNELS (self), "");
+ return BSE_SOURCE_OCHANNEL_IDENT (self, output_channel);
+}
+
+String
+SourceImpl::ochannel_label (int output_channel)
+{
+ BseSource *self = as<BseSource*>();
+ assert_return (size_t (output_channel) < BSE_SOURCE_N_OCHANNELS (self), "");
+ return BSE_SOURCE_OCHANNEL_LABEL (self, output_channel);
+}
+
+Error
+SourceImpl::set_input (const String &ichannel_ident, SourceIface &omodule, const String &ochannel_ident)
+{
+ BseSource *self = as<BseSource*>();
+ assert_return (ichannel_ident.empty() == false, Bse::Error::PROC_PARAM_INVAL);
+ BseSource *osource = omodule.as<BseSource*>();
+ assert_return (osource != NULL, Bse::Error::PROC_PARAM_INVAL);
+ assert_return (ochannel_ident.empty() == false, Bse::Error::PROC_PARAM_INVAL);
+ const size_t input_channel = bse_source_find_ichannel (self, ichannel_ident.c_str());
+ assert_return (input_channel < BSE_SOURCE_N_ICHANNELS (self), Bse::Error::PROC_PARAM_INVAL);
+ const size_t output_channel = bse_source_find_ochannel (osource, ochannel_ident.c_str());
+ assert_return (output_channel < BSE_SOURCE_N_OCHANNELS (osource), Bse::Error::PROC_PARAM_INVAL);
+ if (self->parent != osource->parent)
+ return Bse::Error::PROC_PARAM_INVAL;
+ Bse::Error error = bse_source_set_input (self, input_channel, osource, output_channel);
+ if (error == Bse::Error::NONE)
+ {
+ UndoDescriptor<SourceImpl> omodule_descriptor = undo_descriptor (*osource->as<SourceImpl*>());
+ auto lambda = [input_channel, omodule_descriptor, output_channel] (SourceImpl &self, BseUndoStack
*ustack) -> Error {
+ SourceImpl &omodule = self.undo_resolve (omodule_descriptor);
+ Bse::Error error = self.unset_input_by_id (input_channel, omodule, output_channel);
+ return error;
+ };
+ push_undo (__func__, *this, lambda);
+ }
+ return error;
+}
+
+
+Error
+SourceImpl::set_input_by_id (int input_channel, SourceIface &omodule, int output_channel)
+{
+ BseSource *self = as<BseSource*>();
+ assert_return (size_t (input_channel) < BSE_SOURCE_N_ICHANNELS (self), Bse::Error::PROC_PARAM_INVAL);
+ BseSource *osource = omodule.as<BseSource*>();
+ assert_return (osource != NULL, Bse::Error::PROC_PARAM_INVAL);
+ assert_return (size_t (output_channel) < BSE_SOURCE_N_OCHANNELS (osource), Bse::Error::PROC_PARAM_INVAL);
+ if (self->parent != osource->parent)
+ return Bse::Error::PROC_PARAM_INVAL;
+ Bse::Error error = bse_source_set_input (self, input_channel, osource, output_channel);
+ if (error == Bse::Error::NONE)
+ {
+ UndoDescriptor<SourceImpl> omodule_descriptor = undo_descriptor (*osource->as<SourceImpl*>());
+ auto lambda = [input_channel, omodule_descriptor, output_channel] (SourceImpl &self, BseUndoStack
*ustack) -> Error {
+ SourceImpl &omodule = self.undo_resolve (omodule_descriptor);
+ Bse::Error error = self.unset_input_by_id (input_channel, omodule, output_channel);
+ return error;
+ };
+ push_undo (__func__, *this, lambda);
+ }
+ return error;
+}
+
+Error
+SourceImpl::unset_input (const String &ichannel_ident, SourceIface &omodule, const String &ochannel_ident)
+{
+ BseSource *self = as<BseSource*>();
+ assert_return (ichannel_ident.empty() == false, Bse::Error::PROC_PARAM_INVAL);
+ BseSource *osource = omodule.as<BseSource*>();
+ assert_return (osource != NULL, Bse::Error::PROC_PARAM_INVAL);
+ assert_return (ochannel_ident.empty() == false, Bse::Error::PROC_PARAM_INVAL);
+ const size_t input_channel = bse_source_find_ichannel (self, ichannel_ident.c_str());
+ assert_return (input_channel < BSE_SOURCE_N_ICHANNELS (self), Bse::Error::PROC_PARAM_INVAL);
+ const size_t output_channel = bse_source_find_ochannel (osource, ochannel_ident.c_str());
+ assert_return (output_channel < BSE_SOURCE_N_OCHANNELS (osource), Bse::Error::PROC_PARAM_INVAL);
+ Bse::Error error = bse_source_check_input (self, input_channel, osource, output_channel);
+ if (error == Bse::Error::NONE)
+ {
+ BseUndoStack *ustack = bse_item_undo_open (self, "unset-input-by-id");
+ bse_source_input_backup_to_undo (self, input_channel, osource, output_channel);
+ UndoDescriptor<SourceImpl> omodule_descriptor = undo_descriptor (*osource->as<SourceImpl*>());
+ auto lambda = [input_channel, omodule_descriptor, output_channel] (SourceImpl &self, BseUndoStack
*ustack) -> Error {
+ SourceImpl &omodule = self.undo_resolve (omodule_descriptor);
+ Bse::Error error = self.unset_input_by_id (input_channel, omodule, output_channel);
+ return error;
+ };
+ error = bse_source_unset_input (self, input_channel, osource, output_channel);
+ push_undo_to_redo (__func__, *this, lambda);
+ bse_item_undo_close (ustack);
+ }
+ return error;
+}
+
+Error
+SourceImpl::unset_input_by_id (int input_channel, SourceIface &omodule, int output_channel)
+{
+ BseSource *self = as<BseSource*>();
+ assert_return (size_t (input_channel) < BSE_SOURCE_N_ICHANNELS (self), Bse::Error::PROC_PARAM_INVAL);
+ BseSource *osource = omodule.as<BseSource*>();
+ assert_return (osource != NULL, Bse::Error::PROC_PARAM_INVAL);
+ assert_return (size_t (output_channel) < BSE_SOURCE_N_OCHANNELS (osource), Bse::Error::PROC_PARAM_INVAL);
+ Bse::Error error = bse_source_check_input (self, input_channel, osource, output_channel);
+ if (error == Bse::Error::NONE)
+ {
+ BseUndoStack *ustack = bse_item_undo_open (self, "unset-input-by-id");
+ bse_source_input_backup_to_undo (self, input_channel, osource, output_channel);
+ UndoDescriptor<SourceImpl> omodule_descriptor = undo_descriptor (*osource->as<SourceImpl*>());
+ auto lambda = [input_channel, omodule_descriptor, output_channel] (SourceImpl &self, BseUndoStack
*ustack) -> Error {
+ SourceImpl &omodule = self.undo_resolve (omodule_descriptor);
+ Bse::Error error = self.unset_input_by_id (input_channel, omodule, output_channel);
+ return error;
+ };
+ error = bse_source_unset_input (self, input_channel, osource, output_channel);
+ push_undo_to_redo (__func__, *this, lambda);
+ bse_item_undo_close (ustack);
+ }
+ return error;
+}
+
void
SourceImpl::set_pos (double x_pos, double y_pos)
{
diff --git a/bse/bsesource.hh b/bse/bsesource.hh
index 53ccb67..06cf427 100644
--- a/bse/bsesource.hh
+++ b/bse/bsesource.hh
@@ -275,13 +275,28 @@ class SourceImpl : public ItemImpl, public virtual SourceIface {
protected:
virtual ~SourceImpl ();
public:
- explicit SourceImpl (BseObject*);
- virtual SourceIfaceP ichannel_get_osource (int input_channel, int input_joint) override;
- virtual bool has_output (int) override;
- virtual bool has_outputs () override;
- virtual int n_ichannels () override;
- virtual int n_ochannels () override;
- virtual void set_pos (double x_pos, double y_pos) override;
+ explicit SourceImpl (BseObject*);
+ virtual SourceIfaceP ichannel_get_osource (int input_channel, int input_joint) override;
+ virtual bool has_output (int ochannel) override;
+ virtual bool has_outputs () override;
+ virtual std::string ichannel_blurb (int input_channel) override;
+ virtual int ichannel_get_n_joints (int input_channel) override;
+ virtual int ichannel_get_ochannel (int input_channel, int input_joint) override;
+ virtual std::string ichannel_ident (int input_channel) override;
+ virtual std::string ichannel_label (int input_channel) override;
+ virtual bool is_joint_ichannel (const std::string &input_channel) override;
+ virtual bool is_joint_ichannel_by_id (int input_channel) override;
+ virtual bool is_prepared () override;
+ virtual int n_ichannels () override;
+ virtual int n_ochannels () override;
+ virtual std::string ochannel_blurb (int output_channel) override;
+ virtual std::string ochannel_ident (int output_channel) override;
+ virtual std::string ochannel_label (int output_channel) override;
+ virtual Error set_input (const String &input_channel, SourceIface &omodule, const
String &output_channel) override;
+ virtual Error set_input_by_id (int input_channel, SourceIface &omodule, int output_channel)
override;
+ virtual Error unset_input (const String &input_channel, SourceIface &omodule, const
String &output_channel) override;
+ virtual Error unset_input_by_id (int input_channel, SourceIface &omodule, int output_channel)
override;
+ virtual void set_pos (double x_pos, double y_pos) override;
};
} // Bse
diff --git a/bse/bsesource.proc b/bse/bsesource.proc
index e23a314..2226f4d 100644
--- a/bse/bsesource.proc
+++ b/bse/bsesource.proc
@@ -12,188 +12,6 @@
AUTHORS = "Tim Janik <timj gtk org>";
LICENSE = "GNU Lesser General Public License";
-METHOD (BseSource, set-input-by-id) {
- HELP = "Connect a module input to another module's output.";
- IN = bse_param_spec_object ("imodule", "Input Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_int ("input-channel", "Input Channel", NULL,
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
- IN = bse_param_spec_object ("omodule", "Output Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_int ("output-channel", "Output Channel", NULL,
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
- OUT = bse_param_spec_genum ("error", "Error", NULL,
- BSE_TYPE_ERROR_TYPE, Bse::Error::NONE,
- SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseSource *isource = (BseSource*) bse_value_get_object (in_values++);
- guint ichannel = sfi_value_get_int (in_values++);
- BseSource *osource = (BseSource*) bse_value_get_object (in_values++);
- guint ochannel = sfi_value_get_int (in_values++);
- Bse::Error error;
-
- /* check parameters */
- if (!BSE_IS_SOURCE (isource) || !BSE_IS_SOURCE (osource) ||
- BSE_ITEM (isource)->parent != BSE_ITEM (osource)->parent)
- return Bse::Error::PROC_PARAM_INVAL;
-
- /* connect */
- error = bse_source_set_input (isource, ichannel, osource, ochannel);
- if (error == Bse::Error::NONE)
- bse_item_push_undo_proc (isource, "unset-input-by-id", ichannel, osource, ochannel);
-
- /* set output parameters */
- g_value_set_enum (out_values++, int (error));
-
- return Bse::Error::NONE;
-}
-
-METHOD (BseSource, set-input) {
- HELP = "Connect a module input to another module's output.";
- IN = bse_param_spec_object ("imodule", "Input Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_string ("input-channel", "Input Channel", NULL,
- NULL, SFI_PARAM_STANDARD);
- IN = bse_param_spec_object ("omodule", "Output Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_string ("output-channel", "Output Channel", NULL,
- NULL, SFI_PARAM_STANDARD);
- OUT = bse_param_spec_genum ("error", "Error", NULL,
- BSE_TYPE_ERROR_TYPE, Bse::Error::NONE,
- SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseSource *isource = (BseSource*) bse_value_get_object (in_values++);
- const char *ichannel_ident = sfi_value_get_string (in_values++);
- BseSource *osource = (BseSource*) bse_value_get_object (in_values++);
- const char *ochannel_ident = sfi_value_get_string (in_values++);
- guint ichannel, ochannel;
- Bse::Error error;
-
- /* check parameters */
- if (!BSE_IS_SOURCE (isource) || !BSE_IS_SOURCE (osource) ||
- BSE_ITEM (isource)->parent != BSE_ITEM (osource)->parent ||
- !ichannel_ident || !ochannel_ident)
- return Bse::Error::PROC_PARAM_INVAL;
-
- /* connect */
- ichannel = bse_source_find_ichannel (isource, ichannel_ident);
- ochannel = bse_source_find_ochannel (osource, ochannel_ident);
- error = bse_source_set_input (isource, ichannel, osource, ochannel);
- if (error == Bse::Error::NONE)
- bse_item_push_undo_proc (isource, "unset-input-by-id", ichannel, osource, ochannel);
-
- /* set output parameters */
- g_value_set_enum (out_values++, int (error));
-
- return Bse::Error::NONE;
-}
-
-METHOD (BseSource, unset-input-by-id) {
- HELP = "Disconnect a module input.";
- IN = bse_param_spec_object ("module", "Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_int ("input-channel", "Input Channel", NULL,
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
- IN = bse_param_spec_object ("omodule", "Output Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_int ("output-channel", "Output Channel", NULL,
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
- OUT = bse_param_spec_genum ("error", "Error", NULL,
- BSE_TYPE_ERROR_TYPE, Bse::Error::NONE,
- SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseSource *isource = (BseSource*) bse_value_get_object (in_values++);
- guint ichannel = sfi_value_get_int (in_values++);
- BseSource *osource = (BseSource*) bse_value_get_object (in_values++);
- guint ochannel = sfi_value_get_int (in_values++);
- Bse::Error error = Bse::Error::NONE;
-
- /* check parameters */
- if (!BSE_IS_SOURCE (isource) || !BSE_IS_SOURCE (osource))
- return Bse::Error::PROC_PARAM_INVAL;
-
- /* disconnect */
- error = bse_source_check_input (isource, ichannel, osource, ochannel);
- if (error == Bse::Error::NONE)
- {
- BseUndoStack *ustack = bse_item_undo_open (isource, "unset-input-by-id");
- bse_source_input_backup_to_undo (isource, ichannel, osource, ochannel);
- bse_item_push_redo_proc (isource, "unset-input-by-id", ichannel, osource, ochannel);
- bse_item_undo_close (ustack);
- error = bse_source_unset_input (isource, ichannel, osource, ochannel);
- }
-
- /* set output parameters */
- g_value_set_enum (out_values++, int (error));
-
- return Bse::Error::NONE;
-}
-
-METHOD (BseSource, unset-input) {
- HELP = "Disconnect a module input.";
- IN = bse_param_spec_object ("module", "Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_string ("input-channel", "Input Channel", NULL,
- NULL, SFI_PARAM_STANDARD);
- IN = bse_param_spec_object ("omodule", "Output Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_string ("output-channel", "Output Channel", NULL,
- NULL, SFI_PARAM_STANDARD);
- OUT = bse_param_spec_genum ("error", "Error", NULL,
- BSE_TYPE_ERROR_TYPE, Bse::Error::NONE,
- SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseSource *isource = (BseSource*) bse_value_get_object (in_values++);
- const char *ichannel_ident = sfi_value_get_string (in_values++);
- BseSource *osource = (BseSource*) bse_value_get_object (in_values++);
- const char *ochannel_ident = sfi_value_get_string (in_values++);
- guint ichannel, ochannel;
- Bse::Error error = Bse::Error::NONE;
-
- /* check parameters */
- if (!BSE_IS_SOURCE (isource) || !BSE_IS_SOURCE (osource) ||
- !ichannel_ident || !ochannel_ident)
- return Bse::Error::PROC_PARAM_INVAL;
-
- /* disconnect */
- ichannel = bse_source_find_ichannel (isource, ichannel_ident);
- ochannel = bse_source_find_ochannel (osource, ochannel_ident);
- error = bse_source_check_input (isource, ichannel, osource, ochannel);
- if (error == Bse::Error::NONE)
- {
- BseUndoStack *ustack = bse_item_undo_open (isource, "unset-input-by-id");
- bse_source_input_backup_to_undo (isource, ichannel, osource, ochannel);
- bse_item_push_redo_proc (isource, "unset-input-by-id", ichannel, osource, ochannel);
- bse_item_undo_close (ustack);
- error = bse_source_unset_input (isource, ichannel, osource, ochannel);
- }
-
- /* set output parameters */
- g_value_set_enum (out_values++, int (error));
-
- return Bse::Error::NONE;
-}
-
METHOD (BseSource, clear-inputs) {
HELP = "Disconnect all module inputs.";
IN = bse_param_spec_object ("module", "Module", NULL,
@@ -248,294 +66,6 @@ BODY (BseProcedureClass *proc,
return Bse::Error::NONE;
}
-METHOD (BseSource, ichannel-label) {
- HELP = "Get input channel name.";
- IN = bse_param_spec_object ("module", "Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_int ("input-channel", "Input Channel", NULL,
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_string ("channel_label", "Channel Name", NULL,
- NULL, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseSource *source = (BseSource*) bse_value_get_object (in_values++);
- guint ichannel = sfi_value_get_int (in_values++);
-
- /* check parameters */
- if (!BSE_IS_SOURCE (source) || ichannel >= BSE_SOURCE_N_ICHANNELS (source))
- return Bse::Error::PROC_PARAM_INVAL;
-
- /* set output parameters */
- sfi_value_set_string (out_values++, BSE_SOURCE_ICHANNEL_LABEL (source, ichannel));
-
- return Bse::Error::NONE;
-}
-
-METHOD (BseSource, ichannel-ident) {
- HELP = "Get canonical input channel name.";
- IN = bse_param_spec_object ("module", "Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_int ("input-channel", "Input Channel", NULL,
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_string ("channel_ident", "Channel Name", NULL,
- NULL, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseSource *source = (BseSource*) bse_value_get_object (in_values++);
- guint ichannel = sfi_value_get_int (in_values++);
-
- /* check parameters */
- if (!BSE_IS_SOURCE (source) || ichannel >= BSE_SOURCE_N_ICHANNELS (source))
- return Bse::Error::PROC_PARAM_INVAL;
-
- /* set output parameters */
- sfi_value_set_string (out_values++, BSE_SOURCE_ICHANNEL_IDENT (source, ichannel));
-
- return Bse::Error::NONE;
-}
-
-METHOD (BseSource, ichannel-blurb) {
- HELP = "Get input channel description.";
- IN = bse_param_spec_object ("module", "Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_int ("input-channel", "Input Channel", NULL,
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_string ("channel_blurb", "Channel Blurb", NULL,
- NULL, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseSource *source = (BseSource*) bse_value_get_object (in_values++);
- guint ichannel = sfi_value_get_int (in_values++);
-
- /* check parameters */
- if (!BSE_IS_SOURCE (source) || ichannel >= BSE_SOURCE_N_ICHANNELS (source))
- return Bse::Error::PROC_PARAM_INVAL;
-
- /* set output parameters */
- sfi_value_set_string (out_values++, BSE_SOURCE_ICHANNEL_BLURB (source, ichannel));
-
- return Bse::Error::NONE;
-}
-
-METHOD (BseSource, is-joint-ichannel-by-id) {
- HELP = "Check if an input channel is a joint (multi-connect) channel.";
- IN = bse_param_spec_object ("module", "Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_int ("input-channel", "Input Channel", NULL,
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_bool ("is_jchannel", "Is Joint Channel", NULL,
- FALSE, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseSource *source = (BseSource*) bse_value_get_object (in_values++);
- guint ichannel = sfi_value_get_int (in_values++);
-
- /* check parameters */
- if (!BSE_IS_SOURCE (source) || ichannel >= BSE_SOURCE_N_ICHANNELS (source))
- return Bse::Error::PROC_PARAM_INVAL;
-
- /* set output parameters */
- sfi_value_set_bool (out_values++, BSE_SOURCE_IS_JOINT_ICHANNEL (source, ichannel));
-
- return Bse::Error::NONE;
-}
-
-METHOD (BseSource, is-joint-ichannel) {
- HELP = "Check if an input channel is a joint (multi-connect) channel.";
- IN = bse_param_spec_object ("module", "Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_string ("input-channel", "Input Channel", NULL,
- NULL, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_bool ("is_jchannel", "Is Joint Channel", NULL,
- FALSE, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseSource *source = (BseSource*) bse_value_get_object (in_values++);
- const char *ichannel = sfi_value_get_string (in_values++);
- guint id;
-
- /* check parameters */
- if (!BSE_IS_SOURCE (source) || !ichannel)
- return Bse::Error::PROC_PARAM_INVAL;
-
- /* set output parameters */
- id = bse_source_find_ichannel (source, ichannel);
- sfi_value_set_bool (out_values++,
- id < BSE_SOURCE_N_ICHANNELS (source) ? BSE_SOURCE_IS_JOINT_ICHANNEL (source, id) :
FALSE);
-
- return Bse::Error::NONE;
-}
-
-METHOD (BseSource, ichannel-get-n-joints) {
- HELP = "Retrieve the number of inputs connected to an input channel.";
- IN = bse_param_spec_object ("module", "Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_int ("input-channel", "Input Channel", NULL,
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_int ("n_joints", "Number of Connections", NULL,
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseSource *source = (BseSource*) bse_value_get_object (in_values++);
- guint ichannel = sfi_value_get_int (in_values++);
- BseSourceInput *input;
-
- /* check parameters */
- if (!BSE_IS_SOURCE (source) || ichannel >= BSE_SOURCE_N_ICHANNELS (source))
- return Bse::Error::PROC_PARAM_INVAL;
-
- /* set output parameters */
- input = BSE_SOURCE_INPUT (source, ichannel);
- if (BSE_SOURCE_IS_JOINT_ICHANNEL (source, ichannel))
- sfi_value_set_int (out_values++, input->jdata.n_joints);
- else
- sfi_value_set_int (out_values++, input->idata.osource ? 1 : 0);
-
- return Bse::Error::NONE;
-}
-
-METHOD (BseSource, ichannel-get-ochannel) {
- HELP = "Retrieve output channel of the module connected to a specific joint of an input channel.";
- IN = bse_param_spec_object ("module", "Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_int ("input-channel", "Input Channel", NULL,
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
- IN = sfi_pspec_int ("input-joint", "Input Joint", NULL,
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_int ("ochannel", "Output Channel", NULL,
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseSource *source = (BseSource*) bse_value_get_object (in_values++);
- guint ichannel = sfi_value_get_int (in_values++);
- guint joint = sfi_value_get_int (in_values++);
- BseSourceInput *input;
-
- /* check parameters */
- if (!BSE_IS_SOURCE (source) || ichannel >= BSE_SOURCE_N_ICHANNELS (source))
- return Bse::Error::PROC_PARAM_INVAL;
-
- /* set output parameters */
- input = BSE_SOURCE_INPUT (source, ichannel);
- if (BSE_SOURCE_IS_JOINT_ICHANNEL (source, ichannel) && joint < input->jdata.n_joints)
- sfi_value_set_int (out_values++, input->jdata.joints[joint].ochannel);
- else if (joint < 1)
- sfi_value_set_int (out_values++, input->idata.ochannel);
- else
- sfi_value_set_int (out_values++, G_MAXINT);
-
- return Bse::Error::NONE;
-}
-
-METHOD (BseSource, ochannel-label) {
- HELP = "Get output channel name.";
- IN = bse_param_spec_object ("module", "Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_int ("output-channel", "Input Channel", NULL,
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_string ("channel_label", "Channel Name", NULL,
- NULL, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseSource *source = (BseSource*) bse_value_get_object (in_values++);
- guint ochannel = sfi_value_get_int (in_values++);
-
- /* check parameters */
- if (!BSE_IS_SOURCE (source) || ochannel >= BSE_SOURCE_N_OCHANNELS (source))
- return Bse::Error::PROC_PARAM_INVAL;
-
- /* set output parameters */
- sfi_value_set_string (out_values++, BSE_SOURCE_OCHANNEL_LABEL (source, ochannel));
-
- return Bse::Error::NONE;
-}
-
-METHOD (BseSource, ochannel-ident) {
- HELP = "Get canonical output channel name.";
- IN = bse_param_spec_object ("module", "Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_int ("output-channel", "Input Channel", NULL,
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_string ("channel_ident", "Channel Name", NULL,
- NULL, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseSource *source = (BseSource*) bse_value_get_object (in_values++);
- guint ochannel = sfi_value_get_int (in_values++);
-
- /* check parameters */
- if (!BSE_IS_SOURCE (source) || ochannel >= BSE_SOURCE_N_OCHANNELS (source))
- return Bse::Error::PROC_PARAM_INVAL;
-
- /* set output parameters */
- sfi_value_set_string (out_values++, BSE_SOURCE_OCHANNEL_IDENT (source, ochannel));
-
- return Bse::Error::NONE;
-}
-
-METHOD (BseSource, ochannel-blurb) {
- HELP = "Get output channel description.";
- IN = bse_param_spec_object ("module", "Module", NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- IN = sfi_pspec_int ("output-channel", "Input Channel", NULL,
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_string ("channel_blurb", "Channel Blurb", NULL,
- NULL, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseSource *source = (BseSource*) bse_value_get_object (in_values++);
- guint ochannel = sfi_value_get_int (in_values++);
-
- /* check parameters */
- if (!BSE_IS_SOURCE (source) || ochannel >= BSE_SOURCE_N_OCHANNELS (source))
- return Bse::Error::PROC_PARAM_INVAL;
-
- /* set output parameters */
- sfi_value_set_string (out_values++, BSE_SOURCE_OCHANNEL_BLURB (source, ochannel));
-
- return Bse::Error::NONE;
-}
-
METHOD (BseSource, set-automation) {
HELP = "Setup automation parameters for a property.";
IN = bse_param_spec_object ("source", NULL, NULL,
@@ -637,25 +167,3 @@ BODY (BseProcedureClass *proc,
return Bse::Error::NONE;
}
-
-METHOD (BseSource, is-prepared) {
- HELP = "Check whether a source is prepared for synthesis processing.";
- IN = bse_param_spec_object ("source", NULL, NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_bool ("is_prepared", NULL, NULL, FALSE, SFI_PARAM_STANDARD);
-} BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseSource *source = (BseSource*) bse_value_get_object (in_values++);
-
- /* check parameters */
- if (!BSE_IS_SOURCE (source))
- return Bse::Error::PROC_PARAM_INVAL;
-
- /* set output parameters */
- sfi_value_set_bool (out_values++, BSE_SOURCE_PREPARED (source));
-
- return Bse::Error::NONE;
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]