diff options
author | bunnei <bunneidev@gmail.com> | 2018-08-06 05:35:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-06 05:35:22 +0200 |
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 yuzu-bb21c2198a35fe714d5d95c49b93a8848933e9b4.tar.gz yuzu-bb21c2198a35fe714d5d95c49b93a8848933e9b4.tar.bz2 yuzu-bb21c2198a35fe714d5d95c49b93a8848933e9b4.tar.lz yuzu-bb21c2198a35fe714d5d95c49b93a8848933e9b4.tar.xz yuzu-bb21c2198a35fe714d5d95c49b93a8848933e9b4.tar.zst yuzu-bb21c2198a35fe714d5d95c49b93a8848933e9b4.zip |
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 @@ +// Copyright 2018 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include <array> +#include <vector> + +#include "common/common_types.h" + +namespace AudioCore::Codec { + +enum class PcmFormat : u32 { + Invalid = 0, + Int8 = 1, + Int16 = 2, + Int24 = 3, + Int32 = 4, + PcmFloat = 5, + Adpcm = 6, +}; + +/// See: Codec::DecodeADPCM +struct ADPCMState { + // Two historical samples from previous processed buffer, + // required for ADPCM decoding + s16 yn1; ///< y[n-1] + s16 yn2; ///< y[n-2] +}; + +using ADPCM_Coeff = std::array<s16, 16>; + +/** + * @param data Pointer to buffer that contains ADPCM data to decode + * @param size Size of buffer in bytes + * @param coeff ADPCM coefficients + * @param state ADPCM state, this is updated with new state + * @return Decoded stereo signed PCM16 data, sample_count in length + */ +std::vector<s16> DecodeADPCM(const u8* const data, size_t size, const ADPCM_Coeff& coeff, + ADPCMState& state); + +}; // namespace AudioCore::Codec |