Input Mapping for Batch of Sources

Session contains a set of 'Batch' that are created in the Player (renamed from PlayGroups). Session InputCallback can now target either a Source or a Batch, using std::variant (new type Target). Input Mapping reacts to input to create callbacks to a target, either a single source (as before) or to a Batch (multiple sources).
This commit is contained in:
Bruno Herbelin
2023-02-05 17:05:29 +01:00
parent 1e9f8d707e
commit c5cb635b4e
9 changed files with 297 additions and 166 deletions

View File

@@ -2,6 +2,7 @@
#define SESSION_H
#include <mutex>
#include <variant>
#include "SourceList.h"
#include "RenderView.h"
@@ -153,25 +154,25 @@ public:
void applySnapshot(uint64_t key);
// playlists
void addPlayGroup(const SourceIdList &ids);
void deletePlayGroup(size_t i);
size_t numPlayGroups() const;
SourceList playGroup(size_t i) const;
void addToPlayGroup(size_t i, Source *s);
void removeFromPlayGroup(size_t i, Source *s);
std::vector<SourceIdList> getPlayGroups() { return play_groups_; }
void addBatch(const SourceIdList &ids);
void deleteBatch(size_t i);
size_t numBatch() const;
SourceList getBatch(size_t i) const;
void addSourceToBatch(size_t i, Source *s);
void removeSourceFromBatch(size_t i, Source *s);
std::vector<SourceIdList> getAllBatch() { return batch_; }
// 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 ();
void assignInputCallback(uint input, Target target, SourceCallback *callback);
std::list< std::pair<Target, SourceCallback*> > getSourceCallbacks(uint input);
void deleteInputCallback (SourceCallback *callback);
void deleteInputCallbacks(Target target);
void deleteInputCallbacks(uint input);
void clearInputCallbacks ();
std::list<uint> assignedInputs();
bool inputAssigned(uint input);
void swapSourceCallback(uint from, uint to);
void copySourceCallback(uint from, uint to);
void swapInputCallback(uint from, uint to);
void copyInputCallback(uint from, uint to);
void setInputSynchrony(uint input, Metronome::Synchronicity sync);
std::vector<Metronome::Synchronicity> getInputSynchrony();
@@ -190,7 +191,7 @@ protected:
std::list<MixingGroup *> mixing_groups_;
std::map<View::Mode, Group*> config_;
SessionSnapshots snapshots_;
std::vector<SourceIdList> play_groups_;
std::vector<SourceIdList> batch_;
std::mutex access_;
FrameBufferImage *thumbnail_;
uint64_t start_time_;
@@ -216,14 +217,14 @@ protected:
struct InputSourceCallback {
bool active_;
SourceCallback *model_;
SourceCallback *reverse_;
Source *source_;
std::map<uint64_t, SourceCallback *> reverse_;
Target target_;
InputSourceCallback() {
active_ = false;
model_ = nullptr;
reverse_ = nullptr;
source_ = nullptr;
target_ = nullptr;
}
void clearReverse();
};
std::multimap<uint, InputSourceCallback> input_callbacks_;
std::vector<Metronome::Synchronicity> input_sync_;