mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-27 01:02:48 +01:00
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
1 changed files with 2 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue