Libretro: Use 96 kHz sample rate internally instead of 48 kHz.
-Reverted to using retro_audio_sample_t because retro_audio_sample_batch_t fails when batch sizes are too large -Using 96 kHz instead of 384 kHz because the latter causes a noticeable performance reduction, and there appears to be no way to change the sample rate on-the-fly (so can't make it an option)
This commit is contained in:
parent
e4b6a7ab64
commit
ee3d05ba58
3 changed files with 12 additions and 10 deletions
|
@ -54,7 +54,7 @@ public:
|
|||
void GetSystemAudioVideoInfo(retro_system_av_info &info, int32_t maxWidth = 0, int32_t maxHeight = 0)
|
||||
{
|
||||
info.timing.fps = _console->GetModel() == NesModel::NTSC ? 60.098811862348404716732985230828 : 50.006977968268290848936010226333;
|
||||
info.timing.sample_rate = 48000;
|
||||
info.timing.sample_rate = _console->GetSettings()->GetSampleRate();
|
||||
|
||||
float ratio = (float)_console->GetSettings()->GetAspectRatio(_console);
|
||||
if(ratio == 0.0f) {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
class LibretroSoundManager : public IAudioDevice
|
||||
{
|
||||
private:
|
||||
retro_audio_sample_batch_t _sendAudioBuffer = nullptr;
|
||||
retro_audio_sample_t _sendAudioSample = nullptr;
|
||||
bool _skipMode = false;
|
||||
shared_ptr<Console> _console;
|
||||
|
||||
|
@ -26,14 +26,16 @@ public:
|
|||
// Inherited via IAudioDevice
|
||||
virtual void PlayBuffer(int16_t *soundBuffer, uint32_t sampleCount, uint32_t sampleRate, bool isStereo) override
|
||||
{
|
||||
if(!_skipMode && _sendAudioBuffer) {
|
||||
_sendAudioBuffer(soundBuffer, sampleCount);
|
||||
if(!_skipMode && _sendAudioSample) {
|
||||
for(uint32_t i = 0; i < sampleCount; i++) {
|
||||
_sendAudioSample(soundBuffer[i*2], soundBuffer[i*2+1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetSendAudioBuffer(retro_audio_sample_batch_t sendAudioBuffer)
|
||||
void SetSendAudioSample(retro_audio_sample_t sendAudioSample)
|
||||
{
|
||||
_sendAudioBuffer = sendAudioBuffer;
|
||||
_sendAudioSample = sendAudioSample;
|
||||
}
|
||||
|
||||
void SetSkipMode(bool skip)
|
||||
|
|
|
@ -122,7 +122,7 @@ extern "C" {
|
|||
|
||||
_console->GetSettings()->SetFlags(EmulationFlags::FdsAutoLoadDisk);
|
||||
_console->GetSettings()->SetFlags(EmulationFlags::AutoConfigureInput);
|
||||
_console->GetSettings()->SetSampleRate(48000);
|
||||
_console->GetSettings()->SetSampleRate(96000);
|
||||
_console->GetSettings()->SetAutoSaveOptions(0, false);
|
||||
_console->GetSettings()->SetRewindBufferSize(0);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ extern "C" {
|
|||
{ MesenRegion, "Region; Auto|NTSC|PAL|Dendy" },
|
||||
{ MesenOverscanVertical, "Vertical Overscan; None|8px|16px" },
|
||||
{ MesenOverscanHorizontal, "Horizontal Overscan; None|8px|16px" },
|
||||
{ MesenAspectRatio , "Aspect Ratio; Auto|No Stretching|NTSC|PAL|4:3|16:9" },
|
||||
{ MesenAspectRatio, "Aspect Ratio; Auto|No Stretching|NTSC|PAL|4:3|16:9" },
|
||||
{ MesenControllerTurboSpeed, "Controller Turbo Speed; Fast|Very Fast|Disabled|Slow|Normal" },
|
||||
{ MesenHdPacks, "Enable HD Packs; enabled|disabled" },
|
||||
{ MesenNoSpriteLimit, "Remove sprite limit; enabled|disabled" },
|
||||
|
@ -238,16 +238,16 @@ extern "C" {
|
|||
|
||||
RETRO_API void retro_set_audio_sample(retro_audio_sample_t sendAudioSample)
|
||||
{
|
||||
_soundManager->SetSendAudioSample(sendAudioSample);
|
||||
}
|
||||
|
||||
RETRO_API void retro_set_audio_sample_batch(retro_audio_sample_batch_t audioSampleBatch)
|
||||
{
|
||||
_soundManager->SetSendAudioBuffer(audioSampleBatch);
|
||||
}
|
||||
|
||||
RETRO_API void retro_set_input_poll(retro_input_poll_t pollInput)
|
||||
{
|
||||
_keyManager->SetPollInput(pollInput);
|
||||
_keyManager->SetPollInput(pollInput);
|
||||
}
|
||||
|
||||
RETRO_API void retro_set_input_state(retro_input_state_t getInputState)
|
||||
|
|
Loading…
Add table
Reference in a new issue