diff options
Diffstat (limited to 'src/audio_core/hle/dsp.cpp')
| -rw-r--r-- | src/audio_core/hle/dsp.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/audio_core/hle/dsp.cpp b/src/audio_core/hle/dsp.cpp index 4d44bd2d9..0cdbdb06a 100644 --- a/src/audio_core/hle/dsp.cpp +++ b/src/audio_core/hle/dsp.cpp | |||
| @@ -2,10 +2,12 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <array> | ||
| 5 | #include <memory> | 6 | #include <memory> |
| 6 | 7 | ||
| 7 | #include "audio_core/hle/dsp.h" | 8 | #include "audio_core/hle/dsp.h" |
| 8 | #include "audio_core/hle/pipe.h" | 9 | #include "audio_core/hle/pipe.h" |
| 10 | #include "audio_core/hle/source.h" | ||
| 9 | #include "audio_core/sink.h" | 11 | #include "audio_core/sink.h" |
| 10 | 12 | ||
| 11 | namespace DSP { | 13 | namespace DSP { |
| @@ -38,16 +40,38 @@ static SharedMemory& WriteRegion() { | |||
| 38 | return g_regions[1 - CurrentRegionIndex()]; | 40 | return g_regions[1 - CurrentRegionIndex()]; |
| 39 | } | 41 | } |
| 40 | 42 | ||
| 43 | static std::array<Source, num_sources> sources = { | ||
| 44 | Source(0), Source(1), Source(2), Source(3), Source(4), Source(5), | ||
| 45 | Source(6), Source(7), Source(8), Source(9), Source(10), Source(11), | ||
| 46 | Source(12), Source(13), Source(14), Source(15), Source(16), Source(17), | ||
| 47 | Source(18), Source(19), Source(20), Source(21), Source(22), Source(23) | ||
| 48 | }; | ||
| 49 | |||
| 41 | static std::unique_ptr<AudioCore::Sink> sink; | 50 | static std::unique_ptr<AudioCore::Sink> sink; |
| 42 | 51 | ||
| 43 | void Init() { | 52 | void Init() { |
| 44 | DSP::HLE::ResetPipes(); | 53 | DSP::HLE::ResetPipes(); |
| 54 | for (auto& source : sources) { | ||
| 55 | source.Reset(); | ||
| 56 | } | ||
| 45 | } | 57 | } |
| 46 | 58 | ||
| 47 | void Shutdown() { | 59 | void Shutdown() { |
| 48 | } | 60 | } |
| 49 | 61 | ||
| 50 | bool Tick() { | 62 | bool Tick() { |
| 63 | SharedMemory& read = ReadRegion(); | ||
| 64 | SharedMemory& write = WriteRegion(); | ||
| 65 | |||
| 66 | std::array<QuadFrame32, 3> intermediate_mixes = {}; | ||
| 67 | |||
| 68 | for (size_t i = 0; i < num_sources; i++) { | ||
| 69 | write.source_statuses.status[i] = sources[i].Tick(read.source_configurations.config[i], read.adpcm_coefficients.coeff[i]); | ||
| 70 | for (size_t mix = 0; mix < 3; mix++) { | ||
| 71 | sources[i].MixInto(intermediate_mixes[mix], mix); | ||
| 72 | } | ||
| 73 | } | ||
| 74 | |||
| 51 | return true; | 75 | return true; |
| 52 | } | 76 | } |
| 53 | 77 | ||