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

mqhardware.h (1621B)


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