commit d67c26628086f6151fc7de433a0eb98adc8871b5
parent 6a40a80d845b2d20d720f402e20cba471717cc7a
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Sat, 20 Jul 2024 02:00:15 +0200
send a midi note on event
Diffstat:
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/source/nord/n2x/n2xLib/CMakeLists.txt b/source/nord/n2x/n2xLib/CMakeLists.txt
@@ -20,7 +20,7 @@ set(SOURCES
target_sources(n2xLib PRIVATE ${SOURCES})
source_group("source" FILES ${SOURCES})
-target_link_libraries(n2xLib PUBLIC synthLib 68kEmu)
+target_link_libraries(n2xLib PUBLIC synthLib 68kEmu wLib)
if(DSP56300_DEBUGGER)
target_link_libraries(n2xLib PUBLIC dsp56kDebugger)
diff --git a/source/nord/n2x/n2xLib/n2xmc.cpp b/source/nord/n2x/n2xLib/n2xmc.cpp
@@ -4,6 +4,7 @@
#include "n2xdsp.h"
#include "n2xrom.h"
+#include "synthLib/midiTypes.h"
namespace n2x
{
@@ -238,6 +239,16 @@ namespace n2x
m_hdi08A.exec(cycles);
m_hdi08B.exec(cycles);
+ m_totalCycles += cycles;
+
+ if(m_totalCycles > 0x1000000 && !m_hasSentMidi)
+ {
+ m_hasSentMidi = true;
+
+ m_midi.writeMidi(synthLib::M_NOTEON);
+ m_midi.writeMidi(synthLib::Note_C3);
+ m_midi.writeMidi(100);
+ }
return cycles;
}
}
diff --git a/source/nord/n2x/n2xLib/n2xmc.h b/source/nord/n2x/n2xLib/n2xmc.h
@@ -5,6 +5,7 @@
#include "mc68k/hdi08.h"
#include "mc68k/hdi08periph.h"
#include "mc68k/mc68k.h"
+#include "wLib/wMidi.h"
namespace n2x
{
@@ -20,6 +21,7 @@ namespace n2x
auto& getHdi08A() { return m_hdi08A.getHdi08(); }
auto& getHdi08B() { return m_hdi08B.getHdi08(); }
+ auto& getMidi() const { return m_midi; }
uint32_t exec() override;
@@ -42,5 +44,8 @@ namespace n2x
Hdi08DspB m_hdi08B;
uint32_t m_prevPC;
+ wLib::Midi m_midi;
+ uint64_t m_totalCycles = 0;
+ bool m_hasSentMidi = false;
};
}