Add method to check if Session is empty

Empty means that it contains some tracks or user-addedd
busses or VCA (not counting master, monitor, surround busses).

This is motivated by A&H control-surface.
This commit is contained in:
Robin Gareus
2026-01-06 00:03:05 +01:00
parent dc7a95c54f
commit 30d97eb92d
3 changed files with 16 additions and 0 deletions

View File

@@ -359,6 +359,7 @@ public:
uint32_t ntracks () const;
uint32_t naudiotracks () const;
uint32_t nbusses () const;
bool empty () const;
bool plot_process_graph (std::string const& file_name) const;

View File

@@ -3146,6 +3146,7 @@ LuaBindings::common (lua_State* L)
.addFunction ("name", &Session::name)
.addFunction ("path", &Session::path)
.addFunction ("uuid", &Session::uuid)
.addFunction ("empty", &Session::empty)
.addFunction ("record_status", &Session::record_status)
.addFunction ("maybe_enable_record", &Session::maybe_enable_record)
.addFunction ("disable_record", &Session::disable_record)

View File

@@ -6736,6 +6736,20 @@ Session::nstripables (bool with_monitor) const
return rv;
}
bool
Session::empty() const
{
StripableList sl;
get_stripables (sl);
for (auto const& s: sl) {
if (s->is_singleton ()) {
continue;
}
return false;
}
return true;
}
bool
Session::plot_process_graph (std::string const& file_name) const {
return _graph_chain ? _graph_chain->plot (file_name) : false;