gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

xtHardware.h (1470B)


      1 #pragma once
      2 
      3 #include "xtDSP.h"
      4 #include "xtRom.h"
      5 #include "xtUc.h"
      6 #include "xtMidi.h"
      7 
      8 #include "dsp56kEmu/dspthread.h"
      9 
     10 #include "hardwareLib/sciMidi.h"
     11 
     12 #include "wLib/wHardware.h"
     13 
     14 namespace xt
     15 {
     16 	class XtUc;
     17 
     18 	class Hardware : public wLib::Hardware
     19 	{
     20 		static constexpr uint32_t g_dspCount = 1;
     21 
     22 	public:
     23 		explicit Hardware(const std::vector<uint8_t>& _romData, const std::string& _romName);
     24 		~Hardware() override;
     25 
     26 		void process();
     27 
     28 		XtUc& getUC() { return m_uc; }
     29 		DSP& getDSP(uint32_t _index = 0) { return m_dsps[_index]; }
     30 		uint64_t getUcCycles() const { return m_uc.getCycles(); }
     31 
     32 		auto& getAudioInputs() { return m_audioInputs; }
     33 		auto& getAudioOutputs() { return m_audioOutputs; }
     34 
     35 		dsp56k::DSPThread& getDspThread(uint32_t _index = 0) { return m_dsps[_index].thread(); }
     36 
     37 		void processAudio(uint32_t _frames, uint32_t _latency = 0);
     38 
     39 		void ensureBufferSize(uint32_t _frames);
     40 
     41 		void ucThreadTerminated()
     42 		{
     43 			resumeDSP();
     44 		}
     45 
     46 		bool isValid() const { return m_rom.isValid(); }
     47 
     48 		bool isBootCompleted() const { return m_bootCompleted; }
     49 		void resetMidiCounter();
     50 
     51 		void initVoiceExpansion();
     52 
     53 		hwLib::SciMidi& getMidi() override
     54 		{
     55 			return m_midi;
     56 		}
     57 
     58 		mc68k::Mc68k& getUc() override
     59 		{
     60 			return m_uc;
     61 		}
     62 
     63 	private:
     64 		void setupEsaiListener();
     65 		void processUcCycle();
     66 
     67 		const Rom m_rom;
     68 
     69 		XtUc m_uc;
     70 		TAudioInputs m_audioInputs;
     71 		TAudioOutputs m_audioOutputs;
     72 		std::array<DSP,g_dspCount> m_dsps;
     73 		SciMidi m_midi;
     74 	};
     75 }