Sequencer: std::move studio instances in constructor

Avoids an unnecessary atomic reference count increment and decrement
This commit is contained in:
Lioncash 2019-09-10 20:08:36 -04:00
parent 2c75668e0a
commit 1b37122b12
1 changed files with 2 additions and 2 deletions

View File

@ -53,7 +53,7 @@ Sequencer::~Sequencer() {
Sequencer::Sequencer(Engine& engine, const AudioGroup& group, GroupId groupId, const SongGroupIndex* songGroup, Sequencer::Sequencer(Engine& engine, const AudioGroup& group, GroupId groupId, const SongGroupIndex* songGroup,
SongId setupId, ObjToken<Studio> studio) SongId setupId, ObjToken<Studio> studio)
: Entity(engine, group, groupId), m_songGroup(songGroup), m_studio(studio) { : Entity(engine, group, groupId), m_songGroup(songGroup), m_studio(std::move(studio)) {
auto it = m_songGroup->m_midiSetups.find(setupId); auto it = m_songGroup->m_midiSetups.find(setupId);
if (it != m_songGroup->m_midiSetups.cend()) if (it != m_songGroup->m_midiSetups.cend())
m_midiSetup = it->second.data(); m_midiSetup = it->second.data();
@ -61,7 +61,7 @@ Sequencer::Sequencer(Engine& engine, const AudioGroup& group, GroupId groupId, c
Sequencer::Sequencer(Engine& engine, const AudioGroup& group, GroupId groupId, const SFXGroupIndex* sfxGroup, Sequencer::Sequencer(Engine& engine, const AudioGroup& group, GroupId groupId, const SFXGroupIndex* sfxGroup,
ObjToken<Studio> studio) ObjToken<Studio> studio)
: Entity(engine, group, groupId), m_sfxGroup(sfxGroup), m_studio(studio) { : Entity(engine, group, groupId), m_sfxGroup(sfxGroup), m_studio(std::move(studio)) {
std::map<ObjectId, const SFXGroupIndex::SFXEntry*> sortSFX; std::map<ObjectId, const SFXGroupIndex::SFXEntry*> sortSFX;
for (const auto& sfx : sfxGroup->m_sfxEntries) for (const auto& sfx : sfxGroup->m_sfxEntries)
sortSFX[sfx.first] = &sfx.second; sortSFX[sfx.first] = &sfx.second;