Move audio fade threads to generic _helperThreads of macro

This will allow waiting for and stopping audio fades when calling Stop()
for a particular macro
This commit is contained in:
WarmUpTill
2022-03-01 21:32:30 +01:00
committed by WarmUpTill
parent 7095f4668c
commit e1bacd75b6
4 changed files with 30 additions and 33 deletions

View File

@@ -16,7 +16,6 @@ enum class AudioAction {
class MacroActionAudio : public MacroAction {
public:
MacroActionAudio(Macro *m) : MacroAction(m) {}
virtual ~MacroActionAudio();
bool PerformAction();
void LogAction();
bool Save(obs_data_t *obj);
@@ -40,7 +39,6 @@ private:
void StartMasterFade();
void FadeSourceVolume();
void FadeMasterVolume();
std::thread _fadeThread;
static bool _registered;
static const std::string id;

View File

@@ -88,6 +88,7 @@ public:
bool MatchOnChange() { return _matchOnChange; }
int GetCount() { return _count; };
void ResetCount() { _count = 0; };
void AddHelperThread(std::thread &&);
bool GetStop() { return _stop; }
void Stop();
std::deque<std::shared_ptr<MacroCondition>> &Conditions()
@@ -136,7 +137,8 @@ private:
bool _die = false;
bool _stop = false;
bool _done = true;
std::thread _thread;
std::thread _backgroundThread;
std::vector<std::thread> _helperThreads;
};
Macro *GetMacroByName(const char *name);