Reimplementation of SourceInputCallbacks into Session

Session should be the object holding the list of inputs parameters (e.g. synchrony) and the list of source callbacks. This also avoids mixing input when copying sources.  Code could be improved but is operational.
This commit is contained in:
Bruno Herbelin
2022-03-07 00:23:24 +01:00
parent 83e77681d9
commit 39b61fe331
18 changed files with 689 additions and 478 deletions

View File

@@ -5,6 +5,7 @@
#include "SourceList.h"
#include "RenderView.h"
#include "Metronome.h"
namespace tinyxml2 {
class XMLDocument;
@@ -151,6 +152,22 @@ public:
void removeFromPlayGroup(size_t i, Source *s);
std::vector<SourceIdList> getPlayGroups() { return play_groups_; }
// callbacks associated to inputs
void assignSourceCallback(uint input, Source *source, SourceCallback *callback);
std::list< std::pair<Source *, SourceCallback*> > getSourceCallbacks(uint input);
void deleteSourceCallback (SourceCallback *callback);
void deleteSourceCallbacks(Source *source);
void deleteSourceCallbacks(uint input);
void clearSourceCallbacks ();
std::list<uint> assignedInputs();
bool inputAssigned(uint input);
void swapSourceCallback(uint from, uint to);
void copySourceCallback(uint from, uint to);
void setInputSynchrony(uint input, Metronome::Synchronicity sync);
std::vector<Metronome::Synchronicity> getInputSynchrony();
Metronome::Synchronicity inputSynchrony(uint input);
protected:
bool active_;
float activation_threshold_;
@@ -186,7 +203,20 @@ protected:
};
Fading fading_;
// std::map<uint64_t,
struct InputSourceCallback {
bool active_;
SourceCallback *model_;
SourceCallback *reverse_;
Source *source_;
InputSourceCallback() {
active_ = false;
model_ = nullptr;
reverse_ = nullptr;
source_ = nullptr;
}
};
std::multimap<uint, InputSourceCallback> input_callbacks_;
std::vector<Metronome::Synchronicity> input_sync_;
};