AudioCommon: Get initial sample rates from AudioInterface
This commit is contained in:
parent
1a1b89e7e8
commit
bd44106fec
|
@ -15,6 +15,7 @@
|
|||
#include "Common/FileUtil.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/HW/AudioInterface.h"
|
||||
|
||||
// This shouldn't be a global, at least not here.
|
||||
std::unique_ptr<SoundStream> g_sound_stream;
|
||||
|
@ -67,6 +68,12 @@ void InitSoundStream()
|
|||
g_sound_stream->Init();
|
||||
}
|
||||
|
||||
// Ideally these two calls would be done in AudioInterface::Init so that we don't
|
||||
// need to have a dependency on AudioInterface here, but this has to be done
|
||||
// after creating g_sound_stream (above) and before starting audio dumping (below)
|
||||
g_sound_stream->GetMixer()->SetDMAInputSampleRate(AudioInterface::GetAIDSampleRate());
|
||||
g_sound_stream->GetMixer()->SetStreamInputSampleRate(AudioInterface::GetAISSampleRate());
|
||||
|
||||
UpdateSoundStream();
|
||||
SetSoundStreamRunning(true);
|
||||
|
||||
|
|
|
@ -293,11 +293,16 @@ bool IsPlaying()
|
|||
return (s_control.PSTAT == 1);
|
||||
}
|
||||
|
||||
unsigned int GetAIDSampleRate()
|
||||
u32 GetAIDSampleRate()
|
||||
{
|
||||
return s_aid_sample_rate;
|
||||
}
|
||||
|
||||
u32 GetAISSampleRate()
|
||||
{
|
||||
return s_ais_sample_rate;
|
||||
}
|
||||
|
||||
u32 Get32KHzSampleRate()
|
||||
{
|
||||
return SConfig::GetInstance().bWii ? 32000 : 32029;
|
||||
|
|
|
@ -24,7 +24,8 @@ bool IsPlaying();
|
|||
void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
|
||||
|
||||
// Get the audio rates (48000 or 32000 only)
|
||||
unsigned int GetAIDSampleRate();
|
||||
u32 GetAIDSampleRate();
|
||||
u32 GetAISSampleRate();
|
||||
|
||||
u32 Get32KHzSampleRate();
|
||||
u32 Get48KHzSampleRate();
|
||||
|
|
|
@ -294,7 +294,8 @@ static u32 AdvanceDTK(u32 maximum_samples, u32* samples_to_process)
|
|||
static void DTKStreamingCallback(DIInterruptType interrupt_type, const std::vector<u8>& audio_data,
|
||||
s64 cycles_late)
|
||||
{
|
||||
// TODO: Should we use the configured AIS sample rate instead of a fixed 48 KHz?
|
||||
// TODO: Should we use GetAISSampleRate instead of a fixed 48 KHz? The audio mixer is using
|
||||
// GetAISSampleRate. (This doesn't affect any actual games, since they all set it to 48 KHz.)
|
||||
const u32 sample_rate = AudioInterface::Get48KHzSampleRate();
|
||||
|
||||
// Determine which audio data to read next.
|
||||
|
|
Loading…
Reference in New Issue