Compare commits

...

19 Commits

Author SHA1 Message Date
16-Bit-Dog
21f7bd3ca7 random space 2021-02-06 09:59:00 -05:00
16-Bit-Dog
66578f1ffc more clang
i'm going to love condensing these commits
2021-02-06 09:54:57 -05:00
16-Bit-Dog
8b0b7168a0 clang 2021-02-06 09:49:43 -05:00
16-Bit-Dog
5dc02022c5 more fixes
yes-I will squash all commits, just will do it when all is proper
2021-02-06 09:14:07 -05:00
16-Bit-Dog
e14bfb31bc clang 2021-02-05 22:08:12 -05:00
16-Bit-Dog
5c103f7b01 same as previous commit... 2021-02-05 22:04:33 -05:00
16-Bit-Dog
c5b83ffed8 accidental test code parts I left
yes I will squash these commits... just want to get the errors out of the way
2021-02-05 22:04:05 -05:00
16-Bit-Dog
acc00771d9 sigh... 2021-02-05 21:21:08 -05:00
16-Bit-Dog
ec32cedb61 the alphabet... 2021-02-05 20:35:42 -05:00
16-Bit-Dog
78cd4dae0a this PR will eventually abide by clang formatting... 2021-02-05 20:30:00 -05:00
16-Bit-Dog
9cb42fc08d oh wait, more than 1 thing was wrong; neat 2021-02-05 20:24:53 -05:00
16-Bit-Dog
a9add84a79 clang formatting... 2021-02-05 20:22:32 -05:00
16-Bit-Dog
84a1aad50b ordering ;) 2021-02-05 20:18:52 -05:00
16-Bit-Dog
bad4e3efcf thread from the outdated naming previously used 2021-02-05 20:12:35 -05:00
16-Bit-Dog
724e495724 Update src/audio_core/audio_renderer.cpp
Co-authored-by: LC <mathew1800@gmail.com>
2021-02-05 20:09:50 -05:00
16-Bit-Dog
8063377c1c Merge pull request #2 from 16-Bit-Dog/16-Bit-Dog-patch-2
small asyncronous addition to queue buffer release
2021-02-05 19:46:52 -05:00
16-Bit-Dog
c647ed6af9 small asyncronous addition to queue buffer release
ReleaseAndQueueBuffers is not additive, nor does it rely on previous math from the loop... despite this, the function it calls (GenerateVoiceCommands and GenerateSubMixCommands) both can take a reasonable amount of time to complete; the use of std::async allows (since a thread pool was already previously made) threads to be pulled from the existing pool, and use it to asynchronously process this specific buffer system for minor improvements

I used global lambda copy captures for the reason that the data may not be changed based on previous data, but the variables are still reused

finally, I call .wait() rather than a .get() for the std::future due to the way each works; I don't care to return the result, and nor do I want .get() to do the other more hidden actions it does (which results .get() to be consistently slower when profiled versus .wait())
2021-02-05 19:46:40 -05:00
16-Bit-Dog
cd723659d7 Merge pull request #1 from 16-Bit-Dog/16-Bit-Dog-patch-1
future vector added to audio_renderer.h
2021-02-05 19:31:24 -05:00
16-Bit-Dog
3050e64170 future vector added to audio_renderer.h
vector of futures to use with std::async
2021-02-05 19:29:42 -05:00
2 changed files with 15 additions and 1 deletions

View File

@@ -2,7 +2,9 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <future>
#include <limits>
#include <mutex>
#include <vector>
#include "audio_core/audio_out.h"
@@ -315,9 +317,18 @@ void AudioRenderer::QueueMixedBuffer(Buffer::Tag tag) {
}
void AudioRenderer::ReleaseAndQueueBuffers() {
std::size_t thread_counter = 0;
const auto released_buffers{audio_out->GetTagsAndReleaseBuffers(stream)};
queue_mixed_multithread.resize(released_buffers.size());
for (const auto& tag : released_buffers) {
QueueMixedBuffer(tag);
queue_mixed_multithread[thread_counter] =
std::async(std::launch::async, [this, tag, voice_context = voice_context,
splitter_context = splitter_context,
mix_context = mix_context] { QueueMixedBuffer(tag); });
thread_counter++;
}
for (std::size_t thread = 0; thread < released_buffers.size(); thread++) {
queue_mixed_multithread[thread].wait();
}
}

View File

@@ -5,7 +5,9 @@
#pragma once
#include <array>
#include <future>
#include <memory>
#include <mutex>
#include <vector>
#include "audio_core/behavior_info.h"
@@ -68,6 +70,7 @@ private:
Core::Memory::Memory& memory;
CommandGenerator command_generator;
std::size_t elapsed_frame_count{};
std::vector<std::future<void>> queue_mixed_multithread;
};
} // namespace AudioCore