BugFix Session Group init and playable status.

Improved logs
This commit is contained in:
Bruno Herbelin
2022-04-09 14:45:12 +02:00
parent 8fef0052a3
commit dd55f41264
3 changed files with 39 additions and 13 deletions

View File

@@ -784,11 +784,12 @@ void Mixer::groupAll()
addSource(sessiongroup); addSource(sessiongroup);
// inform of creation // inform of creation
Log::Info("%s Source '%s' created (%d sources groupped)", sessiongroup->info().c_str(), sessiongroup->name().c_str(), sessiongroup->session()->size()); Log::Info("%s '%s' created with %d sources", sessiongroup->info().c_str(),
sessiongroup->name().c_str(), sessiongroup->session()->size());
} }
else { else {
delete sessiongroup; delete sessiongroup;
Log::Info("Failed to group all sources."); Log::Info("Failed to group all sources");
} }
} }
@@ -1395,7 +1396,9 @@ void Mixer::swap()
Action::manager().init(); Action::manager().init();
// notification // notification
Log::Notify("Session %s loaded. %d source(s) created.", session_->filename().c_str(), session_->size()); uint N = session_->numSources();
std::string numsource = ( N>0 ? std::to_string(N) : "No" ) + " source" + (N>1 ? "s" : "");
Log::Notify("Session %s loaded. %s created.", session_->filename().c_str(), numsource.c_str());
} }
void Mixer::close(bool smooth) void Mixer::close(bool smooth)

View File

@@ -48,8 +48,8 @@ SessionSource::SessionSource(uint64_t id) : Source(id), failed_(false), timer_(0
frame->color = glm::vec4( COLOR_DEFAULT_SOURCE, 0.95f); frame->color = glm::vec4( COLOR_DEFAULT_SOURCE, 0.95f);
group->attach(frame); group->attach(frame);
frame = new Frame(Frame::ROUND, Frame::THIN, Frame::DROP); frame = new Frame(Frame::ROUND, Frame::THIN, Frame::DROP);
frame->scale_.x = 1.05; frame->scale_.x = 1.04;
frame->scale_.y = 1.1; frame->scale_.y = 1.07;
frame->translation_.z = 0.1; frame->translation_.z = 0.1;
frame->color = glm::vec4( COLOR_DEFAULT_SOURCE, 0.95f); frame->color = glm::vec4( COLOR_DEFAULT_SOURCE, 0.95f);
group->attach(frame); group->attach(frame);
@@ -59,9 +59,9 @@ SessionSource::SessionSource(uint64_t id) : Source(id), failed_(false), timer_(0
frame->translation_.z = 0.01; frame->translation_.z = 0.01;
frame->color = glm::vec4( COLOR_HIGHLIGHT_SOURCE, 1.f); frame->color = glm::vec4( COLOR_HIGHLIGHT_SOURCE, 1.f);
group->attach(frame); group->attach(frame);
frame = new Frame(Frame::ROUND, Frame::LARGE, Frame::DROP); frame = new Frame(Frame::ROUND, Frame::THIN, Frame::DROP);
frame->scale_.x = 1.05; frame->scale_.x = 1.04;
frame->scale_.y = 1.1; frame->scale_.y = 1.07;
frame->translation_.z = 0.01; frame->translation_.z = 0.01;
frame->color = glm::vec4( COLOR_HIGHLIGHT_SOURCE, 1.f); frame->color = glm::vec4( COLOR_HIGHLIGHT_SOURCE, 1.f);
group->attach(frame); group->attach(frame);
@@ -190,6 +190,20 @@ void SessionSource::replay ()
} }
} }
bool SessionSource::playable () const
{
bool p = false;
if (session_) {
for( SourceList::iterator it = session_->begin(); it != session_->end(); ++it) {
if ( (*it)->playable() ){
p = true;
break;
}
}
}
return p;
}
SessionFileSource::SessionFileSource(uint64_t id) : SessionSource(id), path_(""), initialized_(false), wait_for_sources_(false) SessionFileSource::SessionFileSource(uint64_t id) : SessionSource(id), path_(""), initialized_(false), wait_for_sources_(false)
{ {
// specific node for transition view // specific node for transition view
@@ -245,7 +259,7 @@ void SessionFileSource::load(const std::string &p, uint level)
else { else {
// launch a thread to load the session file // launch a thread to load the session file
sessionLoader_ = std::async(std::launch::async, Session::load, path_, level); sessionLoader_ = std::async(std::launch::async, Session::load, path_, level);
Log::Notify("Opening %s", p.c_str()); Log::Notify("Opening '%s'...", p.c_str());
} }
// will be ready after init and one frame rendered // will be ready after init and one frame rendered
@@ -272,6 +286,9 @@ void SessionFileSource::init()
active_ = true; active_ = true;
touch(); touch();
// deep update to make sure reordering of sources
++View::need_deep_update_;
// update to draw framebuffer // update to draw framebuffer
session_->update(dt_); session_->update(dt_);
@@ -366,8 +383,12 @@ void SessionGroupSource::init()
{ {
if ( resolution_.x > 0.f && resolution_.y > 0.f ) { if ( resolution_.x > 0.f && resolution_.y > 0.f ) {
// valid resolution given to create render view
session_->setResolution( resolution_ ); session_->setResolution( resolution_ );
// deep update to make sure reordering of sources
++View::need_deep_update_;
// update to draw framebuffer // update to draw framebuffer
session_->update( dt_ ); session_->update( dt_ );
@@ -380,11 +401,13 @@ void SessionGroupSource::init()
// set the renderbuffer of the source and attach rendering nodes // set the renderbuffer of the source and attach rendering nodes
attach(renderbuffer); attach(renderbuffer);
// deep update to reorder // render the session frame into frame buffer immediately (avoids 1 frame blank)
++View::need_deep_update_; renderbuffer_->begin();
texturesurface_->draw(glm::identity<glm::mat4>(), renderbuffer_->projection());
renderbuffer_->end();
// done init // done init
Log::Info("Source Group created (%d x %d).", int(renderbuffer->resolution().x), int(renderbuffer->resolution().y) ); Log::Info("Session Group '%s' initialized (%d x %d).", name().c_str(), int(renderbuffer->resolution().x), int(renderbuffer->resolution().y) );
} }
} }

View File

@@ -16,7 +16,7 @@ public:
void setActive (bool on) override; void setActive (bool on) override;
bool playing () const override { return !paused_; } bool playing () const override { return !paused_; }
void play (bool on) override; void play (bool on) override;
bool playable () const override { return true; } bool playable () const override;
guint64 playtime () const override { return timer_; } guint64 playtime () const override { return timer_; }
void replay () override; void replay () override;
bool failed () const override; bool failed () const override;