mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-27 15:15:30 +03:00
Correct audren event handling and zero the sample buffer
Not zeroing the sample buffer causes issues when a voice is started but is playing no samples. The system event handling was also reworked according to Thog's info.
This commit is contained in:
parent
24d086cbec
commit
6329537a9e
@ -6,7 +6,7 @@
|
||||
|
||||
namespace skyline::service::audio::IAudioRenderer {
|
||||
IAudioRenderer::IAudioRenderer(const DeviceState &state, ServiceManager &manager, AudioRendererParameters ¶meters)
|
||||
: releaseEvent(std::make_shared<type::KEvent>(state)), parameters(parameters), BaseService(state, manager, Service::audio_IAudioRenderer, "audio:IAudioRenderer", {
|
||||
: systemEvent(std::make_shared<type::KEvent>(state)), parameters(parameters), BaseService(state, manager, Service::audio_IAudioRenderer, "audio:IAudioRenderer", {
|
||||
{0x0, SFUNC(IAudioRenderer::GetSampleRate)},
|
||||
{0x1, SFUNC(IAudioRenderer::GetSampleCount)},
|
||||
{0x2, SFUNC(IAudioRenderer::GetMixBufferCount)},
|
||||
@ -16,7 +16,7 @@ namespace skyline::service::audio::IAudioRenderer {
|
||||
{0x6, SFUNC(IAudioRenderer::Stop)},
|
||||
{0x7, SFUNC(IAudioRenderer::QuerySystemEvent)},
|
||||
}) {
|
||||
track = state.audio->OpenTrack(constant::ChannelCount, parameters.sampleRate, [this]() { releaseEvent->Signal(); });
|
||||
track = state.audio->OpenTrack(constant::ChannelCount, parameters.sampleRate, []() {});
|
||||
track->Start();
|
||||
|
||||
memoryPools.resize(parameters.effectCount + parameters.voiceCount * 4);
|
||||
@ -80,6 +80,7 @@ namespace skyline::service::audio::IAudioRenderer {
|
||||
effects[i].ProcessInput(effectsIn[i]);
|
||||
|
||||
UpdateAudio();
|
||||
systemEvent->Signal();
|
||||
|
||||
UpdateDataHeader outputHeader{
|
||||
.revision = constant::RevMagic,
|
||||
@ -178,8 +179,8 @@ namespace skyline::service::audio::IAudioRenderer {
|
||||
}
|
||||
|
||||
void IAudioRenderer::QuerySystemEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto handle = state.process->InsertItem(releaseEvent);
|
||||
state.logger->Debug("Audren Buffer Release Event Handle: 0x{:X}", handle);
|
||||
auto handle = state.process->InsertItem(systemEvent);
|
||||
state.logger->Debug("Audren System Event Handle: 0x{:X}", handle);
|
||||
response.copyHandles.push_back(handle);
|
||||
}
|
||||
}
|
||||
|
@ -66,11 +66,11 @@ namespace skyline {
|
||||
AudioRendererParameters parameters; //!< The parameters to use for the renderer
|
||||
RevisionInfo revisionInfo{}; //!< Stores info about supported features for the audren revision used
|
||||
std::shared_ptr<skyline::audio::AudioTrack> track; //!< The audio track associated with the audio renderer
|
||||
std::shared_ptr<type::KEvent> releaseEvent; //!< The KEvent that is signalled when a buffer has been released
|
||||
std::shared_ptr<type::KEvent> systemEvent; //!< The KEvent that is signalled when the DSP has processed all the commands
|
||||
std::vector<MemoryPool> memoryPools; //!< An vector of all memory pools that the guest may need
|
||||
std::vector<Effect> effects; //!< An vector of all effects that the guest may need
|
||||
std::vector<Voice> voices; //!< An vector of all voices that the guest may need
|
||||
std::array<i16, constant::MixBufferSize * constant::ChannelCount> sampleBuffer; //!< The final output data that is appended to the stream
|
||||
std::array<i16, constant::MixBufferSize * constant::ChannelCount> sampleBuffer{}; //!< The final output data that is appended to the stream
|
||||
skyline::audio::AudioOutState playbackState{skyline::audio::AudioOutState::Stopped}; //!< The current state of playback
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user