diff options
Diffstat (limited to 'src/audio_core/audio_renderer.h')
| -rw-r--r-- | src/audio_core/audio_renderer.h | 51 |
1 files changed, 12 insertions, 39 deletions
diff --git a/src/audio_core/audio_renderer.h b/src/audio_core/audio_renderer.h index 6d069d693..2c4f5ab75 100644 --- a/src/audio_core/audio_renderer.h +++ b/src/audio_core/audio_renderer.h | |||
| @@ -8,16 +8,20 @@ | |||
| 8 | #include <memory> | 8 | #include <memory> |
| 9 | #include <vector> | 9 | #include <vector> |
| 10 | 10 | ||
| 11 | #include "audio_core/algorithm/interpolate.h" | ||
| 12 | #include "audio_core/audio_out.h" | ||
| 13 | #include "audio_core/codec.h" | ||
| 14 | #include "audio_core/stream.h" | 11 | #include "audio_core/stream.h" |
| 12 | #include "common/common_funcs.h" | ||
| 15 | #include "common/common_types.h" | 13 | #include "common/common_types.h" |
| 16 | #include "common/swap.h" | 14 | #include "common/swap.h" |
| 17 | #include "core/hle/kernel/event.h" | 15 | #include "core/hle/kernel/object.h" |
| 16 | |||
| 17 | namespace Kernel { | ||
| 18 | class Event; | ||
| 19 | } | ||
| 18 | 20 | ||
| 19 | namespace AudioCore { | 21 | namespace AudioCore { |
| 20 | 22 | ||
| 23 | class AudioOut; | ||
| 24 | |||
| 21 | enum class PlayState : u8 { | 25 | enum class PlayState : u8 { |
| 22 | Started = 0, | 26 | Started = 0, |
| 23 | Stopped = 1, | 27 | Stopped = 1, |
| @@ -158,6 +162,8 @@ static_assert(sizeof(UpdateDataHeader) == 0x40, "UpdateDataHeader has wrong size | |||
| 158 | class AudioRenderer { | 162 | class AudioRenderer { |
| 159 | public: | 163 | public: |
| 160 | AudioRenderer(AudioRendererParameter params, Kernel::SharedPtr<Kernel::Event> buffer_event); | 164 | AudioRenderer(AudioRendererParameter params, Kernel::SharedPtr<Kernel::Event> buffer_event); |
| 165 | ~AudioRenderer(); | ||
| 166 | |||
| 161 | std::vector<u8> UpdateAudioRenderer(const std::vector<u8>& input_params); | 167 | std::vector<u8> UpdateAudioRenderer(const std::vector<u8>& input_params); |
| 162 | void QueueMixedBuffer(Buffer::Tag tag); | 168 | void QueueMixedBuffer(Buffer::Tag tag); |
| 163 | void ReleaseAndQueueBuffers(); | 169 | void ReleaseAndQueueBuffers(); |
| @@ -166,45 +172,12 @@ public: | |||
| 166 | u32 GetMixBufferCount() const; | 172 | u32 GetMixBufferCount() const; |
| 167 | 173 | ||
| 168 | private: | 174 | private: |
| 169 | class VoiceState { | 175 | class VoiceState; |
| 170 | public: | ||
| 171 | bool IsPlaying() const { | ||
| 172 | return is_in_use && info.play_state == PlayState::Started; | ||
| 173 | } | ||
| 174 | |||
| 175 | const VoiceOutStatus& GetOutStatus() const { | ||
| 176 | return out_status; | ||
| 177 | } | ||
| 178 | |||
| 179 | const VoiceInfo& GetInfo() const { | ||
| 180 | return info; | ||
| 181 | } | ||
| 182 | |||
| 183 | VoiceInfo& Info() { | ||
| 184 | return info; | ||
| 185 | } | ||
| 186 | |||
| 187 | void SetWaveIndex(size_t index); | ||
| 188 | std::vector<s16> DequeueSamples(size_t sample_count); | ||
| 189 | void UpdateState(); | ||
| 190 | void RefreshBuffer(); | ||
| 191 | |||
| 192 | private: | ||
| 193 | bool is_in_use{}; | ||
| 194 | bool is_refresh_pending{}; | ||
| 195 | size_t wave_index{}; | ||
| 196 | size_t offset{}; | ||
| 197 | Codec::ADPCMState adpcm_state{}; | ||
| 198 | InterpolationState interp_state{}; | ||
| 199 | std::vector<s16> samples; | ||
| 200 | VoiceOutStatus out_status{}; | ||
| 201 | VoiceInfo info{}; | ||
| 202 | }; | ||
| 203 | 176 | ||
| 204 | AudioRendererParameter worker_params; | 177 | AudioRendererParameter worker_params; |
| 205 | Kernel::SharedPtr<Kernel::Event> buffer_event; | 178 | Kernel::SharedPtr<Kernel::Event> buffer_event; |
| 206 | std::vector<VoiceState> voices; | 179 | std::vector<VoiceState> voices; |
| 207 | std::unique_ptr<AudioCore::AudioOut> audio_out; | 180 | std::unique_ptr<AudioOut> audio_out; |
| 208 | AudioCore::StreamPtr stream; | 181 | AudioCore::StreamPtr stream; |
| 209 | }; | 182 | }; |
| 210 | 183 | ||