Merge pull request #1727 from MerryMage/minor-commit
AudioCore: Move samples_per_frame and num_sources into hle/common.h
This commit is contained in:
commit
fda578e19d
|
@ -10,8 +10,6 @@ class VMManager;
|
||||||
|
|
||||||
namespace AudioCore {
|
namespace AudioCore {
|
||||||
|
|
||||||
constexpr int num_sources = 24;
|
|
||||||
constexpr int samples_per_frame = 160; ///< Samples per audio frame at native sample rate
|
|
||||||
constexpr int native_sample_rate = 32728; ///< 32kHz
|
constexpr int native_sample_rate = 32728; ///< 32kHz
|
||||||
|
|
||||||
/// Initialise Audio Core
|
/// Initialise Audio Core
|
||||||
|
|
|
@ -7,18 +7,19 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#include "audio_core/audio_core.h"
|
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|
||||||
namespace DSP {
|
namespace DSP {
|
||||||
namespace HLE {
|
namespace HLE {
|
||||||
|
|
||||||
|
constexpr int num_sources = 24;
|
||||||
|
constexpr int samples_per_frame = 160; ///< Samples per audio frame at native sample rate
|
||||||
|
|
||||||
/// The final output to the speakers is stereo. Preprocessing output in Source is also stereo.
|
/// The final output to the speakers is stereo. Preprocessing output in Source is also stereo.
|
||||||
using StereoFrame16 = std::array<std::array<s16, 2>, AudioCore::samples_per_frame>;
|
using StereoFrame16 = std::array<std::array<s16, 2>, samples_per_frame>;
|
||||||
|
|
||||||
/// The DSP is quadraphonic internally.
|
/// The DSP is quadraphonic internally.
|
||||||
using QuadFrame32 = std::array<std::array<s32, 4>, AudioCore::samples_per_frame>;
|
using QuadFrame32 = std::array<std::array<s32, 4>, samples_per_frame>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This performs the filter operation defined by FilterT::ProcessSample on the frame in-place.
|
* This performs the filter operation defined by FilterT::ProcessSample on the frame in-place.
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#include "audio_core/audio_core.h"
|
#include "audio_core/hle/common.h"
|
||||||
|
|
||||||
#include "common/bit_field.h"
|
#include "common/bit_field.h"
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
|
@ -305,7 +305,7 @@ struct SourceConfiguration {
|
||||||
u16_le buffer_id;
|
u16_le buffer_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
Configuration config[AudioCore::num_sources];
|
Configuration config[num_sources];
|
||||||
};
|
};
|
||||||
ASSERT_DSP_STRUCT(SourceConfiguration::Configuration, 192);
|
ASSERT_DSP_STRUCT(SourceConfiguration::Configuration, 192);
|
||||||
ASSERT_DSP_STRUCT(SourceConfiguration::Configuration::Buffer, 20);
|
ASSERT_DSP_STRUCT(SourceConfiguration::Configuration::Buffer, 20);
|
||||||
|
@ -320,7 +320,7 @@ struct SourceStatus {
|
||||||
INSERT_PADDING_DSPWORDS(1);
|
INSERT_PADDING_DSPWORDS(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
Status status[AudioCore::num_sources];
|
Status status[num_sources];
|
||||||
};
|
};
|
||||||
ASSERT_DSP_STRUCT(SourceStatus::Status, 12);
|
ASSERT_DSP_STRUCT(SourceStatus::Status, 12);
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ ASSERT_DSP_STRUCT(DspConfiguration::ReverbEffect, 52);
|
||||||
struct AdpcmCoefficients {
|
struct AdpcmCoefficients {
|
||||||
/// Coefficients are signed fixed point with 11 fractional bits.
|
/// Coefficients are signed fixed point with 11 fractional bits.
|
||||||
/// Each source has 16 coefficients associated with it.
|
/// Each source has 16 coefficients associated with it.
|
||||||
s16_le coeff[AudioCore::num_sources][16];
|
s16_le coeff[num_sources][16];
|
||||||
};
|
};
|
||||||
ASSERT_DSP_STRUCT(AdpcmCoefficients, 768);
|
ASSERT_DSP_STRUCT(AdpcmCoefficients, 768);
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ ASSERT_DSP_STRUCT(DspStatus, 32);
|
||||||
/// Final mixed output in PCM16 stereo format, what you hear out of the speakers.
|
/// Final mixed output in PCM16 stereo format, what you hear out of the speakers.
|
||||||
/// When the application writes to this region it has no effect.
|
/// When the application writes to this region it has no effect.
|
||||||
struct FinalMixSamples {
|
struct FinalMixSamples {
|
||||||
s16_le pcm16[2 * AudioCore::samples_per_frame];
|
s16_le pcm16[2 * samples_per_frame];
|
||||||
};
|
};
|
||||||
ASSERT_DSP_STRUCT(FinalMixSamples, 640);
|
ASSERT_DSP_STRUCT(FinalMixSamples, 640);
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ ASSERT_DSP_STRUCT(FinalMixSamples, 640);
|
||||||
/// Values that exceed s16 range will be clipped by the DSP after further processing.
|
/// Values that exceed s16 range will be clipped by the DSP after further processing.
|
||||||
struct IntermediateMixSamples {
|
struct IntermediateMixSamples {
|
||||||
struct Samples {
|
struct Samples {
|
||||||
s32_le pcm32[4][AudioCore::samples_per_frame]; ///< Little-endian as opposed to DSP middle-endian.
|
s32_le pcm32[4][samples_per_frame]; ///< Little-endian as opposed to DSP middle-endian.
|
||||||
};
|
};
|
||||||
|
|
||||||
Samples mix1;
|
Samples mix1;
|
||||||
|
|
Loading…
Reference in a new issue