mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 02:40:00 +01:00
New mechanism for source update with callbacks
Similarly to Node update callbacks, sources now have SourceCallbacks called at the start of each update. Several SourceCallback are implemented to ensure thread safe update of more complex properties (mixing alpha, depth, etc.).
This commit is contained in:
10
Mixer.cpp
10
Mixer.cpp
@@ -831,14 +831,12 @@ void Mixer::setCurrentSource(Source *s)
|
||||
setCurrentSource( session_->find(s) );
|
||||
}
|
||||
|
||||
|
||||
Source *Mixer::sourceAtIndex (int index)
|
||||
{
|
||||
SourceList::iterator s = session_->at(index);
|
||||
if (s!=session_->end())
|
||||
return *s;
|
||||
else
|
||||
return nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Mixer::setCurrentIndex(int index)
|
||||
@@ -1143,7 +1141,7 @@ void Mixer::merge(SessionSource *source)
|
||||
SourceList::iterator it = to_be_moved.begin();
|
||||
for (; it != to_be_moved.end(); ++it) {
|
||||
float scale_depth = (MAX_DEPTH-(*it)->depth()) / (MAX_DEPTH-next_depth);
|
||||
(*it)->setDepth( (*it)->depth() + scale_depth );
|
||||
(*it)->call( new SetDepth( (*it)->depth() + scale_depth ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1155,10 +1153,10 @@ void Mixer::merge(SessionSource *source)
|
||||
renameSource(s);
|
||||
|
||||
// scale alpha
|
||||
s->setAlpha( s->alpha() * source->alpha() );
|
||||
s->call( new SetAlpha(s->alpha() * source->alpha()));
|
||||
|
||||
// set depth (proportional to depth of s, adjusted by needed space)
|
||||
s->setDepth( target_depth + ( (s->depth()-start_depth)/ need_depth) );
|
||||
s->call( new SetDepth( target_depth + ( (s->depth()-start_depth)/ need_depth) ) );
|
||||
|
||||
// set location
|
||||
// a. transform of node to import
|
||||
|
||||
Reference in New Issue
Block a user