[beast: 15/26] BEAST: use Song methods from bseapi.idl
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 15/26] BEAST: use Song methods from bseapi.idl
- Date: Fri, 14 Oct 2016 15:49:15 +0000 (UTC)
commit 2a9b1a704ee517965a25ddd423b2d1985a40fe3c
Author: Tim Janik <timj gnu org>
Date: Sun May 29 15:21:46 2016 +0200
BEAST: use Song methods from bseapi.idl
Signed-off-by: Tim Janik <timj gnu org>
beast-gtk/bstapp.cc | 5 ++++-
beast-gtk/bstbseutils.cc | 14 ++++++--------
beast-gtk/bstbusmixer.cc | 6 +++---
beast-gtk/bstpianorollctrl.cc | 14 ++++++++++----
4 files changed, 23 insertions(+), 16 deletions(-)
---
diff --git a/beast-gtk/bstapp.cc b/beast-gtk/bstapp.cc
index 324ff55..aaf0010 100644
--- a/beast-gtk/bstapp.cc
+++ b/beast-gtk/bstapp.cc
@@ -892,7 +892,10 @@ app_action_exec (gpointer data,
case BST_ACTION_NEW_SONG:
bse_item_group_undo (self->project.proxy_id(), "Create Song");
proxy = bse_project_create_song (self->project.proxy_id(), NULL);
- bse_song_ensure_master_bus (proxy);
+ {
+ Bse::SongH song = Bse::SongH::down_cast (bse_server.from_proxy (proxy));
+ song.ensure_master_bus();
+ }
bse_item_ungroup_undo (self->project.proxy_id());
self->select_unseen_super = TRUE;
break;
diff --git a/beast-gtk/bstbseutils.cc b/beast-gtk/bstbseutils.cc
index bd4ea0b..b2362bd 100644
--- a/beast-gtk/bstbseutils.cc
+++ b/beast-gtk/bstbseutils.cc
@@ -17,10 +17,9 @@ bst_project_restore_from_file (Bse::ProjectH project, const gchar *file_name, bo
SfiProxy item = items[i].proxy_id();
if (BSE_IS_SONG (item))
{
- /* fixup orphaned parts */
- bse_song_ensure_track_links (item);
- /* songs always need a master bus */
- bse_song_ensure_master_bus (item);
+ Bse::SongH song = Bse::SongH::down_cast (bse_server.from_proxy (item));
+ song.ensure_track_links(); // fixup orphaned parts
+ song.ensure_master_bus(); // songs always need a master bus
}
}
if (error == 0 && apply_project_file_name)
@@ -48,10 +47,9 @@ bst_project_import_midi_file (Bse::ProjectH project, const gchar *file_name)
SfiProxy item = items[i].proxy_id();
if (BSE_IS_SONG (item))
{
- /* fixup orphaned parts */
- bse_song_ensure_track_links (item);
- /* songs always need a master bus */
- bse_song_ensure_master_bus (item);
+ Bse::SongH song = Bse::SongH::down_cast (bse_server.from_proxy (item));
+ song.ensure_track_links(); // fixup orphaned parts
+ song.ensure_master_bus(); // songs always need a master bus
}
}
return error;
diff --git a/beast-gtk/bstbusmixer.cc b/beast-gtk/bstbusmixer.cc
index 45718fd..ed35e04 100644
--- a/beast-gtk/bstbusmixer.cc
+++ b/beast-gtk/bstbusmixer.cc
@@ -188,7 +188,7 @@ bus_mixer_action_exec (gpointer data,
{
BstBusEditor *be = BST_BUS_EDITOR (GTK_CONTAINER (self->hbox)->focus_child);
Bse::BusH bus = Bse::BusH::down_cast (bse_server.from_proxy (be->item));
- if ((SfiProxy) bus.proxy_id() != bse_song_get_master_bus (song.proxy_id()))
+ if (bus != song.get_master_bus())
song.remove_bus (bus);
}
break;
@@ -203,7 +203,7 @@ bus_mixer_action_check (gpointer data,
{
BstBusMixer *self = BST_BUS_MIXER (data);
BstItemView *iview = BST_ITEM_VIEW (self);
- SfiProxy song = iview->container;
+ Bse::SongH song = Bse::SongH::down_cast (bse_server.from_proxy (iview->container));
switch (action)
{
case ACTION_ADD_BUS:
@@ -212,7 +212,7 @@ bus_mixer_action_check (gpointer data,
if (self->hbox && BST_IS_BUS_EDITOR (GTK_CONTAINER (self->hbox)->focus_child))
{
BstBusEditor *be = BST_BUS_EDITOR (GTK_CONTAINER (self->hbox)->focus_child);
- if (be->item != bse_song_get_master_bus (song))
+ if (be->item && be->item != song.get_master_bus().proxy_id())
return TRUE;
}
return FALSE;
diff --git a/beast-gtk/bstpianorollctrl.cc b/beast-gtk/bstpianorollctrl.cc
index 3753516..2a94d54 100644
--- a/beast-gtk/bstpianorollctrl.cc
+++ b/beast-gtk/bstpianorollctrl.cc
@@ -894,9 +894,15 @@ controller_piano_drag (BstPianoRollController *self,
BstPianoRollDrag *drag)
{
Bse::PartH part = self->proll->part;
- SfiProxy song = bse_item_get_parent (part.proxy_id());
- SfiProxy projectid = song ? bse_item_get_parent (song) : 0;
- SfiProxy track = song ? bse_song_find_track_for_part (song, part.proxy_id()) : 0;
+ SfiProxy song_proxy = bse_item_get_parent (part.proxy_id());
+ SfiProxy projectid = song_proxy ? bse_item_get_parent (song_proxy) : 0;
+ Bse::SongH song;
+ Bse::TrackH track;
+ if (song_proxy)
+ {
+ song = Bse::SongH::down_cast (bse_server.from_proxy (song_proxy));
+ track = song.find_track_for_part (part);
+ }
// printerr ("piano drag event, note=%d (valid=%d)", drag->current_note, drag->current_valid);
@@ -913,7 +919,7 @@ controller_piano_drag (BstPianoRollController *self,
error = project.activate();
self->obj_note = drag->current_note;
if (error == Bse::Error::NONE)
- bse_song_synthesize_note (song, track, 384 * 4, self->obj_note, 0, 1.0);
+ song.synthesize_note (track, 384 * 4, self->obj_note, 0, 1.0);
bst_status_eprintf (error, _("Play note"));
drag->state = GXK_DRAG_CONTINUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]