Skip to content

Commit

Permalink
Fixes for removing / renaming scenes
Browse files Browse the repository at this point in the history
  • Loading branch information
cpyarger committed Jun 2, 2020
1 parent 3e5837f commit 8c5af5a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 26 deletions.
45 changes: 19 additions & 26 deletions midi-agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,33 +518,26 @@ void MidiAgent::NewObsEvent(QString eventType, QString eventData)

}
}
} else if (eventType == QString("SourceDestroyed")) {
std::string from = obs_data_get_string(data, "sourceName");

auto mh = midiHooks;
mh.erase(
std::remove_if(
mh.begin(), mh.end(),
[from, this](const MidiHook *e) {
if (e->param1 == from) {
blog(1,
"deleted hook -- %s -- %s",
e->param1.c_str(),
e->type.c_str());
return e;
}
}),
mh.end());




} else if (eventType == QString("Exiting")) {
closing = true;

}else if (eventType == QString("SourceDestroyed")) {
if (!closing) {
std::string from =
obs_data_get_string(data, "sourceName");

for (unsigned i = 0; i < self->midiHooks.size();
i++) {
if (self->midiHooks.at(i)->param1 ==
from) {
self->RemoveMidiHook(
self->midiHooks.at(i));
self->GetData();
i--;
}
}
GetConfig()->Save();
//GetConfig()->Load();
//GetConfig()->GetConfigStore();



}
}

blog(1, "OBS EVENT- MidiAgent.cpp %s -- %s",
Expand Down
1 change: 1 addition & 0 deletions midi-agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,6 @@ public slots:
bool enabled;
bool connected;
bool bidirectional;
bool closing=false;
vector<MidiHook *> midiHooks;
};

0 comments on commit 8c5af5a

Please sign in to comment.