summaryrefslogtreecommitdiffstats
path: root/src/audio_core
diff options
context:
space:
mode:
authorDavid Marcec <dmarcecguzman@gmail.com>2020-04-22 05:12:58 +0200
committerbunnei <bunneidev@gmail.com>2020-05-11 18:56:15 +0200
commitc4e7ec7a996d49517852d1f5d46160cfc2bd6032 (patch)
treedcf8868263f8c3242c32950b9d55970bf2547f4c /src/audio_core
parentaudio_renderer: Better voice mixing and 6 channel downmixing (diff)
downloadyuzu-c4e7ec7a996d49517852d1f5d46160cfc2bd6032.tar
yuzu-c4e7ec7a996d49517852d1f5d46160cfc2bd6032.tar.gz
yuzu-c4e7ec7a996d49517852d1f5d46160cfc2bd6032.tar.bz2
yuzu-c4e7ec7a996d49517852d1f5d46160cfc2bd6032.tar.lz
yuzu-c4e7ec7a996d49517852d1f5d46160cfc2bd6032.tar.xz
yuzu-c4e7ec7a996d49517852d1f5d46160cfc2bd6032.tar.zst
yuzu-c4e7ec7a996d49517852d1f5d46160cfc2bd6032.zip
Diffstat (limited to 'src/audio_core')
-rw-r--r--src/audio_core/audio_renderer.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/audio_core/audio_renderer.cpp b/src/audio_core/audio_renderer.cpp
index f54ce48c5..fc6e70f6b 100644
--- a/src/audio_core/audio_renderer.cpp
+++ b/src/audio_core/audio_renderer.cpp
@@ -17,7 +17,7 @@ namespace AudioCore {
constexpr u32 STREAM_SAMPLE_RATE{48000};
constexpr u32 STREAM_NUM_CHANNELS{2};
-
+using VoiceChannelHolder = std::array<VoiceResourceInformation*, 6>;
class AudioRenderer::VoiceState {
public:
bool IsPlaying() const {
@@ -38,10 +38,9 @@ public:
void SetWaveIndex(std::size_t index);
std::vector<s16> DequeueSamples(std::size_t sample_count, Core::Memory::Memory& memory,
- std::array<VoiceResourceInformation*, 6> voice_resources);
+ const VoiceChannelHolder& voice_resources);
void UpdateState();
- void RefreshBuffer(Core::Memory::Memory& memory,
- std::array<VoiceResourceInformation*, 6> voice_resources);
+ void RefreshBuffer(Core::Memory::Memory& memory, const VoiceChannelHolder& voice_resources);
private:
bool is_in_use{};
@@ -230,7 +229,7 @@ void AudioRenderer::VoiceState::SetWaveIndex(std::size_t index) {
std::vector<s16> AudioRenderer::VoiceState::DequeueSamples(
std::size_t sample_count, Core::Memory::Memory& memory,
- std::array<VoiceResourceInformation*, 6> voice_resources) {
+ const VoiceChannelHolder& voice_resources) {
if (!IsPlaying()) {
return {};
}
@@ -280,8 +279,8 @@ void AudioRenderer::VoiceState::UpdateState() {
is_in_use = info.is_in_use;
}
-void AudioRenderer::VoiceState::RefreshBuffer(
- Core::Memory::Memory& memory, std::array<VoiceResourceInformation*, 6> voice_resources) {
+void AudioRenderer::VoiceState::RefreshBuffer(Core::Memory::Memory& memory,
+ const VoiceChannelHolder& voice_resources) {
const auto wave_buffer_address = info.wave_buffer[wave_index].buffer_addr;
const auto wave_buffer_size = info.wave_buffer[wave_index].buffer_sz;
std::vector<s16> new_samples(wave_buffer_size / sizeof(s16));
@@ -420,7 +419,7 @@ void AudioRenderer::QueueMixedBuffer(Buffer::Tag tag) {
if (!voice.IsPlaying()) {
continue;
}
- std::array<VoiceResourceInformation*, 6> resources{};
+ VoiceChannelHolder resources{};
for (u32 channel = 0; channel < voice.GetInfo().channel_count; channel++) {
const auto channel_resource_id = voice.GetInfo().voice_channel_resource_ids[channel];
resources[channel] = &voice_resources[channel_resource_id];