audio_manager: move std::functions in SetOutManager/SetInManager
Prevents unnecessary reallocations in the event the captured variables are larger than the internal std::function buffer.
This commit is contained in:
parent
da0fd51642
commit
e48e22eb52
|
@ -25,7 +25,7 @@ Result AudioManager::SetOutManager(BufferEventFunc buffer_func) {
|
|||
|
||||
const auto index{events.GetManagerIndex(Event::Type::AudioOutManager)};
|
||||
if (buffer_events[index] == nullptr) {
|
||||
buffer_events[index] = buffer_func;
|
||||
buffer_events[index] = std::move(buffer_func);
|
||||
needs_update = true;
|
||||
events.SetAudioEvent(Event::Type::AudioOutManager, true);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ Result AudioManager::SetInManager(BufferEventFunc buffer_func) {
|
|||
|
||||
const auto index{events.GetManagerIndex(Event::Type::AudioInManager)};
|
||||
if (buffer_events[index] == nullptr) {
|
||||
buffer_events[index] = buffer_func;
|
||||
buffer_events[index] = std::move(buffer_func);
|
||||
needs_update = true;
|
||||
events.SetAudioEvent(Event::Type::AudioInManager, true);
|
||||
}
|
||||
|
|
Reference in New Issue