diff options
| author | 2018-08-05 23:35:22 -0400 | |
|---|---|---|
| committer | 2018-08-05 23:35:22 -0400 | |
| commit | bb21c2198a35fe714d5d95c49b93a8848933e9b4 (patch) | |
| tree | 2a3da0f4203422bce7f999b9e1597e51ea875bf2 /src/audio_core/codec.h | |
| parent | Merge pull request #927 from bunnei/fix-texs (diff) | |
| parent | audio_core: Implement audren_u audio playback. (diff) | |
| download | yuzu-bb21c2198a35fe714d5d95c49b93a8848933e9b4.tar.gz yuzu-bb21c2198a35fe714d5d95c49b93a8848933e9b4.tar.xz yuzu-bb21c2198a35fe714d5d95c49b93a8848933e9b4.zip | |
Merge pull request #925 from bunnei/audren
Implement audren audio output
Diffstat (limited to 'src/audio_core/codec.h')
| -rw-r--r-- | src/audio_core/codec.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/audio_core/codec.h b/src/audio_core/codec.h new file mode 100644 index 000000000..3f845c42c --- /dev/null +++ b/src/audio_core/codec.h | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | // Copyright 2018 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <array> | ||
| 8 | #include <vector> | ||
| 9 | |||
| 10 | #include "common/common_types.h" | ||
| 11 | |||
| 12 | namespace AudioCore::Codec { | ||
| 13 | |||
| 14 | enum class PcmFormat : u32 { | ||
| 15 | Invalid = 0, | ||
| 16 | Int8 = 1, | ||
| 17 | Int16 = 2, | ||
| 18 | Int24 = 3, | ||
| 19 | Int32 = 4, | ||
| 20 | PcmFloat = 5, | ||
| 21 | Adpcm = 6, | ||
| 22 | }; | ||
| 23 | |||
| 24 | /// See: Codec::DecodeADPCM | ||
| 25 | struct ADPCMState { | ||
| 26 | // Two historical samples from previous processed buffer, | ||
| 27 | // required for ADPCM decoding | ||
| 28 | s16 yn1; ///< y[n-1] | ||
| 29 | s16 yn2; ///< y[n-2] | ||
| 30 | }; | ||
| 31 | |||
| 32 | using ADPCM_Coeff = std::array<s16, 16>; | ||
| 33 | |||
| 34 | /** | ||
| 35 | * @param data Pointer to buffer that contains ADPCM data to decode | ||
| 36 | * @param size Size of buffer in bytes | ||
| 37 | * @param coeff ADPCM coefficients | ||
| 38 | * @param state ADPCM state, this is updated with new state | ||
| 39 | * @return Decoded stereo signed PCM16 data, sample_count in length | ||
| 40 | */ | ||
| 41 | std::vector<s16> DecodeADPCM(const u8* const data, size_t size, const ADPCM_Coeff& coeff, | ||
| 42 | ADPCMState& state); | ||
| 43 | |||
| 44 | }; // namespace AudioCore::Codec | ||