Revert Emulator::Audio to use doubles instead of floats

* fixes ODR violations, but is slightly slower (378fps->376fps)
This commit is contained in:
byuu 2020-01-16 05:34:00 +09:00
parent 702977f0b9
commit 1afd440c86
6 changed files with 7 additions and 11 deletions

View File

@ -1,5 +1,3 @@
#define double float
namespace Emulator { namespace Emulator {
#include "stream.cpp" #include "stream.cpp"

View File

@ -1,5 +1,4 @@
#pragma once #pragma once
#define double float
#include <nall/dsp/iir/dc-removal.hpp> #include <nall/dsp/iir/dc-removal.hpp>
#include <nall/dsp/iir/one-pole.hpp> #include <nall/dsp/iir/one-pole.hpp>

View File

@ -17,7 +17,7 @@ struct Platform {
virtual auto open(uint id, string name, vfs::file::mode mode, bool required = false) -> shared_pointer<vfs::file> { return {}; } virtual auto open(uint id, string name, vfs::file::mode mode, bool required = false) -> shared_pointer<vfs::file> { return {}; }
virtual auto load(uint id, string name, string type, vector<string> options = {}) -> Load { return {}; } virtual auto load(uint id, string name, string type, vector<string> options = {}) -> Load { return {}; }
virtual auto videoFrame(const uint16* data, uint pitch, uint width, uint height, uint scale) -> void {} virtual auto videoFrame(const uint16* data, uint pitch, uint width, uint height, uint scale) -> void {}
virtual auto audioFrame(const float* samples, uint channels) -> void {} virtual auto audioFrame(const double* samples, uint channels) -> void {}
virtual auto inputPoll(uint port, uint device, uint input) -> int16 { return 0; } virtual auto inputPoll(uint port, uint device, uint input) -> int16 { return 0; }
virtual auto inputRumble(uint port, uint device, uint input, bool enable) -> void {} virtual auto inputRumble(uint port, uint device, uint input, bool enable) -> void {}
virtual auto dipSettings(Markup::Node node) -> uint { return 0; } virtual auto dipSettings(Markup::Node node) -> uint { return 0; }

View File

@ -20,7 +20,7 @@ auto ICD::ppuWrite(uint2 color) -> void {
} }
auto ICD::apuWrite(float left, float right) -> void { auto ICD::apuWrite(float left, float right) -> void {
float samples[] = {left, right}; double samples[] = {left, right};
if(!system.runAhead) stream->write(samples); if(!system.runAhead) stream->write(samples);
} }

View File

@ -253,14 +253,13 @@ auto Program::videoFrame(const uint16* data, uint pitch, uint width, uint height
} }
} }
auto Program::audioFrame(const float* samples, uint channels) -> void { auto Program::audioFrame(const double* samples, uint channels) -> void {
if(mute) { if(mute) {
double silence[] = {0.0, 0.0}; double silence[] = {0.0, 0.0};
return audio.output(silence); audio.output(silence);
} else {
audio.output(samples);
} }
double frame[] = {samples[0], samples[1]};
audio.output(frame);
} }
auto Program::inputPoll(uint port, uint device, uint input) -> int16 { auto Program::inputPoll(uint port, uint device, uint input) -> int16 {

View File

@ -10,7 +10,7 @@ struct Program : Lock, Emulator::Platform {
auto open(uint id, string name, vfs::file::mode mode, bool required) -> shared_pointer<vfs::file> override; auto open(uint id, string name, vfs::file::mode mode, bool required) -> shared_pointer<vfs::file> override;
auto load(uint id, string name, string type, vector<string> options = {}) -> Emulator::Platform::Load override; auto load(uint id, string name, string type, vector<string> options = {}) -> Emulator::Platform::Load override;
auto videoFrame(const uint16* data, uint pitch, uint width, uint height, uint scale) -> void override; auto videoFrame(const uint16* data, uint pitch, uint width, uint height, uint scale) -> void override;
auto audioFrame(const float* samples, uint channels) -> void override; auto audioFrame(const double* samples, uint channels) -> void override;
auto inputPoll(uint port, uint device, uint input) -> int16 override; auto inputPoll(uint port, uint device, uint input) -> int16 override;
auto inputRumble(uint port, uint device, uint input, bool enable) -> void override; auto inputRumble(uint port, uint device, uint input, bool enable) -> void override;