commit e5d9790e4dd20c9c31c3df371c4d949e6cfeef0f
parent 041847fd45c3f672f430d2d722fb1b644a01f674
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Wed, 24 Jul 2024 00:09:30 +0200
we can render the demos
Diffstat:
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/source/nord/n2x/n2xTestConsole/n2xTestConsole.cpp b/source/nord/n2x/n2xTestConsole/n2xTestConsole.cpp
@@ -2,6 +2,7 @@
#include "n2xLib/n2xhardware.h"
#include "n2xLib/n2xrom.h"
+#include "synthLib/wavWriter.h"
namespace n2x
{
@@ -21,6 +22,34 @@ int main()
std::unique_ptr<n2x::Hardware> hw;
hw.reset(new n2x::Hardware());
+ std::thread ucThread([&]()
+ {
+ while(true)
+ hw->processUC();
+ });
+
+ constexpr uint32_t blockSize = 64;
+
+ std::vector<dsp56k::TWord> stereoOutput;
+ stereoOutput.resize(blockSize<<1);
+
+ synthLib::AsyncWriter writer("n2xEmu_out.wav", n2x::g_samplerate, false);
+
while(true)
- hw->process();
+ {
+ hw->processAudio(blockSize);
+
+ auto& outs = hw->getAudioOutputs();
+
+ for(size_t i=0; i<blockSize; ++i)
+ {
+ stereoOutput[(i<<1) ] = outs[0][i] + outs[2][i];
+ stereoOutput[(i<<1)+1] = outs[1][i] + outs[3][i];
+ }
+
+ writer.append([&](std::vector<dsp56k::TWord>& _wavOut)
+ {
+ _wavOut.insert(_wavOut.end(), stereoOutput.begin(), stereoOutput.end());
+ });
+ }
}