summaryrefslogtreecommitdiff
path: root/src/audio_core/voice_context.h
diff options
context:
space:
mode:
authorGravatar Kelebek12021-06-26 23:04:40 +0100
committerGravatar Kelebek12021-07-01 06:01:01 +0100
commitb455043e45737345fe73d118947db1684bd248ea (patch)
treec05414e81eff4b012bd1b33076fb60da16aace54 /src/audio_core/voice_context.h
parentDecouple audio processing and run at variable rate (diff)
downloadyuzu-b455043e45737345fe73d118947db1684bd248ea.tar.gz
yuzu-b455043e45737345fe73d118947db1684bd248ea.tar.xz
yuzu-b455043e45737345fe73d118947db1684bd248ea.zip
Fix XC2/VOEZ crashing, add audio looping and a few misc fixes
Diffstat (limited to 'src/audio_core/voice_context.h')
-rw-r--r--src/audio_core/voice_context.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/audio_core/voice_context.h b/src/audio_core/voice_context.h
index 70359cadb..e1050897b 100644
--- a/src/audio_core/voice_context.h
+++ b/src/audio_core/voice_context.h
@@ -60,10 +60,12 @@ struct WaveBuffer {
60 u8 is_looping{}; 60 u8 is_looping{};
61 u8 end_of_stream{}; 61 u8 end_of_stream{};
62 u8 sent_to_server{}; 62 u8 sent_to_server{};
63 INSERT_PADDING_BYTES(5); 63 INSERT_PADDING_BYTES(1);
64 s32 loop_count{};
64 u64 context_address{}; 65 u64 context_address{};
65 u64 context_size{}; 66 u64 context_size{};
66 INSERT_PADDING_BYTES(8); 67 u32 loop_start_sample{};
68 u32 loop_end_sample{};
67}; 69};
68static_assert(sizeof(WaveBuffer) == 0x38, "WaveBuffer is an invalid size"); 70static_assert(sizeof(WaveBuffer) == 0x38, "WaveBuffer is an invalid size");
69 71
@@ -76,6 +78,9 @@ struct ServerWaveBuffer {
76 bool end_of_stream{}; 78 bool end_of_stream{};
77 VAddr context_address{}; 79 VAddr context_address{};
78 std::size_t context_size{}; 80 std::size_t context_size{};
81 s32 loop_count{};
82 u32 loop_start_sample{};
83 u32 loop_end_sample{};
79 bool sent_to_dsp{true}; 84 bool sent_to_dsp{true};
80}; 85};
81 86
@@ -108,6 +113,7 @@ struct VoiceState {
108 u32 external_context_size; 113 u32 external_context_size;
109 bool is_external_context_used; 114 bool is_external_context_used;
110 bool voice_dropped; 115 bool voice_dropped;
116 s32 loop_count;
111}; 117};
112 118
113class VoiceChannelResource { 119class VoiceChannelResource {
@@ -206,7 +212,7 @@ public:
206 float last_volume{}; 212 float last_volume{};
207 std::array<BiquadFilterParameter, AudioCommon::MAX_BIQUAD_FILTERS> biquad_filter{}; 213 std::array<BiquadFilterParameter, AudioCommon::MAX_BIQUAD_FILTERS> biquad_filter{};
208 s32 wave_buffer_count{}; 214 s32 wave_buffer_count{};
209 s16 wave_bufffer_head{}; 215 s16 wave_buffer_head{};
210 INSERT_PADDING_BYTES(2); 216 INSERT_PADDING_BYTES(2);
211 BehaviorFlags behavior_flags{}; 217 BehaviorFlags behavior_flags{};
212 VAddr additional_params_address{}; 218 VAddr additional_params_address{};
@@ -252,6 +258,7 @@ public:
252 void FlushWaveBuffers(u8 flush_count, 258 void FlushWaveBuffers(u8 flush_count,
253 std::array<VoiceState*, AudioCommon::MAX_CHANNEL_COUNT>& dsp_voice_states, 259 std::array<VoiceState*, AudioCommon::MAX_CHANNEL_COUNT>& dsp_voice_states,
254 s32 channel_count); 260 s32 channel_count);
261 void SetWaveBufferCompleted(VoiceState& dsp_state, const ServerWaveBuffer& wave_buffer);
255 262
256private: 263private:
257 std::vector<s16> stored_samples; 264 std::vector<s16> stored_samples;