yuzu-emu
/
yuzu
Archived
1
0
Fork 0

"AudioRenderer" thread should have a unique name

Creating multiple "AudioRenderer" threads cause the previous thread to be overwritten. The thread will name be renamed to AudioRenderer-InstanceX, where X is the current instance number.
This commit is contained in:
David Marcec 2019-07-13 01:22:08 +10:00
parent bb67091c77
commit 73b37886c1
4 changed files with 8 additions and 7 deletions

View File

@ -73,13 +73,14 @@ private:
EffectInStatus info{}; EffectInStatus info{};
}; };
AudioRenderer::AudioRenderer(Core::Timing::CoreTiming& core_timing, AudioRendererParameter params, AudioRenderer::AudioRenderer(Core::Timing::CoreTiming& core_timing, AudioRendererParameter params,
Kernel::SharedPtr<Kernel::WritableEvent> buffer_event) Kernel::SharedPtr<Kernel::WritableEvent> buffer_event,
const std::size_t instance_number)
: worker_params{params}, buffer_event{buffer_event}, voices(params.voice_count), : worker_params{params}, buffer_event{buffer_event}, voices(params.voice_count),
effects(params.effect_count) { effects(params.effect_count) {
audio_out = std::make_unique<AudioCore::AudioOut>(); audio_out = std::make_unique<AudioCore::AudioOut>();
stream = audio_out->OpenStream(core_timing, STREAM_SAMPLE_RATE, STREAM_NUM_CHANNELS, stream = audio_out->OpenStream(core_timing, STREAM_SAMPLE_RATE, STREAM_NUM_CHANNELS,
"AudioRenderer", [=]() { buffer_event->Signal(); }); fmt::format("AudioRenderer-Instance{}", instance_number), [=]() { buffer_event->Signal(); });
audio_out->StartStream(stream); audio_out->StartStream(stream);
QueueMixedBuffer(0); QueueMixedBuffer(0);

View File

@ -215,7 +215,7 @@ static_assert(sizeof(UpdateDataHeader) == 0x40, "UpdateDataHeader has wrong size
class AudioRenderer { class AudioRenderer {
public: public:
AudioRenderer(Core::Timing::CoreTiming& core_timing, AudioRendererParameter params, AudioRenderer(Core::Timing::CoreTiming& core_timing, AudioRendererParameter params,
Kernel::SharedPtr<Kernel::WritableEvent> buffer_event); Kernel::SharedPtr<Kernel::WritableEvent> buffer_event, const std::size_t instance_number);
~AudioRenderer(); ~AudioRenderer();
std::vector<u8> UpdateAudioRenderer(const std::vector<u8>& input_params); std::vector<u8> UpdateAudioRenderer(const std::vector<u8>& input_params);

View File

@ -25,7 +25,7 @@ namespace Service::Audio {
class IAudioRenderer final : public ServiceFramework<IAudioRenderer> { class IAudioRenderer final : public ServiceFramework<IAudioRenderer> {
public: public:
explicit IAudioRenderer(AudioCore::AudioRendererParameter audren_params) explicit IAudioRenderer(AudioCore::AudioRendererParameter audren_params, const std::size_t instance_number)
: ServiceFramework("IAudioRenderer") { : ServiceFramework("IAudioRenderer") {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
@ -48,8 +48,7 @@ public:
auto& system = Core::System::GetInstance(); auto& system = Core::System::GetInstance();
system_event = Kernel::WritableEvent::CreateEventPair( system_event = Kernel::WritableEvent::CreateEventPair(
system.Kernel(), Kernel::ResetType::Manual, "IAudioRenderer:SystemEvent"); system.Kernel(), Kernel::ResetType::Manual, "IAudioRenderer:SystemEvent");
renderer = std::make_unique<AudioCore::AudioRenderer>(system.CoreTiming(), audren_params, renderer = std::make_unique<AudioCore::AudioRenderer>(system.CoreTiming(), audren_params, system_event.writable, instance_number);
system_event.writable);
} }
private: private:
@ -607,7 +606,7 @@ void AudRenU::OpenAudioRendererImpl(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IAudioRenderer>(params); rb.PushIpcInterface<IAudioRenderer>(params, audren_instance_count++);
} }
bool AudRenU::IsFeatureSupported(AudioFeatures feature, u32_le revision) const { bool AudRenU::IsFeatureSupported(AudioFeatures feature, u32_le revision) const {

View File

@ -33,6 +33,7 @@ private:
}; };
bool IsFeatureSupported(AudioFeatures feature, u32_le revision) const; bool IsFeatureSupported(AudioFeatures feature, u32_le revision) const;
std::size_t audren_instance_count = 0;
}; };
} // namespace Service::Audio } // namespace Service::Audio