[beast: 3/26] BSE: port 4 more Track procedures to bseapi.idl, fix BEAST track row display
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 3/26] BSE: port 4 more Track procedures to bseapi.idl, fix BEAST track row display
- Date: Mon, 13 Jul 2015 02:26:42 +0000 (UTC)
commit a1573c463e155e1b24537a59ca5a3aed1828df85
Author: Tim Janik <timj gnu org>
Date: Tue Jun 30 05:08:07 2015 +0200
BSE: port 4 more Track procedures to bseapi.idl, fix BEAST track row display
beast-gtk/bsttrackroll.cc | 63 ++++++++++-----------
beast-gtk/bsttrackroll.hh | 38 +++++++-------
beast-gtk/bsttrackrollctrl.cc | 27 ++++-----
beast-gtk/bsttrackrollctrl.hh | 2 +-
beast-gtk/bsttrackview.cc | 18 ++++---
bse/bseapi.idl | 23 +++++++-
bse/bsebus.proc | 2 +
bse/bsetrack.cc | 44 +++++++++++++++
bse/bsetrack.hh | 12 +++--
bse/bsetrack.proc | 118 -----------------------------------------
10 files changed, 147 insertions(+), 200 deletions(-)
---
diff --git a/beast-gtk/bsttrackroll.cc b/beast-gtk/bsttrackroll.cc
index 82fcae1..3baf9b1 100644
--- a/beast-gtk/bsttrackroll.cc
+++ b/beast-gtk/bsttrackroll.cc
@@ -62,6 +62,7 @@ enum {
static void
bst_track_roll_init (BstTrackRoll *self)
{
+ new (&self->start_track) Bse::TrackH();
GxkScrollCanvas *scc = GXK_SCROLL_CANVAS (self);
self->tpt = 384 * 4;
@@ -116,6 +117,8 @@ bst_track_roll_finalize (GObject *object)
g_free (self->scopes);
G_OBJECT_CLASS (bst_track_roll_parent_class)->finalize (object);
+ using namespace Bse;
+ self->start_track.~TrackH();
}
static void
@@ -210,7 +213,7 @@ bst_track_roll_setup (BstTrackRoll *self,
NULL);
}
track_roll_update_layout (self, TRUE);
- bst_track_roll_queue_row_change (self, 0);
+ bst_track_roll_queue_row_change (self, -1);
gtk_widget_queue_resize (GTK_WIDGET (self));
}
@@ -318,11 +321,9 @@ coord_check_crossing (BstTrackRoll *self,
}
static gint
-coord_to_row (BstTrackRoll *self,
- gint y,
- gboolean *is_valid)
+coord_to_row (BstTrackRoll *self, int y, bool *is_valid)
{
- gint row;
+ int row;
if (self->tree && is_valid)
*is_valid = gxk_tree_view_get_row_from_coord (self->tree, y, &row);
else if (self->tree)
@@ -350,14 +351,13 @@ row_to_coords (BstTrackRoll *self,
}
}
-static SfiProxy
-row_to_track (BstTrackRoll *self,
- gint row)
+static Bse::TrackH
+row_to_track (BstTrackRoll *self, int row)
{
if (self->get_track)
return self->get_track (self->proxy_data, row);
else
- return 0;
+ return Bse::TrackH();
}
static void
@@ -435,19 +435,19 @@ track_roll_reallocate_contents (GxkScrollCanvas *scc,
}
static void
-scope_set_track (GtkWidget *scope,
- SfiProxy track)
+scope_set_track (GtkWidget *scope, Bse::TrackH track)
{
- g_object_set_long (scope, "BstTrackRoll-Track", track);
+ g_object_set_long (scope, "BstTrackRoll-Track", track.proxy_id());
if (BST_SNIFFER_SCOPE (scope))
- bst_sniffer_scope_set_sniffer (BST_SNIFFER_SCOPE (scope),
- bse_track_get_output_source (track));
+ bst_sniffer_scope_set_sniffer (BST_SNIFFER_SCOPE (scope), track.get_output_source().proxy_id());
}
-static SfiProxy
+static Bse::TrackH
scope_get_track (GtkWidget *scope)
{
- return g_object_get_long (scope, "BstTrackRoll-Track");
+ const long trackid = g_object_get_long (scope, "BstTrackRoll-Track");
+ Bse::TrackH track = Bse::TrackH::down_cast (bse_server.from_proxy (trackid));
+ return track;
}
static gboolean
@@ -471,7 +471,7 @@ track_roll_idle_update_scopes (gpointer data)
if (self->get_track && GTK_WIDGET_REALIZED (self))
for (i = 0; ; i++)
{
- SfiProxy track = self->get_track (self->proxy_data, i);
+ Bse::TrackH track = self->get_track (self->proxy_data, i);
GtkWidget *scope = NULL;
GSList *slist;
if (!track)
@@ -537,7 +537,7 @@ bst_track_roll_check_update_scopes (BstTrackRoll *self)
}
for (i = 0; i < self->n_scopes; i++)
{
- SfiProxy track = self->get_track (self->proxy_data, i);
+ Bse::TrackH track = self->get_track (self->proxy_data, i);
if (scope_get_track (self->scopes[i]) != track)
{
queue_scope_update (self);
@@ -598,7 +598,7 @@ bst_track_roll_draw_canvas (GxkScrollCanvas *scc,
validrow = row_to_coords (self, row, &ry, &rheight);
while (validrow && ry < area->y + area->height)
{
- SfiProxy track = row_to_track (self, row);
+ Bse::TrackH track = row_to_track (self, row);
if (row == self->ecell_row)
bst_track_roll_allocate_ecell (self);
gdk_draw_rectangle (drawable,
@@ -607,7 +607,7 @@ bst_track_roll_draw_canvas (GxkScrollCanvas *scc,
0, ry, width, rheight);
if (track)
{
- BseTrackPartSeq *tps = bse_track_list_parts (track);
+ BseTrackPartSeq *tps = bse_track_list_parts (track.proxy_id());
for (uint i = 0; i < tps->n_tparts; i++)
{
static const int ENTRY_INNER_BORDER = 2; /* sigh, no way around this */
@@ -911,7 +911,7 @@ track_roll_handle_drag (GxkScrollCanvas *scc,
GdkEvent *event)
{
BstTrackRoll *self = BST_TRACK_ROLL (scc);
- BstTrackRollDrag drag_mem = { 0 }, *drag = &drag_mem;
+ BstTrackRollDrag drag_mem, *drag = &drag_mem;
gint hdrag = scc_drag->canvas_drag || scc_drag->top_panel_drag;
gint vdrag = scc_drag->canvas_drag || scc_drag->left_panel_drag;
/* copy over drag setup */
@@ -966,45 +966,42 @@ bst_track_roll_button_press (GtkWidget *widget,
}
void
-bst_track_roll_set_track_callback (BstTrackRoll *self,
- gpointer data,
- BstTrackRollTrackFunc get_track)
+bst_track_roll_set_track_callback (BstTrackRoll *self, gpointer data, BstTrackRollTrackFunc get_track)
{
g_return_if_fail (BST_IS_TRACK_ROLL (self));
self->proxy_data = data;
self->get_track = get_track;
gtk_widget_queue_draw (GTK_WIDGET (self));
- bst_track_roll_queue_row_change (self, 0);
+ bst_track_roll_queue_row_change (self, -1);
}
void
-bst_track_roll_queue_row_change (BstTrackRoll *self,
- guint row)
+bst_track_roll_queue_row_change (BstTrackRoll *self, int row)
{
GxkScrollCanvas *scc;
- GdkRectangle rect;
g_return_if_fail (BST_IS_TRACK_ROLL (self));
scc = GXK_SCROLL_CANVAS (self);
+ GdkRectangle rect { 0, 0, 0, 0 };
gxk_scroll_canvas_get_canvas_size (scc, &rect.width, &rect.height);
rect.x = 0;
if (GTK_WIDGET_DRAWABLE (self) &&
- row_to_coords (self, row, &rect.y, &rect.height))
+ (row < 0 || row_to_coords (self, row, &rect.y, &rect.height)))
{
gdk_window_invalidate_rect (CANVAS (self), &rect, TRUE);
rect.x = 0;
gdk_window_get_size (VPANEL (self), &rect.width, NULL);
gdk_window_invalidate_rect (VPANEL (self), &rect, TRUE);
}
- guint i, last_tick = 0;
- for (i = 0; ; i++)
+ uint last_tick = 0;
+ for (size_t i = 0; ; i++)
{
- SfiProxy track = row_to_track (self, i);
+ Bse::TrackH track = row_to_track (self, i);
if (!track)
break;
- guint l = bse_track_get_last_tick (track);
+ uint l = track.get_last_tick();
last_tick = MAX (last_tick, l);
}
bst_track_roll_hsetup (self, self->tpt, last_tick + 1, self->hzoom);
diff --git a/beast-gtk/bsttrackroll.hh b/beast-gtk/bsttrackroll.hh
index be4ef3b..520ca65 100644
--- a/beast-gtk/bsttrackroll.hh
+++ b/beast-gtk/bsttrackroll.hh
@@ -18,8 +18,7 @@ G_BEGIN_DECLS
/* --- typedefs & enums --- */
typedef struct _BstTrackRoll BstTrackRoll;
typedef struct _BstTrackRollClass BstTrackRollClass;
-typedef SfiProxy (*BstTrackRollTrackFunc) (gpointer proxy_data,
- gint row);
+typedef Bse::TrackH (*BstTrackRollTrackFunc) (void *proxy_data, int row);
/* --- structures & typedefs --- */
@@ -30,19 +29,21 @@ typedef enum /*< skip >*/
BST_TRACK_ROLL_MARKER_LOOP,
BST_TRACK_ROLL_MARKER_SELECT
} BstTrackRollMarkerType;
-typedef struct {
+struct BstTrackRollDrag {
GXK_SCROLL_CANVAS_DRAG_FIELDS;
- guint start_row;
- SfiProxy start_track;
- guint start_tick;
- gboolean start_valid;
- guint current_row;
- SfiProxy current_track;
- guint current_tick;
- gboolean current_valid;
- /* convenience: */
+ uint start_row;
+ Bse::TrackH start_track;
+ uint start_tick;
+ bool start_valid;
+ uint current_row;
+ Bse::TrackH current_track;
+ uint current_tick;
+ bool current_valid;
+ // convenience:
BstTrackRoll *troll;
-} BstTrackRollDrag;
+ BstTrackRollDrag() : start_row (~uint (0)), start_tick (0), start_valid (0),
+ current_row (~uint (0)), current_tick (0), current_valid (0), troll (NULL) {}
+};
struct _BstTrackRoll
{
GxkScrollCanvas parent_instance;
@@ -76,10 +77,10 @@ struct _BstTrackRoll
BstTrackRollTrackFunc get_track;
/* last drag state */
- guint start_row;
- SfiProxy start_track;
- guint start_tick;
- gboolean start_valid;
+ uint start_row;
+ Bse::TrackH start_track;
+ uint start_tick;
+ bool start_valid;
};
struct _BstTrackRollClass
{
@@ -112,8 +113,7 @@ void bst_track_roll_set_track_callback (BstTrackRoll *self,
BstTrackRollTrackFunc get_track);
void bst_track_roll_check_update_scopes (BstTrackRoll *self);
void bst_track_roll_reselect (BstTrackRoll *self);
-void bst_track_roll_queue_row_change (BstTrackRoll *self,
- guint row);
+void bst_track_roll_queue_row_change (BstTrackRoll *self, int row);
void bst_track_roll_set_prelight_row (BstTrackRoll *self,
guint row);
void bst_track_roll_start_edit (BstTrackRoll *self,
diff --git a/beast-gtk/bsttrackrollctrl.cc b/beast-gtk/bsttrackrollctrl.cc
index 17aaf70..860a3bc 100644
--- a/beast-gtk/bsttrackrollctrl.cc
+++ b/beast-gtk/bsttrackrollctrl.cc
@@ -419,14 +419,14 @@ insert_start (BstTrackRollController *self,
if (drag->current_track && drag->current_valid && !self->obj_part)
{
guint tick = bst_track_roll_controller_quantize (self, drag->current_tick);
- SfiProxy item = bse_track_get_part (drag->current_track, tick);
- if (!item)
+ Bse::TrackH track = drag->current_track;
+ Bse::PartH part = track.get_part (tick);
+ if (!part)
{
- SfiProxy song = bse_item_get_parent (drag->current_track);
+ SfiProxy song = bse_item_get_parent (drag->current_track.proxy_id());
bse_item_group_undo (song, "Insert part");
- item = bse_song_create_part (song);
+ SfiProxy item = bse_song_create_part (song);
Bse::PartH part = Bse::PartH::down_cast (bse_server.from_proxy (item));
- Bse::TrackH track = Bse::TrackH::down_cast (bse_server.from_proxy (drag->current_track));
if (item && track.insert_part (tick, part) > 0)
gxk_status_set (GXK_STATUS_DONE, _("Insert Part"), NULL);
else
@@ -454,7 +454,7 @@ delete_start (BstTrackRollController *self,
if (self->obj_part) /* got part to delete */
{
bse_item_group_undo (self->song, "Delete Part");
- Bse::TrackH track = Bse::TrackH::down_cast (bse_server.from_proxy (self->obj_track));
+ Bse::TrackH track = self->obj_track;
track.remove_tick (self->obj_tick);
if (!bse_song_find_any_track_for_part (self->song, self->obj_part.proxy_id()))
bse_song_remove_part (self->song, self->obj_part.proxy_id());
@@ -512,15 +512,12 @@ move_motion (BstTrackRollController *self, BstTrackRollDrag *drag)
// track_changed = self->obj_track != drag->current_track;
if (new_tick != self->obj_tick || self->obj_track != drag->current_track)
{
- bse_item_group_undo (drag->current_track, "Move part");
- Bse::TrackH track = Bse::TrackH::down_cast (bse_server.from_proxy (drag->current_track));
+ Bse::TrackH track = drag->current_track;
+ bse_item_group_undo (track.proxy_id(), "Move part");
if (track.insert_part (new_tick, self->obj_part) > 0)
{
if (!self->skip_deletion)
- {
- Bse::TrackH track = Bse::TrackH::down_cast (bse_server.from_proxy (self->obj_track));
- track.remove_tick (self->obj_tick);
- }
+ self->obj_track.remove_tick (self->obj_tick);
else
{
self->skip_deletion = FALSE;
@@ -531,7 +528,7 @@ move_motion (BstTrackRollController *self, BstTrackRollDrag *drag)
gxk_status_set (GXK_STATUS_PROGRESS, action, NULL);
}
/* else gxk_status_set (GXK_STATUS_ERROR, "Move Part", Bse::error_blurb (error)); */
- bse_item_ungroup_undo (drag->current_track);
+ bse_item_ungroup_undo (track.proxy_id());
}
}
@@ -654,8 +651,8 @@ controller_drag (BstTrackRollController *self,
/* setup drag data */
if (!drag->start_valid)
- drag->start_track = 0;
- tps = drag->start_track ? bse_track_list_parts (drag->start_track) : NULL;
+ drag->start_track = Bse::TrackH();
+ tps = drag->start_track ? bse_track_list_parts (drag->start_track.proxy_id()) : NULL;
if (tps && tps->n_tparts) /* FIXME: BSE should have a convenience function to find a part */
{
for (size_t j = 0; j < tps->n_tparts; j++)
diff --git a/beast-gtk/bsttrackrollctrl.hh b/beast-gtk/bsttrackrollctrl.hh
index 94eb3e0..fde79bb 100644
--- a/beast-gtk/bsttrackrollctrl.hh
+++ b/beast-gtk/bsttrackrollctrl.hh
@@ -15,7 +15,7 @@ typedef struct {
SfiProxy song;
guint note_length;
/* drag data */
- SfiProxy obj_track;
+ Bse::TrackH obj_track;
Bse::PartH obj_part;
int obj_tick, obj_duration;
guint xoffset;
diff --git a/beast-gtk/bsttrackview.cc b/beast-gtk/bsttrackview.cc
index 60bcc5a..39920d7 100644
--- a/beast-gtk/bsttrackview.cc
+++ b/beast-gtk/bsttrackview.cc
@@ -433,11 +433,12 @@ track_view_midi_channel_edited (BstTrackView *self,
}
}
-static SfiProxy
-get_track (gpointer data,
- gint row)
+static Bse::TrackH
+get_track (void *data, int row)
{
- return bst_item_view_get_proxy (BST_ITEM_VIEW (data), row);
+ SfiProxy proxy = bst_item_view_get_proxy (BST_ITEM_VIEW (data), row);
+ Bse::TrackH track = Bse::TrackH::down_cast (bse_server.from_proxy (proxy));
+ return track;
}
static void
@@ -715,11 +716,12 @@ track_view_action_exec (gpointer data,
item = bse_song_create_track (song);
if (item)
{
- gchar *string = g_strdup_format ("Track-%02X", bse_item_get_seqid (item));
- bse_item_set_name (item, string);
+ Bse::TrackH track = Bse::TrackH::down_cast (bse_server.from_proxy (item));
+ gchar *string = g_strdup_format ("Track-%02X", bse_item_get_seqid (track.proxy_id()));
+ bse_item_set_name (track.proxy_id(), string);
g_free (string);
- bst_item_view_select (item_view, item);
- bse_track_ensure_output (item);
+ bst_item_view_select (item_view, track.proxy_id());
+ track.ensure_output();
}
bse_item_ungroup_undo (song);
break;
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index f5e9cc6..7b0c07e 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -402,8 +402,27 @@ interface ContextMerger : Source {
/// Data object containing sequencing information and links to Part objects.
interface Track : ContextMerger {
- int32 insert_part (int32 tick, Part part); ///< Insert Part into Track at @a tick, returns the
corresponding link id.
- void remove_tick (int32 tick); ///< Remove Part at specified @a tick from a track.
+ int32 insert_part (int32 tick, Part part); ///< Insert Part into Track at @a tick, returns the
corresponding link id.
+ void remove_tick (int32 tick); ///< Remove Part at specified @a tick from a track.
+
+ // ItemSeq list_parts_uniq (); ///< List all parts contained in a track.
+ // TrackPartSeq list_parts (); ///< List parts scheduled in a track, sorted by tick.
+ // void remove_link (int32 id); ///< Remove a specific part link by ID from a track.
+ Part get_part (int32 tick); ///< Get the part starting at a specific tick position.
+ int32 get_last_tick (); ///< Retrieve the last tick for this track.
+ ErrorType ensure_output (); ///< Ensure the track has an output connection to a bus.
+ /// Get the output module of a track.
+ /// The output of this module is the merged result from all polyphonic voices and has all track specific
alterations applied.
+ Source get_output_source ();
+
+ // SongTimingHandle get_timing (int32 tick); ///< Retrieve song timing information at a specific tick.
+ // property bool muted; ///< _("Mute this track by ignoring it in the sequencer.")
+ // property CSynth snet; ///< _("Synthesis network to be used as instrument.")
+ // property Wave wave; ///< _("Wave to be used as instrument.")
+ // property int32 midi_channel; ///< _("Midi channel assigned to this track, 0 uses internal per-track
channel.")
+ // property int32 n_voices; ///< _("Maximum number of voices for simultaneous playback.")
+ // property CSynth pnet; ///< _("Synthesis network to be used as postprocessor.")
+ // property ItemSeq outputs; ///< _("Mixer busses used as output for this track.")
};
/// Base type for objects that can be added to a container.
diff --git a/bse/bsebus.proc b/bse/bsebus.proc
index cbe898c..02cb120 100644
--- a/bse/bsebus.proc
+++ b/bse/bsebus.proc
@@ -77,6 +77,8 @@ BODY (BseProcedureClass *proc,
bse_item_push_undo_proc (self, "connect-track", track);
}
+ // FIXME: porting: grep for 'push_undo.*"disconnect-track"'
+
/* set output parameters */
g_value_set_enum (out_values++, error);
diff --git a/bse/bsetrack.cc b/bse/bsetrack.cc
index 272fdcf..4bef00e 100644
--- a/bse/bsetrack.cc
+++ b/bse/bsetrack.cc
@@ -1102,4 +1102,48 @@ TrackImpl::remove_tick (int tick)
}
}
+PartIfaceP
+TrackImpl::get_part (int tick)
+{
+ BseTrack *self = as<BseTrack*>();
+ BseTrackEntry *entry = bse_track_lookup_tick (self, tick);
+ return entry ? entry->part->as<PartIfaceP>() : NULL;
+}
+
+int
+TrackImpl::get_last_tick ()
+{
+ BseTrack *self = as<BseTrack*>();
+ return bse_track_get_last_tick (self);
+}
+
+ErrorType
+TrackImpl::ensure_output ()
+{
+ BseTrack *self = as<BseTrack*>();
+ ErrorType error = Bse::ERROR_NONE;
+ BseItem *bparent = self->parent;
+ if (BSE_IS_SONG (bparent) && !self->bus_outputs)
+ {
+ BseSong *song = BSE_SONG (bparent);
+ BseBus *master = bse_song_find_master (song);
+ if (master)
+ {
+ error = bse_bus_connect (master, BSE_ITEM (self));
+ if (!error)
+ bse_item_push_undo_proc (master, "disconnect-track", self);
+ }
+ }
+ return error;
+}
+
+SourceIfaceP
+TrackImpl::get_output_source ()
+{
+ BseTrack *self = as<BseTrack*>();
+ BseSource *child = bse_track_get_output (self);
+ return child->as<SourceIfaceP>();
+ return child->as<SourceIfaceP>();
+}
+
} // Bse
diff --git a/bse/bsetrack.hh b/bse/bsetrack.hh
index 488b811..158da47 100644
--- a/bse/bsetrack.hh
+++ b/bse/bsetrack.hh
@@ -83,11 +83,15 @@ namespace Bse {
class TrackImpl : public ContextMergerImpl, public virtual TrackIface {
protected:
- virtual ~TrackImpl ();
+ virtual ~TrackImpl ();
public:
- explicit TrackImpl (BseObject*);
- virtual int insert_part (int tick, PartIface &part) override;
- virtual void remove_tick (int tick) override;
+ explicit TrackImpl (BseObject*);
+ virtual int insert_part (int tick, PartIface &part) override;
+ virtual void remove_tick (int tick) override;
+ virtual PartIfaceP get_part (int tick) override;
+ virtual int get_last_tick () override;
+ virtual ErrorType ensure_output () override;
+ virtual SourceIfaceP get_output_source () override;
};
} // Bse
diff --git a/bse/bsetrack.proc b/bse/bsetrack.proc
index 41c4dfb..739b09b 100644
--- a/bse/bsetrack.proc
+++ b/bse/bsetrack.proc
@@ -100,35 +100,6 @@ BODY (BseProcedureClass *proc,
return Bse::ERROR_NONE;
}
-METHOD (BseTrack, get-part) {
- HELP = "Get the part starting at a specific tick position.";
- IN = bse_param_spec_object ("track", "Track", NULL,
- BSE_TYPE_TRACK, SFI_PARAM_STANDARD);
- IN = sfi_pspec_int ("tick", "Tick", NULL,
- 0, 0, BSE_PART_MAX_TICK - 1, 384, SFI_PARAM_STANDARD);
- OUT = bse_param_spec_object ("part", "Part", NULL,
- BSE_TYPE_PART, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseTrack *self = (BseTrack*) bse_value_get_object (in_values++);
- guint tick = sfi_value_get_int (in_values++);
- BseTrackEntry *entry;
-
- /* check parameters */
- if (!BSE_IS_TRACK (self))
- return Bse::ERROR_PROC_PARAM_INVAL;
-
- /* action */
- entry = bse_track_lookup_tick (self, tick);
- bse_value_set_object (out_values++, entry ? entry->part : NULL);
-
- return Bse::ERROR_NONE;
-}
-
METHOD (BseTrack, get-timing) {
HELP = "Retrieve song timing information at a specific tick.";
IN = bse_param_spec_object ("track", "Track", NULL, BSE_TYPE_TRACK, SFI_PARAM_STANDARD);
@@ -160,92 +131,3 @@ METHOD (BseTrack, get-timing) {
return Bse::ERROR_NONE;
}
-
-METHOD (BseTrack, get-output-source) {
- HELP = _("Get the output module for this track. The output of this module is the merged result from "
- "all polyphonic voices and has all track specific alterations applied.");
- IN = bse_param_spec_object ("track", NULL, NULL,
- BSE_TYPE_TRACK, SFI_PARAM_STANDARD);
- OUT = bse_param_spec_object ("source", NULL, NULL,
- BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
-} BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseTrack *track = (BseTrack*) bse_value_get_object (in_values++);
- BseSource *child = NULL;
-
- /* check parameters */
- if (!BSE_IS_TRACK (track))
- return Bse::ERROR_PROC_PARAM_INVAL;
-
- /* action */
- child = bse_track_get_output (track);
-
- /* set output parameters */
- bse_value_set_object (out_values++, child);
-
- return Bse::ERROR_NONE;
-}
-
-METHOD (BseTrack, get-last-tick) {
- HELP = "Retrieve the last tick for this track.";
- IN = bse_param_spec_object ("track", "Track", NULL,
- BSE_TYPE_TRACK, SFI_PARAM_STANDARD);
- OUT = sfi_pspec_int ("last_tick", "Last Tick", NULL,
- 0, 0, G_MAXINT, 384, SFI_PARAM_STANDARD);
-} BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseTrack *self = (BseTrack*) bse_value_get_object (in_values++);
-
- /* check parameters */
- if (!BSE_IS_TRACK (self))
- return Bse::ERROR_PROC_PARAM_INVAL;
-
- /* set output parameters */
- sfi_value_set_int (out_values++, bse_track_get_last_tick (self));
-
- return Bse::ERROR_NONE;
-}
-
-METHOD (BseTrack, ensure-output) {
- HELP = "Ensure the track has an output connection to a bus.";
- IN = bse_param_spec_object ("track", "Track", NULL,
- BSE_TYPE_TRACK, SFI_PARAM_STANDARD);
- OUT = bse_param_spec_genum ("error", NULL, NULL,
- BSE_TYPE_ERROR_TYPE, Bse::ERROR_NONE, SFI_PARAM_STANDARD);
-} BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseTrack *self = (BseTrack*) bse_value_get_object (in_values++);
- Bse::ErrorType error = Bse::ERROR_NONE;
-
- /* check parameters */
- if (!BSE_IS_TRACK (self))
- return Bse::ERROR_PROC_PARAM_INVAL;
-
- /* action */
- BseItem *parent = BSE_ITEM (self)->parent;
- if (BSE_IS_SONG (parent) && !self->bus_outputs)
- {
- BseSong *song = BSE_SONG (parent);
- BseBus *master = bse_song_find_master (song);
- if (master)
- {
- error = bse_bus_connect (master, BSE_ITEM (self));
- if (!error)
- bse_item_push_undo_proc (master, "disconnect-track", self);
- }
- }
-
- /* set output parameters */
- g_value_set_enum (out_values++, error);
-
- return Bse::ERROR_NONE;
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]